1
0

110-upgrade.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. --- a/libopkg/opkg_install.c
  2. +++ b/libopkg/opkg_install.c
  3. @@ -1405,9 +1405,11 @@ opkg_install_pkg(pkg_t *pkg, int from_up
  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. + old_pkg->is_upgrade = 1;
  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 +1468,7 @@ opkg_install_pkg(pkg_t *pkg, int from_up
  17. }
  18. - opkg_msg(INFO, "Installing maintainer scripts.\n");
  19. + opkg_msg(INFO, "%s maintainer scripts.\n", (pkg->is_upgrade) ? ("Upgrading") : ("Installing"));
  20. if (install_maintainer_scripts(pkg, old_pkg)) {
  21. opkg_msg(ERROR, "Failed to extract maintainer scripts for %s."
  22. " Package debris may remain!\n",
  23. --- a/libopkg/pkg.c
  24. +++ b/libopkg/pkg.c
  25. @@ -1285,6 +1285,12 @@ pkg_run_script(pkg_t *pkg, const char *s
  26. setenv("PKG_ROOT",
  27. pkg->dest ? pkg->dest->root_dir : conf->default_dest->root_dir, 1);
  28. + if (pkg->is_upgrade)
  29. + setenv("PKG_UPGRADE", "1", 1);
  30. + else
  31. + setenv("PKG_UPGRADE", "0", 1);
  32. +
  33. +
  34. if (! file_exists(path)) {
  35. free(path);
  36. return 0;
  37. --- a/libopkg/pkg.h
  38. +++ b/libopkg/pkg.h
  39. @@ -184,6 +184,7 @@ struct pkg
  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. pkg_t *pkg_new(void);