summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorewt <devnull@localhost>1996-04-15 22:23:46 +0000
committerewt <devnull@localhost>1996-04-15 22:23:46 +0000
commit4d6d411489b30f00f656edd36eab0cc7e7b4d1cc (patch)
tree476814c653895058cc20fdd6d39dfe480aa616d2 /lib
parent35cd57b45759ff913a38478e22489620f590ce41 (diff)
downloadrpm-4d6d411489b30f00f656edd36eab0cc7e7b4d1cc.tar.gz
rpm-4d6d411489b30f00f656edd36eab0cc7e7b4d1cc.tar.bz2
rpm-4d6d411489b30f00f656edd36eab0cc7e7b4d1cc.zip
added support for INSTALL_NOSCRIPTS, UNINSTALL_NOSCRIPTS
changed test to use UNINSTALL_TEST flag CVS patchset: 549 CVS date: 1996/04/15 22:23:46
Diffstat (limited to 'lib')
-rw-r--r--lib/uninstall.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/uninstall.c b/lib/uninstall.c
index 5877f3554..4c3559c50 100644
--- a/lib/uninstall.c
+++ b/lib/uninstall.c
@@ -174,7 +174,7 @@ static int handleSharedFiles(rpmdb db, int offset, char ** fileList,
return rc;
}
-int rpmRemovePackage(char * prefix, rpmdb db, unsigned int offset, int test) {
+int rpmRemovePackage(char * prefix, rpmdb db, unsigned int offset, int flags) {
Header h;
int i;
int fileCount;
@@ -198,16 +198,16 @@ int rpmRemovePackage(char * prefix, rpmdb db, unsigned int offset, int test) {
/* dependency checking should go in here */
- if (test) {
+ if (flags & UNINSTALL_TEST) {
rmmess = "would remove";
} else {
rmmess = "removing";
}
message(MESS_DEBUG, "running preuninstall script (if any)\n");
- runScript(prefix, h, RPMTAG_PREUN);
+ runScript(prefix, h, RPMTAG_PREUN, flags & UNINSTALL_NOSCRIPTS);
- message(MESS_DEBUG, "%s files test = %d\n", rmmess, test);
+ message(MESS_DEBUG, "%s files test = %d\n", rmmess, flags & UNINSTALL_TEST);
if (!getEntry(h, RPMTAG_FILENAMES, &type, (void **) &fileList,
&fileCount)) {
puts("(contains no files)");
@@ -252,7 +252,7 @@ int rpmRemovePackage(char * prefix, rpmdb db, unsigned int offset, int test) {
removeFile(fnbuffer, fileStatesList[i], fileFlagsList[i],
fileMd5List[i], fileModesList[i], fileActions[i],
- rmmess, test);
+ rmmess, flags & UNINSTALL_TEST);
}
free(fileList);
@@ -260,18 +260,18 @@ int rpmRemovePackage(char * prefix, rpmdb db, unsigned int offset, int test) {
}
message(MESS_DEBUG, "running postuninstall script (if any)\n");
- runScript(prefix, h, RPMTAG_POSTUN);
+ runScript(prefix, h, RPMTAG_POSTUN, flags & UNINSTALL_NOSCRIPTS);
freeHeader(h);
message(MESS_DEBUG, "%s database entry\n", rmmess);
- if (!test)
+ if (!(flags & UNINSTALL_TEST))
rpmdbRemove(db, offset, 0);
return 0;
}
-int runScript(char * prefix, Header h, int tag) {
+int runScript(char * prefix, Header h, int tag, int norunScripts) {
int count, type;
char * script;
char * fn;
@@ -280,13 +280,15 @@ int runScript(char * prefix, Header h, int tag) {
int child;
int status;
+ if (!norunScripts) return 0;
+
if (getEntry(h, tag, &type, (void **) &script, &count)) {
fn = tmpnam(NULL);
message(MESS_DEBUG, "script found - running from file %s\n", fn);
fd = open(fn, O_CREAT | O_RDWR);
unlink(fn);
if (fd < 0) {
- error(RPMERR_SCRIPT, "error creating file for (un)install script");
+ error(RPMERR_SCRIPT, "error creating file for (un)install script");
return 1;
}
write(fd, SCRIPT_PATH, strlen(SCRIPT_PATH));