Author: blogic
Date: 2015-08-17 08:17:23 +0200 (Mon, 17 Aug 2015)
New Revision: 46653

Modified:
   trunk/package/base-files/files/lib/functions.sh
Log:
base-files: default_postinst: propagate the real postinst return code

Using the postinst script for sanity checks and expecting opkg to fail
if the postinst didn't return 0 was possible in Barrier Breaker, propagate
the real postinst return code through default_postinst to restore this
behaviour.

Signed-off-by: Matthias Schiffer <[email protected]>

Modified: trunk/package/base-files/files/lib/functions.sh
===================================================================
--- trunk/package/base-files/files/lib/functions.sh     2015-08-17 06:17:13 UTC 
(rev 46652)
+++ trunk/package/base-files/files/lib/functions.sh     2015-08-17 06:17:23 UTC 
(rev 46653)
@@ -174,7 +174,8 @@
 }
 
 default_postinst() {
-       local pkgname rusers
+       local pkgname rusers ret
+       ret=0
        pkgname=$(basename ${1%.*})
        rusers=$(grep "Require-User:" 
${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.control)
        [ -n "$rusers" ] && {
@@ -215,7 +216,10 @@
                done
        }
 
-       [ -f ${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.postinst-pkg ] && ( 
. ${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.postinst-pkg )
+       if [ -f ${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.postinst-pkg ]; 
then
+               ( . ${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.postinst-pkg )
+               ret=$?
+       fi
        [ -n "${IPKG_INSTROOT}" ] || rm -f /tmp/luci-indexcache 2>/dev/null
 
        [ "$PKG_UPGRADE" = "1" ] || for i in `cat 
${IPKG_INSTROOT}/usr/lib/opkg/info/${pkgname}.list | grep "^/etc/init.d/"`; do
@@ -225,7 +229,7 @@
                        $i start
                }
        done
-       return 0
+       return $ret
 }
 
 include() {
_______________________________________________
openwrt-commits mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-commits

Reply via email to