diff options
author | jkh <jkh@FreeBSD.org> | 1993-09-18 03:39:50 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1993-09-18 03:39:50 +0000 |
commit | 14f46efaad7cbf35d71371ee36e6dea380ecc3b6 (patch) | |
tree | df3e5110c881894a7d75609acee5c3149906a41b /usr.sbin/pkg_install/lib/plist.c | |
parent | c8b21d348caf8859889cddf47bfacd774107faac (diff) | |
download | FreeBSD-src-14f46efaad7cbf35d71371ee36e6dea380ecc3b6.zip FreeBSD-src-14f46efaad7cbf35d71371ee36e6dea380ecc3b6.tar.gz |
Added code for doing % sequence expansion, added new @unexec command.
Diffstat (limited to 'usr.sbin/pkg_install/lib/plist.c')
-rw-r--r-- | usr.sbin/pkg_install/lib/plist.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/usr.sbin/pkg_install/lib/plist.c b/usr.sbin/pkg_install/lib/plist.c index 1f2e09f..6c54e66 100644 --- a/usr.sbin/pkg_install/lib/plist.c +++ b/usr.sbin/pkg_install/lib/plist.c @@ -1,5 +1,5 @@ #ifndef lint -static const char *rcsid = "$Id: plist.c,v 1.6 1993/09/04 05:06:52 jkh Exp $"; +static const char *rcsid = "$Id: plist.c,v 1.4 1993/09/12 20:45:53 jkh Exp $"; #endif /* @@ -184,6 +184,8 @@ plist_cmd(char *s, char **arg) return PLIST_CWD; else if (!strcmp(cmd, "exec")) return PLIST_CMD; + else if (!strcmp(cmd, "unexec")) + return PLIST_UNEXEC; else if (!strcmp(cmd, "mode")) return PLIST_CHMOD; else if (!strcmp(cmd, "owner")) @@ -219,6 +221,8 @@ read_plist(Package *pkg, FILE *fp) cmd = plist_cmd(pline + 1, &cp); if (cmd == FAIL) barf("Bad command '%s'", pline); + if (*cp == '\0') + cp = NULL; } else cmd = PLIST_FILE; @@ -246,6 +250,10 @@ write_plist(Package *pkg, FILE *fp) fprintf(fp, "%cexec %s\n", CMD_CHAR, plist->name); break; + case PLIST_UNEXEC: + fprintf(fp, "%cunexec %s\n", CMD_CHAR, plist->name); + break; + case PLIST_CHMOD: fprintf(fp, "%cmode %s\n", CMD_CHAR, plist->name ? plist->name : ""); @@ -286,7 +294,7 @@ void delete_package(Boolean ign_err, Package *pkg) { PackingList p = pkg->head; - char *Where = "."; + char *Where = ".", *last_file = ""; while (p) { if (p->type == PLIST_CWD) { @@ -294,6 +302,15 @@ delete_package(Boolean ign_err, Package *pkg) if (Verbose) printf("(CWD to %s)\n", Where); } + else if (p->type == PLIST_UNEXEC) { + char cmd[FILENAME_MAX]; + + format_cmd(cmd, p->name, Where, last_file); + if (Verbose) + printf("unexec command: %s\n", cmd); + if (!Fake && system(cmd)) + whinge("unexec '%s' failed.", cmd); + } else if (p->type == PLIST_IGNORE) p = p->next; else if (p->type == PLIST_FILE) { @@ -305,6 +322,7 @@ delete_package(Boolean ign_err, Package *pkg) if (!Fake && delete_hierarchy(full_name, ign_err)) whinge("Unable to completely remove file '%s'", full_name); + last_file = p->name; } p = p->next; } |