aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2014-09-11 12:27:09 +0000
committerJohn Crispin <blogic@openwrt.org>2014-09-11 12:27:09 +0000
commite548b195e1aa751ac026b27f0dcd465f63c98a9a (patch)
treed66caea7bcde96348b60e0fd362cfd53fdbec7bd
parentc83554e93c4099560fc416a944e6486c95f66962 (diff)
downloadmaster-187ad058-e548b195e1aa751ac026b27f0dcd465f63c98a9a.tar.gz
master-187ad058-e548b195e1aa751ac026b27f0dcd465f63c98a9a.tar.bz2
master-187ad058-e548b195e1aa751ac026b27f0dcd465f63c98a9a.zip
opkg: indicate upgrade vs install
when running the postinst trigger we set PKG_UPGRADE=1 if this is an upgrade and not an install. Signed-off-by: John Crispin <blogic@openwrt.org> git-svn-id: svn://svn.openwrt.org/openwrt/trunk@42468 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/system/opkg/patches/110-upgrade.patch46
1 files changed, 46 insertions, 0 deletions
diff --git a/package/system/opkg/patches/110-upgrade.patch b/package/system/opkg/patches/110-upgrade.patch
new file mode 100644
index 0000000000..b8206f055b
--- /dev/null
+++ b/package/system/opkg/patches/110-upgrade.patch
@@ -0,0 +1,46 @@
+Index: opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d/libopkg/opkg_install.c
+===================================================================
+--- opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d.orig/libopkg/opkg_install.c 2014-09-07 22:06:37.875956909 +0200
++++ opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d/libopkg/opkg_install.c 2014-09-07 22:10:30.579952951 +0200
+@@ -1463,10 +1463,11 @@
+ /* removing files from old package, to avoid ghost files */
+ remove_data_files_and_list(old_pkg);
+ remove_maintainer_scripts(old_pkg);
++ pkg->is_upgrade = 1;
+ }
+
+
+- opkg_msg(INFO, "Installing maintainer scripts.\n");
++ opkg_msg(INFO, "%s maintainer scripts.\n", (pkg->is_upgrade) ? ("Upgrading") : ("Installing"));
+ if (install_maintainer_scripts(pkg, old_pkg)) {
+ opkg_msg(ERROR, "Failed to extract maintainer scripts for %s."
+ " Package debris may remain!\n",
+Index: opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d/libopkg/pkg.c
+===================================================================
+--- opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d.orig/libopkg/pkg.c 2014-09-07 22:06:37.863956909 +0200
++++ opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d/libopkg/pkg.c 2014-09-07 22:09:09.387954332 +0200
+@@ -1285,6 +1285,12 @@
+ setenv("PKG_ROOT",
+ pkg->dest ? pkg->dest->root_dir : conf->default_dest->root_dir, 1);
+
++ if (pkg->is_upgrade)
++ setenv("PKG_UPGRADE", "1", 0);
++ else
++ setenv("PKG_UPGRADE", "0", 0);
++
++
+ if (! file_exists(path)) {
+ free(path);
+ return 0;
+Index: opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d/libopkg/pkg.h
+===================================================================
+--- opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d.orig/libopkg/pkg.h 2014-03-21 16:56:11.000000000 +0100
++++ opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d/libopkg/pkg.h 2014-09-07 22:09:26.315954044 +0200
+@@ -184,6 +184,7 @@
+ /* this flag specifies whether the package was installed to satisfy another
+ * package's dependancies */
+ int auto_installed;
++ int is_upgrade;
+ };
+
+ pkg_t *pkg_new(void);