110-upgrade.patch 1.3 KB

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