X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=zpm-syncfs.c;h=0b88928d456ae875bd940a8d1fdabdf65c0f30ec;hb=6fbdbc82ac30e6beea0e5a5ce0b6fd11311abe2c;hp=f603fa78bca65a9744a709737f6c7dfaa3c93626;hpb=f961fc7796670b908f59b09b17284f9caf47f8af;p=zpackage diff --git a/zpm-syncfs.c b/zpm-syncfs.c index f603fa7..0b88928 100644 --- a/zpm-syncfs.c +++ b/zpm-syncfs.c @@ -607,9 +607,11 @@ static int set_md(struct config *conf, struct nitem *item) { int success = 0; if (conf->dryrun) { - printf("chmod %o %s\n", item->mode, item->dest); + if (item->ftype != 'l') { + printf("chmod %o %s\n", item->mode, item->dest); + } if (conf->setuser && conf->setgroup) { - printf("chown %d:%d %s\n", item->uid, item->gid, + printf("lchown %d:%d %s\n", item->uid, item->gid, item->dest); } printf("mtime %.0f %s\n", (double)item->mtime, item->dest); @@ -617,17 +619,20 @@ static int set_md(struct config *conf, struct nitem *item) { return success; } - rv = chmod(item->dest, item->mode); + /* can't chmod a symlink */ + if (item->ftype != 'l') { + rv = chmod(item->dest, item->mode); - if (rv == -1) { - setsyserr(conf, "can't chmod %o %s", item->mode, item->dest); - return conf->errabort; + if (rv == -1) { + setsyserr(conf, "can't chmod %o %s", item->mode, item->dest); + return conf->errabort; + } } if (conf->setuser && conf->setgroup) { - rv = chown(item->dest, item->uid, item->gid); + rv = lchown(item->dest, item->uid, item->gid); if (rv == -1) { - setsyserr(conf, "can't chown %s", item->dest); + setsyserr(conf, "can't lchown %s", item->dest); return conf->errabort; } } @@ -676,9 +681,13 @@ static int install(struct config *conf, struct nitem *item, unsigned int flags) printf("rmdir %s\n", item->dest); } - printf("install %c%o %d:%d %s -> %s\n", item->ftype, - item->mode, item->uid, item->gid, item->path, + printf("install %c%o %d:%d %s", item->ftype, + item->mode, item->uid, item->gid, item->dest); + if (item->ftype == 'l') { + printf(" -> %s", item->target); + } + printf("\n"); fflush(stdout); return success; } @@ -1293,6 +1302,7 @@ int main(int ac, char **av){ conf.log = &localdb; if (pkgdbfile) { + /* TODO open read-only */ if (!zpm_open(&pkgdb, pkgdbfile)) { fprintf(stderr, "can't open src db %s\n", localdbfile); exit(EXIT_FAILURE);