rpcd: iwinfo plugin fixes
[openwrt.git] / package / system / opkg / patches / 110-upgrade.patch
1 --- a/libopkg/opkg_install.c
2 +++ b/libopkg/opkg_install.c
3 @@ -1405,9 +1405,10 @@
4           opkg_state_changed++;
5           pkg->state_flag |= SF_FILELIST_CHANGED;
6  
7 -         if (old_pkg)
8 +         if (old_pkg) {
9                 pkg_remove_orphan_dependent(pkg, old_pkg);
10 -
11 +              pkg->is_upgrade = 1;
12 +         }
13           /* XXX: BUG: we really should treat replacement more like an upgrade
14            *      Instead, we're going to remove the replacees
15            */
16 @@ -1466,7 +1467,7 @@
17           }
18  
19  
20 -         opkg_msg(INFO, "Installing maintainer scripts.\n");
21 +         opkg_msg(INFO, "%s maintainer scripts.\n", (pkg->is_upgrade) ? ("Upgrading") : ("Installing"));
22           if (install_maintainer_scripts(pkg, old_pkg)) {
23                 opkg_msg(ERROR, "Failed to extract maintainer scripts for %s."
24                                " Package debris may remain!\n",
25 --- a/libopkg/pkg.c
26 +++ b/libopkg/pkg.c
27 @@ -1285,6 +1285,12 @@
28       setenv("PKG_ROOT",
29             pkg->dest ? pkg->dest->root_dir : conf->default_dest->root_dir, 1);
30  
31 +       if (pkg->is_upgrade)
32 +               setenv("PKG_UPGRADE", "1", 1);
33 +       else
34 +               setenv("PKG_UPGRADE", "0", 1);
35 +
36 +
37       if (! file_exists(path)) {
38           free(path);
39           return 0;
40 --- a/libopkg/pkg.h
41 +++ b/libopkg/pkg.h
42 @@ -184,6 +184,7 @@
43       /* this flag specifies whether the package was installed to satisfy another
44        * package's dependancies */
45       int auto_installed;
46 +     int is_upgrade;
47  };
48  
49  pkg_t *pkg_new(void);