Пример #1
0
/*
 * conflictor may be NULL.
 */
void cu_prermdeconfigure(int argc, void **argv) {
  struct pkginfo *deconf= (struct pkginfo*)argv[0];
  struct pkginfo *conflictor = (struct pkginfo *)argv[1];
  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);
  } else {
    maintainer_script_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);
}
Пример #2
0
void cu_prermremove(int argc, void **argv) {
  struct pkginfo *pkg= (struct pkginfo*)argv[0];
  enum pkgstatus *oldpkgstatus= (enum pkgstatus*)argv[1];

  if (cleanup_pkg_failed++) return;
  maintainer_script_postinst(pkg, "abort-remove", NULL);
  pkg_clear_eflags(pkg, eflag_reinstreq);
  post_postinst_tasks(pkg, *oldpkgstatus);
  cleanup_pkg_failed--;
}
Пример #3
0
/*
 * Does cycle checking. Doesn't mind if pkg has no triggers pending - in
 * that case does nothing but fix up any stale awaiters.
 */
void
trigproc(struct pkginfo *pkg)
{
	static struct varbuf namesarg;

	struct trigpend *tp;
	struct pkginfo *gaveup;

	debug(dbg_triggers, "trigproc %s", pkg_describe(pkg, pdo_foreign));

	if (pkg->clientdata->trigprocdeferred)
		pkg->clientdata->trigprocdeferred->pkg = NULL;
	pkg->clientdata->trigprocdeferred = NULL;

	if (pkg->trigpend_head) {
		assert(pkg->status == stat_triggerspending ||
		       pkg->status == stat_triggersawaited);

		gaveup = check_trigger_cycle(pkg);
		if (gaveup == pkg)
			return;

		printf(_("Processing triggers for %s ...\n"),
		       pkg_describe(pkg, pdo_foreign));
		log_action("trigproc", pkg);

		varbuf_reset(&namesarg);
		for (tp = pkg->trigpend_head; tp; tp = tp->next) {
			varbuf_add_char(&namesarg, ' ');
			varbuf_add_str(&namesarg, tp->name);
		}
		varbuf_end_str(&namesarg);

		/* Setting the status to half-configured
		 * causes modstatdb_note to clear pending triggers. */
		pkg->status = stat_halfconfigured;
		modstatdb_note(pkg);

		if (!f_noact) {
			sincenothing = 0;
			maintainer_script_postinst(pkg, "triggered",
			                           namesarg.buf + 1, NULL);
		}

		/* This is to cope if the package triggers itself: */
		pkg->status = pkg->trigaw.head ? stat_triggersawaited :
		              pkg->trigpend_head ? stat_triggerspending :
		              stat_installed;

		post_postinst_tasks_core(pkg);
	} else {
		/* In other branch is done by modstatdb_note. */
		trig_clear_awaiters(pkg);
	}
}
Пример #4
0
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);
  pkg_clear_eflags(pkg, eflag_reinstreq);
  post_postinst_tasks(pkg, stat_installed);
  cleanup_pkg_failed--;
}
Пример #5
0
void cu_prerminfavour(int argc, void **argv) {
  struct pkginfo *conflictor= (struct pkginfo*)argv[0];
  struct pkginfo *infavour= (struct pkginfo*)argv[1];

  if (cleanup_conflictor_failed++) return;
  maintainer_script_postinst(conflictor, "abort-remove",
                             "in-favour", infavour->set->name,
                             versiondescribe(&infavour->available.version,
                                             vdew_nonambig),
                             NULL);
  pkg_clear_eflags(conflictor, eflag_reinstreq);
  post_postinst_tasks(conflictor, stat_installed);
  cleanup_conflictor_failed--;
}