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);
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;
}
}
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;
}
}
return 0;
}
+
if (mdsame && hashsame && !(accept || overwrite)) {
/* error */
return seterror(conf, "file exists: %s", nitem.dest);
}
+
if (mdsame && !hashsame && overwrite) {
/* install */
return install(conf, &nitem, eisdir ? 11 : 7);
}
+
+ if (nitem.configuration && accept) {
+ /* accept a changed config file */
+ if (conf->dryrun || conf->verbose) {
+ fprintf(stderr, "accept %smodified config %s: %s\n", (!mdsame || !hashsame) ? "" : "un",
+ eisdir ? "directory" : "file", nitem.dest);
+ }
+ return 0;
+ }
+
if (mdsame && !hashsame && !overwrite) {
/* accept doesn't matter, since it's
* not an acceptable file */
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);