1 --- a/libopkg/opkg_install.c
2 +++ b/libopkg/opkg_install.c
3 @@ -1405,9 +1405,11 @@ opkg_install_pkg(pkg_t *pkg, int from_up
5 pkg->state_flag |= SF_FILELIST_CHANGED;
9 pkg_remove_orphan_dependent(pkg, old_pkg);
11 + old_pkg->is_upgrade = 1;
12 + pkg->is_upgrade = 1;
14 /* XXX: BUG: we really should treat replacement more like an upgrade
15 * Instead, we're going to remove the replacees
17 @@ -1466,7 +1468,7 @@ opkg_install_pkg(pkg_t *pkg, int from_up
21 - opkg_msg(INFO, "Installing maintainer scripts.\n");
22 + opkg_msg(INFO, "%s maintainer scripts.\n", (pkg->is_upgrade) ? ("Upgrading") : ("Installing"));
23 if (install_maintainer_scripts(pkg, old_pkg)) {
24 opkg_msg(ERROR, "Failed to extract maintainer scripts for %s."
25 " Package debris may remain!\n",
28 @@ -1285,6 +1285,12 @@ pkg_run_script(pkg_t *pkg, const char *s
30 pkg->dest ? pkg->dest->root_dir : conf->default_dest->root_dir, 1);
32 + if (pkg->is_upgrade)
33 + setenv("PKG_UPGRADE", "1", 1);
35 + setenv("PKG_UPGRADE", "0", 1);
38 if (! file_exists(path)) {
43 @@ -184,6 +184,7 @@ struct pkg
44 /* this flag specifies whether the package was installed to satisfy another
45 * package's dependancies */