1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
--- a/libopkg/opkg_install.c
+++ b/libopkg/opkg_install.c
@@ -1405,9 +1405,10 @@
opkg_state_changed++;
pkg->state_flag |= SF_FILELIST_CHANGED;
- if (old_pkg)
+ if (old_pkg) {
pkg_remove_orphan_dependent(pkg, old_pkg);
-
+ pkg->is_upgrade = 1;
+ }
/* XXX: BUG: we really should treat replacement more like an upgrade
* Instead, we're going to remove the replacees
*/
@@ -1466,7 +1467,7 @@
}
- 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",
--- a/libopkg/pkg.c
+++ b/libopkg/pkg.c
@@ -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", 1);
+ else
+ setenv("PKG_UPGRADE", "0", 1);
+
+
if (! file_exists(path)) {
free(path);
return 0;
--- a/libopkg/pkg.h
+++ b/libopkg/pkg.h
@@ -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);
|