Bug#193653: Please apply this patch for Triggers
Package: dpkg
Version: unavailable; reported 2003-05-17
Severity: wishlist
Tags: sid patch
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,
please apply this patch, which introduced support for triggers. The patch is
written by Russell Coker <russell@coker.com.au> to allow the selinux package
to set the file contexts after package installations.
Regards
Torsten
- -- System Information:
Debian Release: testing/unstable
Architecture: sh: line 1: /usr/bin/dpkg: Permission denied
Kernel: Linux tk-hybrid-1 2.4.20 #4 Son Mai 4 12:23:33 CEST 2003 i586
Locale: LANG=C, LC_CTYPE=C
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
iD8DBQE+xl3UX1/CjdwsodIRAogMAJ0WgnFY1NYoc3olRP8mYM5b2Gh13QCffjLX
TX9WTTwOUXAmY8LyHesWJt8=
=nXxR
-----END PGP SIGNATURE-----
diff -uiwbBrN plain/dpkg-1.10.10/debian/dselect.substvars included/dpkg-1.10.10.se1/debian/dselect.substvars
--- plain/dpkg-1.10.10/debian/dselect.substvars 1970-01-01 01:00:00.000000000 +0100
+++ included/dpkg-1.10.10.se1/debian/dselect.substvars 2003-05-01 17:20:38.000000000 +0200
@@ -0,0 +1 @@
+shlibs:Depends=libc6 (>= 2.2.5-13), libncurses5 (>= 5.2.20020112a-1), libstdc++2.10-glibc2.2 (>= 1:2.95.4-0.010810)
diff -uiwbBrN plain/dpkg-1.10.10/debian/rules included/dpkg-1.10.10.se1/debian/rules
--- plain/dpkg-1.10.10/debian/rules 2003-04-26 22:10:12.000000000 +0200
+++ included/dpkg-1.10.10.se1/debian/rules 2003-05-01 17:20:38.000000000 +0200
@@ -162,6 +162,8 @@
$(TMP_DPKG)/usr/share/doc/dpkg$(static)/
install -p -m 644 -o root -g root debian/copyright \
$(TMP_DPKG)/usr/share/doc/dpkg$(static)/
+ install -d -m 755 -o root -g root $(TMP_DPKG)/etc/dpkg/preinst.d $(TMP_DPKG)/etc/dpkg/postinst.d
+ install -d -m 755 -o root -g root $(TMP_DPKG)/etc/dpkg/prerm.d $(TMP_DPKG)/etc/dpkg/postrm.d
# Final package creation
install -d -m 755 -o root -g root $(TMP_DPKG)/DEBIAN
diff -uiwbBrN plain/dpkg-1.10.10/main/help.c included/dpkg-1.10.10.se1/main/help.c
--- plain/dpkg-1.10.10/main/help.c 2002-09-15 19:55:51.000000000 +0200
+++ included/dpkg-1.10.10.se1/main/help.c 2003-05-01 17:20:38.000000000 +0200
@@ -276,6 +276,21 @@
return r;
}
+static int run_trigger(int pre, const char * const pkg, const char * const script)
+{
+ char run_parts[1024];
+ int rc;
+ if(pre && !strncmp(script, "pre", 3))
+ return;
+ if(!pre && strncmp(script, "pre", 3))
+ return;
+ snprintf(run_parts, sizeof(run_parts), "/bin/run-parts --arg=%s /etc/dpkg/%s.d", pkg, script);
+ rc = system(run_parts);
+ if(rc)
+ printf("\"%s\" failed: %d\n", run_parts, rc);
+ return rc;
+}
+
int maintainer_script_installed(struct pkginfo *pkg, const char *scriptname,
const char *description, ...) {
/* all ...'s are const char*'s */
@@ -291,15 +306,21 @@
va_end(ap);
sprintf(buf,"%s script",description);
+ if(run_trigger(1, pkg->name, scriptname))
+ ohshite(_("1Error running trigger %s"), scriptname);
if (stat(scriptpath,&stab)) {
if (errno == ENOENT) {
debug(dbg_scripts,"maintainer_script_installed nonexistent %s",scriptname);
+ run_trigger(0, pkg->name, scriptname);
+/* ohshite(_("2Error running trigger %s"), scriptname);*/
return 0;
}
ohshite(_("unable to stat installed %s script `%.250s'"),description,scriptpath);
}
do_script(pkg->name, scriptname, scriptpath, &stab, arglist, _("unable to execute %s"), buf, 0);
ensure_diversions();
+ run_trigger(0, pkg->name, scriptname);
+/* ohshite(_("3Error running trigger %s"), scriptname); */
return 1;
}
@@ -317,15 +338,21 @@
sprintf(buf,"%s script",description);
strcpy(cidirrest,scriptname);
+ if(run_trigger(1, pkgname, scriptname))
+ ohshite(_("4Error running trigger %s"), scriptname);
if (stat(cidir,&stab)) {
if (errno == ENOENT) {
debug(dbg_scripts,"maintainer_script_new nonexistent %s `%s'",scriptname,cidir);
+ run_trigger(0, pkgname, scriptname);
+/* ohshite(_("5Error running trigger %s"), scriptname);*/
return 0;
}
ohshite(_("unable to stat new %s script `%.250s'"),description,cidir);
}
do_script(pkgname, scriptname, cidir, &stab, arglist, _("unable to execute new %s"), buf, 0);
ensure_diversions();
+ if(run_trigger(0, pkgname, scriptname))
+ ohshite(_("6Error running trigger %s"), scriptname);
return 1;
}
@@ -344,10 +371,14 @@
vdew_nonambig),
(char*)0);
sprintf(buf,_("old %s script"),description);
+ if(run_trigger(1, pkg->name, scriptname))
+ ohshite(_("7Error running trigger %s"), scriptname);
if (stat(oldscriptpath,&stab)) {
if (errno == ENOENT) {
debug(dbg_scripts,"maintainer_script_alternative nonexistent %s `%s'",
scriptname,oldscriptpath);
+ run_trigger(0, pkg->name, scriptname);
+/* ohshite(_("8Error running trigger %s"), scriptname);*/
return 0;
}
fprintf(stderr,
@@ -355,7 +386,11 @@
buf,oldscriptpath,strerror(errno));
} else {
if (!do_script(pkg->name, scriptname, oldscriptpath, &stab, arglist, _("unable to execute %s"), buf, PROCWARN))
+ {
+ run_trigger(0, pkg->name, scriptname);
+/* ohshite(_("9Error running trigger %s"), scriptname); */
return 1;
+ }
ensure_diversions();
}
fprintf(stderr, _("dpkg - trying script from the new package instead ...\n"));
@@ -378,6 +413,8 @@
fprintf(stderr, _("dpkg: ... it looks like that went OK.\n"));
ensure_diversions();
+ if(run_trigger(0, pkg->name, scriptname))
+ ohshite(_("aError running trigger %s"), scriptname);
return 1;
}
Reply to: