f21008eec6d76f8dfc6864849dc05edef722c1f1
[15.05/openwrt.git] / package / system / opkg / patches / 110-upgrade.patch
1 Index: opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d/libopkg/opkg_install.c
2 ===================================================================
3 --- opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d.orig/libopkg/opkg_install.c   2014-09-07 22:06:37.875956909 +0200
4 +++ opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d/libopkg/opkg_install.c        2014-09-07 22:10:30.579952951 +0200
5 @@ -1463,10 +1463,11 @@
6                 /* removing files from old package, to avoid ghost files */
7                 remove_data_files_and_list(old_pkg);
8                 remove_maintainer_scripts(old_pkg);
9 +              pkg->is_upgrade = 1;
10           }
11  
12  
13 -         opkg_msg(INFO, "Installing maintainer scripts.\n");
14 +         opkg_msg(INFO, "%s maintainer scripts.\n", (pkg->is_upgrade) ? ("Upgrading") : ("Installing"));
15           if (install_maintainer_scripts(pkg, old_pkg)) {
16                 opkg_msg(ERROR, "Failed to extract maintainer scripts for %s."
17                                " Package debris may remain!\n",
18 Index: opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d/libopkg/pkg.c
19 ===================================================================
20 --- opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d.orig/libopkg/pkg.c    2014-09-07 22:06:37.863956909 +0200
21 +++ opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d/libopkg/pkg.c 2014-09-07 22:09:09.387954332 +0200
22 @@ -1285,6 +1285,12 @@
23       setenv("PKG_ROOT",
24             pkg->dest ? pkg->dest->root_dir : conf->default_dest->root_dir, 1);
25  
26 +       if (pkg->is_upgrade)
27 +               setenv("PKG_UPGRADE", "1", 1);
28 +       else
29 +               setenv("PKG_UPGRADE", "0", 1);
30 +
31 +
32       if (! file_exists(path)) {
33           free(path);
34           return 0;
35 Index: opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d/libopkg/pkg.h
36 ===================================================================
37 --- opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d.orig/libopkg/pkg.h    2014-03-21 16:56:11.000000000 +0100
38 +++ opkg-9c97d5ecd795709c8584e972bfdf3aee3a5b846d/libopkg/pkg.h 2014-09-07 22:09:26.315954044 +0200
39 @@ -184,6 +184,7 @@
40       /* this flag specifies whether the package was installed to satisfy another
41        * package's dependancies */
42       int auto_installed;
43 +     int is_upgrade;
44  };
45  
46  pkg_t *pkg_new(void);