Просмотр исходного кода

dpkg: Rename and unify maintscript function names

Guillem Jover лет назад: 12
Родитель
Сommit
f375b5ea1f
7 измененных файлов с 138 добавлено и 143 удалено
  1. 43 45
      src/cleanup.c
  2. 5 5
      src/configure.c
  3. 11 11
      src/main.h
  4. 3 6
      src/remove.c
  5. 25 27
      src/script.c
  6. 2 2
      src/trigproc.c
  7. 49 47
      src/unpack.c

+ 43 - 45
src/cleanup.c

@@ -115,10 +115,9 @@ void cu_prermupgrade(int argc, void **argv) {
   struct pkginfo *pkg= (struct pkginfo*)argv[0];
 
   if (cleanup_pkg_failed++) return;
-  maintainer_script_postinst(pkg, "abort-upgrade",
-                             versiondescribe(&pkg->available.version,
-                                             vdew_nonambig),
-                             NULL);
+  maintscript_postinst(pkg, "abort-upgrade",
+                       versiondescribe(&pkg->available.version, vdew_nonambig),
+                       NULL);
   pkg_clear_eflags(pkg, eflag_reinstreq);
   post_postinst_tasks(pkg, stat_installed);
   cleanup_pkg_failed--;
@@ -144,25 +143,25 @@ void cu_prermdeconfigure(int argc, void **argv) {
   struct pkginfo *infavour= (struct pkginfo*)argv[2];
 
   if (conflictor) {
-    maintainer_script_postinst(deconf, "abort-deconfigure",
-                               "in-favour",
-                               pkgbin_name(infavour, &infavour->available,
-                                           pnaw_nonambig),
-                               versiondescribe(&infavour->available.version,
-                                               vdew_nonambig),
-                               "removing",
-                               pkg_name(conflictor, pnaw_nonambig),
-                               versiondescribe(&conflictor->installed.version,
-                                               vdew_nonambig),
-                               NULL);
+    maintscript_postinst(deconf, "abort-deconfigure",
+                         "in-favour",
+                         pkgbin_name(infavour, &infavour->available,
+                                     pnaw_nonambig),
+                         versiondescribe(&infavour->available.version,
+                                         vdew_nonambig),
+                         "removing",
+                         pkg_name(conflictor, pnaw_nonambig),
+                         versiondescribe(&conflictor->installed.version,
+                                         vdew_nonambig),
+                         NULL);
   } else {
-    maintainer_script_postinst(deconf, "abort-deconfigure",
-                               "in-favour",
-                               pkgbin_name(infavour, &infavour->available,
-                                           pnaw_nonambig),
-                               versiondescribe(&infavour->available.version,
-                                               vdew_nonambig),
-                               NULL);
+    maintscript_postinst(deconf, "abort-deconfigure",
+                         "in-favour",
+                         pkgbin_name(infavour, &infavour->available,
+                                     pnaw_nonambig),
+                         versiondescribe(&infavour->available.version,
+                                         vdew_nonambig),
+                         NULL);
   }
 
   post_postinst_tasks(deconf, stat_installed);
@@ -173,13 +172,13 @@ void cu_prerminfavour(int argc, void **argv) {
   struct pkginfo *infavour= (struct pkginfo*)argv[1];
 
   if (cleanup_conflictor_failed++) return;
-  maintainer_script_postinst(conflictor, "abort-remove",
-                             "in-favour",
-                             pkgbin_name(infavour, &infavour->available,
-                                         pnaw_nonambig),
-                             versiondescribe(&infavour->available.version,
-                                             vdew_nonambig),
-                             NULL);
+  maintscript_postinst(conflictor, "abort-remove",
+                       "in-favour",
+                       pkgbin_name(infavour, &infavour->available,
+                                   pnaw_nonambig),
+                       versiondescribe(&infavour->available.version,
+                                       vdew_nonambig),
+                       NULL);
   pkg_clear_eflags(conflictor, eflag_reinstreq);
   post_postinst_tasks(conflictor, stat_installed);
   cleanup_conflictor_failed--;
@@ -191,8 +190,8 @@ void cu_preinstverynew(int argc, void **argv) {
   char *cidirrest= (char*)argv[2];
 
   if (cleanup_pkg_failed++) return;
-  maintainer_script_new(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
-                        "abort-install", NULL);
+  maintscript_new(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
+                  "abort-install", NULL);
   pkg_set_status(pkg, stat_notinstalled);
   pkg_clear_eflags(pkg, eflag_reinstreq);
   pkgbin_blank(&pkg->installed);
@@ -206,10 +205,10 @@ void cu_preinstnew(int argc, void **argv) {
   char *cidirrest= (char*)argv[2];
 
   if (cleanup_pkg_failed++) return;
-  maintainer_script_new(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
-                        "abort-install", versiondescribe(&pkg->installed.version,
-                                                         vdew_nonambig),
-                        NULL);
+  maintscript_new(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
+                  "abort-install",
+                  versiondescribe(&pkg->installed.version, vdew_nonambig),
+                  NULL);
   pkg_set_status(pkg, stat_configfiles);
   pkg_clear_eflags(pkg, eflag_reinstreq);
   modstatdb_note(pkg);
@@ -223,11 +222,10 @@ void cu_preinstupgrade(int argc, void **argv) {
   enum pkgstatus *oldstatusp= (enum pkgstatus*)argv[3];
 
   if (cleanup_pkg_failed++) return;
-  maintainer_script_new(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
-                        "abort-upgrade",
-                        versiondescribe(&pkg->installed.version,
-                                        vdew_nonambig),
-                        NULL);
+  maintscript_new(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
+                  "abort-upgrade",
+                  versiondescribe(&pkg->installed.version, vdew_nonambig),
+                  NULL);
   pkg_set_status(pkg, *oldstatusp);
   pkg_clear_eflags(pkg, eflag_reinstreq);
   modstatdb_note(pkg);
@@ -238,10 +236,10 @@ void cu_postrmupgrade(int argc, void **argv) {
   struct pkginfo *pkg= (struct pkginfo*)argv[0];
 
   if (cleanup_pkg_failed++) return;
-  maintainer_script_installed(pkg,PREINSTFILE,"pre-installation",
-                              "abort-upgrade", versiondescribe(&pkg->available.version,
-                                                               vdew_nonambig),
-                              NULL);
+  maintscript_installed(pkg, PREINSTFILE, "pre-installation",
+                        "abort-upgrade",
+                        versiondescribe(&pkg->available.version, vdew_nonambig),
+                        NULL);
   cleanup_pkg_failed--;
 }
 
@@ -250,7 +248,7 @@ void cu_prermremove(int argc, void **argv) {
   enum pkgstatus *oldpkgstatus= (enum pkgstatus*)argv[1];
 
   if (cleanup_pkg_failed++) return;
-  maintainer_script_postinst(pkg, "abort-remove", NULL);
+  maintscript_postinst(pkg, "abort-remove", NULL);
   pkg_clear_eflags(pkg, eflag_reinstreq);
   post_postinst_tasks(pkg, *oldpkgstatus);
   cleanup_pkg_failed--;

+ 5 - 5
src/configure.c

@@ -451,11 +451,11 @@ deferred_configure(struct pkginfo *pkg)
 
 	modstatdb_note(pkg);
 
-	maintainer_script_postinst(pkg, "configure",
-	                           dpkg_version_is_informative(&pkg->configversion) ?
-	                           versiondescribe(&pkg->configversion,
-	                                           vdew_nonambig) : "",
-	                           NULL);
+	maintscript_postinst(pkg, "configure",
+	                     dpkg_version_is_informative(&pkg->configversion) ?
+	                     versiondescribe(&pkg->configversion,
+	                                     vdew_nonambig) : "",
+	                     NULL);
 
 	pkg_reset_eflags(pkg);
 	pkg->trigpend_head = NULL;

+ 11 - 11
src/main.h

@@ -227,21 +227,21 @@ void checkpath(void);
 struct filenamenode *namenodetouse(struct filenamenode *namenode,
                                    struct pkginfo *pkg, struct pkgbin *pkgbin);
 
-int maintainer_script_installed(struct pkginfo *pkg, const char *scriptname,
-                                const char *desc, ...) DPKG_ATTR_SENTINEL;
-int maintainer_script_new(struct pkginfo *pkg,
-                          const char *scriptname, const char *desc,
-                          const char *cidir, char *cidirrest, ...)
-                          DPKG_ATTR_SENTINEL;
-int maintainer_script_alternative(struct pkginfo *pkg,
-                                  const char *scriptname, const char *desc,
-                                  const char *cidir, char *cidirrest,
-                                  const char *ifok, const char *iffallback);
+int maintscript_installed(struct pkginfo *pkg, const char *scriptname,
+                          const char *desc, ...) DPKG_ATTR_SENTINEL;
+int maintscript_new(struct pkginfo *pkg,
+                    const char *scriptname, const char *desc,
+                    const char *cidir, char *cidirrest, ...)
+	DPKG_ATTR_SENTINEL;
+int maintscript_fallback(struct pkginfo *pkg,
+                         const char *scriptname, const char *desc,
+                         const char *cidir, char *cidirrest,
+                         const char *ifok, const char *iffallback);
 
 /* Callers wanting to run the postinst use these two as they want to postpone
  * trigger incorporation until after updating the package status. The effect
  * is that a package can trigger itself. */
-int maintainer_script_postinst(struct pkginfo *pkg, ...) DPKG_ATTR_SENTINEL;
+int maintscript_postinst(struct pkginfo *pkg, ...) DPKG_ATTR_SENTINEL;
 void post_postinst_tasks_core(struct pkginfo *pkg);
 
 void post_postinst_tasks(struct pkginfo *pkg, enum pkgstatus new_status);

+ 3 - 6
src/remove.c

@@ -183,8 +183,7 @@ void deferred_remove(struct pkginfo *pkg) {
     modstatdb_note(pkg);
     push_cleanup(cu_prermremove, ~ehflag_normaltidy, NULL, 0, 2,
                  (void *)pkg, (void *)&oldpkgstatus);
-    maintainer_script_installed(pkg, PRERMFILE, "pre-removal",
-                                "remove", NULL);
+    maintscript_installed(pkg, PRERMFILE, "pre-removal", "remove", NULL);
 
     /* Will turn into ‘half-installed’ soon ... */
     pkg_set_status(pkg, stat_unpacked);
@@ -350,8 +349,7 @@ removal_bulk_remove_files(struct pkginfo *pkg)
         ohshite(_("unable to securely remove '%.250s'"), fnvb.buf);
     }
     write_filelist_except(pkg, &pkg->installed, leftover, 0);
-    maintainer_script_installed(pkg, POSTRMFILE, "post-removal",
-                                "remove", NULL);
+    maintscript_installed(pkg, POSTRMFILE, "post-removal", "remove", NULL);
 
     trig_parse_ci(pkg_infodb_get_file(pkg, &pkg->installed, TRIGGERSCIFILE),
                   trig_cicb_interest_delete, NULL, pkg, &pkg->installed);
@@ -587,8 +585,7 @@ static void removal_bulk_remove_configfiles(struct pkginfo *pkg) {
     pkg->installed.conffiles = NULL;
     modstatdb_note(pkg);
 
-    maintainer_script_installed(pkg, POSTRMFILE, "post-removal",
-                                "purge", NULL);
+    maintscript_installed(pkg, POSTRMFILE, "post-removal", "purge", NULL);
 }
 
 /*

+ 25 - 27
src/script.c

@@ -105,7 +105,7 @@ setexecute(const char *path, struct stat *stab)
  * Returns the path to the script inside the chroot.
  */
 static const char *
-preexecscript(struct command *cmd)
+maintscript_pre_exec(struct command *cmd)
 {
 	const char *admindir = dpkg_db_get_dir();
 	size_t instdirl = strlen(instdir);
@@ -203,8 +203,8 @@ out:
 }
 
 static int
-do_script(struct pkginfo *pkg, struct pkgbin *pkgbin,
-          struct command *cmd, struct stat *stab, int warn)
+maintscript_exec(struct pkginfo *pkg, struct pkgbin *pkgbin,
+                 struct command *cmd, struct stat *stab, int warn)
 {
 	pid_t pid;
 	int r;
@@ -226,7 +226,7 @@ do_script(struct pkginfo *pkg, struct pkgbin *pkgbin,
 		    setenv("DPKG_RUNNING_VERSION", PACKAGE_VERSION, 1))
 			ohshite(_("unable to setenv for maintainer script"));
 
-		cmd->filename = cmd->argv[0] = preexecscript(cmd);
+		cmd->filename = cmd->argv[0] = maintscript_pre_exec(cmd);
 
 		if (maintscript_set_exec_context(cmd, "dpkg_script_t") < 0)
 			ohshite(_("cannot set security execution context for "
@@ -244,8 +244,8 @@ do_script(struct pkginfo *pkg, struct pkgbin *pkgbin,
 }
 
 static int
-vmaintainer_script_installed(struct pkginfo *pkg, const char *scriptname,
-                             const char *desc, va_list args)
+vmaintscript_installed(struct pkginfo *pkg, const char *scriptname,
+                       const char *desc, va_list args)
 {
 	struct command cmd;
 	const char *scriptpath;
@@ -263,13 +263,13 @@ vmaintainer_script_installed(struct pkginfo *pkg, const char *scriptname,
 		command_destroy(&cmd);
 		if (errno == ENOENT) {
 			debug(dbg_scripts,
-			      "vmaintainer_script_installed nonexistent %s",
+			      "vmaintscript_installed nonexistent %s",
 			      scriptname);
 			return 0;
 		}
 		ohshite(_("unable to stat %s `%.250s'"), buf, scriptpath);
 	}
-	do_script(pkg, &pkg->installed, &cmd, &stab, 0);
+	maintscript_exec(pkg, &pkg->installed, &cmd, &stab, 0);
 
 	command_destroy(&cmd);
 
@@ -277,18 +277,18 @@ vmaintainer_script_installed(struct pkginfo *pkg, const char *scriptname,
 }
 
 /*
- * All ...'s in maintainer_script_* are const char *'s.
+ * All ...'s in maintscript_* are const char *'s.
  */
 
 int
-maintainer_script_installed(struct pkginfo *pkg, const char *scriptname,
-                            const char *desc, ...)
+maintscript_installed(struct pkginfo *pkg, const char *scriptname,
+                      const char *desc, ...)
 {
 	va_list args;
 	int r;
 
 	va_start(args, desc);
-	r = vmaintainer_script_installed(pkg, scriptname, desc, args);
+	r = vmaintscript_installed(pkg, scriptname, desc, args);
 	va_end(args);
 
 	if (r)
@@ -298,14 +298,13 @@ maintainer_script_installed(struct pkginfo *pkg, const char *scriptname,
 }
 
 int
-maintainer_script_postinst(struct pkginfo *pkg, ...)
+maintscript_postinst(struct pkginfo *pkg, ...)
 {
 	va_list args;
 	int r;
 
 	va_start(args, pkg);
-	r = vmaintainer_script_installed(pkg, POSTINSTFILE, "post-installation",
-	                                 args);
+	r = vmaintscript_installed(pkg, POSTINSTFILE, "post-installation", args);
 	va_end(args);
 
 	if (r)
@@ -315,9 +314,8 @@ maintainer_script_postinst(struct pkginfo *pkg, ...)
 }
 
 int
-maintainer_script_new(struct pkginfo *pkg,
-                      const char *scriptname, const char *desc,
-                      const char *cidir, char *cidirrest, ...)
+maintscript_new(struct pkginfo *pkg, const char *scriptname,
+                const char *desc, const char *cidir, char *cidirrest, ...)
 {
 	struct command cmd;
 	struct stat stab;
@@ -337,13 +335,13 @@ maintainer_script_new(struct pkginfo *pkg,
 		command_destroy(&cmd);
 		if (errno == ENOENT) {
 			debug(dbg_scripts,
-			      "maintainer_script_new nonexistent %s '%s'",
+			      "maintscript_new nonexistent %s '%s'",
 			      scriptname, cidir);
 			return 0;
 		}
 		ohshite(_("unable to stat %s `%.250s'"), buf, cidir);
 	}
-	do_script(pkg, &pkg->available, &cmd, &stab, 0);
+	maintscript_exec(pkg, &pkg->available, &cmd, &stab, 0);
 
 	command_destroy(&cmd);
 	post_script_tasks();
@@ -352,10 +350,10 @@ maintainer_script_new(struct pkginfo *pkg,
 }
 
 int
-maintainer_script_alternative(struct pkginfo *pkg,
-                              const char *scriptname, const char *desc,
-                              const char *cidir, char *cidirrest,
-                              const char *ifok, const char *iffallback)
+maintscript_fallback(struct pkginfo *pkg,
+                     const char *scriptname, const char *desc,
+                     const char *cidir, char *cidirrest,
+                     const char *ifok, const char *iffallback)
 {
 	struct command cmd;
 	const char *oldscriptpath;
@@ -373,7 +371,7 @@ maintainer_script_alternative(struct pkginfo *pkg,
 	if (stat(oldscriptpath, &stab)) {
 		if (errno == ENOENT) {
 			debug(dbg_scripts,
-			      "maintainer_script_alternative nonexistent %s '%s'",
+			      "maintscript_fallback nonexistent %s '%s'",
 			      scriptname, oldscriptpath);
 			command_destroy(&cmd);
 			return 0;
@@ -381,7 +379,7 @@ maintainer_script_alternative(struct pkginfo *pkg,
 		warning(_("unable to stat %s '%.250s': %s"),
 		        cmd.name, oldscriptpath, strerror(errno));
 	} else {
-		if (!do_script(pkg, &pkg->installed, &cmd, &stab, PROCWARN)) {
+		if (!maintscript_exec(pkg, &pkg->installed, &cmd, &stab, PROCWARN)) {
 			command_destroy(&cmd);
 			post_script_tasks();
 			return 1;
@@ -406,7 +404,7 @@ maintainer_script_alternative(struct pkginfo *pkg,
 			ohshite(_("unable to stat %s `%.250s'"), buf, cidir);
 	}
 
-	do_script(pkg, &pkg->available, &cmd, &stab, 0);
+	maintscript_exec(pkg, &pkg->available, &cmd, &stab, 0);
 	notice(_("... it looks like that went OK"));
 
 	command_destroy(&cmd);

+ 2 - 2
src/trigproc.c

@@ -352,8 +352,8 @@ trigproc(struct pkginfo *pkg)
 
 		if (!f_noact) {
 			sincenothing = 0;
-			maintainer_script_postinst(pkg, "triggered",
-			                           namesarg.buf + 1, NULL);
+			maintscript_postinst(pkg, "triggered",
+			                     namesarg.buf + 1, NULL);
 		}
 
 		/* This is to cope if the package triggers itself: */

+ 49 - 47
src/unpack.c

@@ -349,14 +349,14 @@ pkg_disappear(struct pkginfo *pkg, struct pkginfo *infavour)
         pkg_name(pkg, pnaw_always));
 
   trig_activate_packageprocessing(pkg);
-  maintainer_script_installed(pkg, POSTRMFILE,
-                              "post-removal script (for disappearance)",
-                              "disappear",
-                              pkgbin_name(infavour, &infavour->available,
-                                          pnaw_nonambig),
-                              versiondescribe(&infavour->available.version,
-                                              vdew_nonambig),
-                              NULL);
+  maintscript_installed(pkg, POSTRMFILE,
+                        "post-removal script (for disappearance)",
+                        "disappear",
+                        pkgbin_name(infavour, &infavour->available,
+                                    pnaw_nonambig),
+                        versiondescribe(&infavour->available.version,
+                                        vdew_nonambig),
+                        NULL);
 
   /* OK, now we delete all the stuff in the ‘info’ directory ... */
   debug(dbg_general, "pkg_disappear cleaning info directory");
@@ -719,12 +719,14 @@ void process_archive(const char *filename) {
     if (dpkg_version_compare(&pkg->available.version,
                              &pkg->installed.version) >= 0)
       /* Upgrade or reinstall. */
-      maintainer_script_alternative(pkg, PRERMFILE, "pre-removal", cidir, cidirrest,
-                                    "upgrade", "failed-upgrade");
+      maintscript_fallback(pkg, PRERMFILE, "pre-removal", cidir, cidirrest,
+                           "upgrade", "failed-upgrade");
     else /* Downgrade => no fallback */
-      maintainer_script_installed(pkg, PRERMFILE, "pre-removal", "upgrade",
-                                  versiondescribe(&pkg->available.version,
-                                                  vdew_nonambig), NULL);
+      maintscript_installed(pkg, PRERMFILE, "pre-removal",
+                            "upgrade",
+                            versiondescribe(&pkg->available.version,
+                                            vdew_nonambig),
+                            NULL);
     pkg_set_status(pkg, stat_unpacked);
     oldversionstatus= stat_unpacked;
     modstatdb_note(pkg);
@@ -756,23 +758,23 @@ void process_archive(const char *filename) {
                  3, (void*)deconpil->pkg, (void*)removing, (void*)pkg);
 
     if (removing) {
-      maintainer_script_installed(deconpil->pkg, PRERMFILE, "pre-removal",
-                                  "deconfigure", "in-favour",
-                                  pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
-                                  versiondescribe(&pkg->available.version,
-                                                  vdew_nonambig),
-                                  "removing",
-                                  pkg_name(removing, pnaw_nonambig),
-                                  versiondescribe(&removing->installed.version,
-                                                  vdew_nonambig),
-                                  NULL);
+      maintscript_installed(deconpil->pkg, PRERMFILE, "pre-removal",
+                            "deconfigure", "in-favour",
+                            pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
+                            versiondescribe(&pkg->available.version,
+                                            vdew_nonambig),
+                            "removing",
+                            pkg_name(removing, pnaw_nonambig),
+                            versiondescribe(&removing->installed.version,
+                                            vdew_nonambig),
+                            NULL);
     } else {
-      maintainer_script_installed(deconpil->pkg, PRERMFILE, "pre-removal",
-                                  "deconfigure", "in-favour",
-                                  pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
-                                  versiondescribe(&pkg->available.version,
-                                                  vdew_nonambig),
-                                  NULL);
+      maintscript_installed(deconpil->pkg, PRERMFILE, "pre-removal",
+                            "deconfigure", "in-favour",
+                            pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
+                            versiondescribe(&pkg->available.version,
+                                            vdew_nonambig),
+                            NULL);
     }
   }
 
@@ -786,12 +788,12 @@ void process_archive(const char *filename) {
     modstatdb_note(conflictor[i]);
     push_cleanup(cu_prerminfavour, ~ehflag_normaltidy, NULL, 0,
                  2,(void*)conflictor[i],(void*)pkg);
-    maintainer_script_installed(conflictor[i], PRERMFILE, "pre-removal",
-                                "remove", "in-favour",
-                                pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
-                                versiondescribe(&pkg->available.version,
-                                                vdew_nonambig),
-                                NULL);
+    maintscript_installed(conflictor[i], PRERMFILE, "pre-removal",
+                          "remove", "in-favour",
+                          pkgbin_name(pkg, &pkg->available, pnaw_nonambig),
+                          versiondescribe(&pkg->available.version,
+                                          vdew_nonambig),
+                          NULL);
     pkg_set_status(conflictor[i], stat_halfinstalled);
     modstatdb_note(conflictor[i]);
   }
@@ -806,22 +808,22 @@ void process_archive(const char *filename) {
   if (oldversionstatus == stat_notinstalled) {
     push_cleanup(cu_preinstverynew, ~ehflag_normaltidy, NULL, 0,
                  3,(void*)pkg,(void*)cidir,(void*)cidirrest);
-    maintainer_script_new(pkg, PREINSTFILE, "pre-installation", cidir, cidirrest,
-                          "install", NULL);
+    maintscript_new(pkg, PREINSTFILE, "pre-installation", cidir, cidirrest,
+                    "install", NULL);
   } else if (oldversionstatus == stat_configfiles) {
     push_cleanup(cu_preinstnew, ~ehflag_normaltidy, NULL, 0,
                  3,(void*)pkg,(void*)cidir,(void*)cidirrest);
-    maintainer_script_new(pkg, PREINSTFILE, "pre-installation", cidir, cidirrest,
-                          "install", versiondescribe(&pkg->installed.version,
-                                                     vdew_nonambig),
-                          NULL);
+    maintscript_new(pkg, PREINSTFILE, "pre-installation", cidir, cidirrest,
+                    "install",
+                    versiondescribe(&pkg->installed.version, vdew_nonambig),
+                    NULL);
   } else {
     push_cleanup(cu_preinstupgrade, ~ehflag_normaltidy, NULL, 0,
                  4,(void*)pkg,(void*)cidir,(void*)cidirrest,(void*)&oldversionstatus);
-    maintainer_script_new(pkg, PREINSTFILE, "pre-installation", cidir, cidirrest,
-                          "upgrade", versiondescribe(&pkg->installed.version,
-                                                     vdew_nonambig),
-                          NULL);
+    maintscript_new(pkg, PREINSTFILE, "pre-installation", cidir, cidirrest,
+                    "upgrade",
+                    versiondescribe(&pkg->installed.version, vdew_nonambig),
+                    NULL);
   }
 
   if (oldversionstatus == stat_notinstalled ||
@@ -952,8 +954,8 @@ void process_archive(const char *filename) {
     pkg_set_status(pkg, stat_halfinstalled);
     modstatdb_note(pkg);
     push_cleanup(cu_postrmupgrade, ~ehflag_normaltidy, NULL, 0, 1, (void *)pkg);
-    maintainer_script_alternative(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
-                                  "upgrade", "failed-upgrade");
+    maintscript_fallback(pkg, POSTRMFILE, "post-removal", cidir, cidirrest,
+                         "upgrade", "failed-upgrade");
   }
 
   /* If anything goes wrong while tidying up it's a bit late to do