0019-base-files-default_postinst-propagate-the-real-postinst-return-code.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From: Matthias Schiffer <mschiffer@universe-factory.net>
  2. Date: Fri, 7 Aug 2015 18:45:42 +0200
  3. Subject: base-files: default_postinst: propagate the real postinst return code
  4. Using the postinst script for sanity checks and expecting opkg to fail
  5. if the postinst didn't return 0 was possible in Barrier Breaker, propagate
  6. the real postinst return code through default_postinst to restore this
  7. behaviour.
  8. diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
  9. index 8d045fa..2f78d67 100755
  10. --- a/package/base-files/files/lib/functions.sh
  11. +++ b/package/base-files/files/lib/functions.sh
  12. @@ -174,7 +174,8 @@ default_prerm() {
  13. }
  14. default_postinst() {
  15. - local pkgname rusers
  16. + local pkgname rusers ret
  17. + ret=0
  18. pkgname=$(basename ${1%.*})
  19. rusers=$(grep "Require-User:" ${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.control)
  20. [ -n "$rusers" ] && {
  21. @@ -215,7 +216,10 @@ default_postinst() {
  22. done
  23. }
  24. - [ -f ${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.postinst-pkg ] && ( . ${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.postinst-pkg )
  25. + if [ -f ${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.postinst-pkg ]; then
  26. + ( . ${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.postinst-pkg )
  27. + ret=$?
  28. + fi
  29. [ -n "${IPKG_INSTROOT}" ] || rm -f /tmp/luci-indexcache 2>/dev/null
  30. [ "$PKG_UPGRADE" = "1" ] || for i in `cat ${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.list | grep "^/etc/init.d/"`; do
  31. @@ -225,7 +229,7 @@ default_postinst() {
  32. $i start
  33. }
  34. done
  35. - return 0
  36. + return $ret
  37. }
  38. include() {