[OpenWrt-Devel] [PATCH][base-files] functions.sh: default_postinst() - create user:group first (resend)

Jonas Gorski jogo at openwrt.org
Mon Dec 1 08:43:40 EST 2014


Hi,

On Sun, Nov 30, 2014 at 8:13 PM, Christian Schoenebeck
<christian.schoenebeck at gmail.com> wrote:
> create user:group before running postinst-pkg

Why is creating user:group before running postinst-pkg important? Does
it fix anything, is this a performance fix, or is it just cosmetical?

>
> Signed-off-by: Christian Schoenebeck <christian.schoenebeck at gmail.com>
>
> ---
>  package/base-files/Makefile               | 2 +-
>  package/base-files/files/lib/functions.sh | 6 ++++--
>  2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/package/base-files/Makefile b/package/base-files/Makefile
> index aeba973..3c453b5 100644
> --- a/package/base-files/Makefile
> +++ b/package/base-files/Makefile
> @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/version.mk
>  include $(INCLUDE_DIR)/kernel.mk
>
>  PKG_NAME:=base-files
> -PKG_RELEASE:=156
> +PKG_RELEASE:=157
>
>  PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
>  PKG_BUILD_DEPENDS:=opkg/host
> diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
> index d53be3e..9d98fb0 100755
> --- a/package/base-files/files/lib/functions.sh
> +++ b/package/base-files/files/lib/functions.sh
> @@ -173,7 +173,6 @@ default_prerm() {
>  default_postinst() {
>         local name rusers
>         name=$(echo $(basename $1) | cut -d. -f1)
> -       [ -f ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.postinst-pkg ] && ( . ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.postinst-pkg )
>         rusers=$(grep "Require-User:" ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.control)
>         [ -n "$rusers" ] && {
>                 local user group uid gid
> @@ -212,6 +211,10 @@ default_postinst() {
>                         done
>                 done
>         }
> +
> +       [ -f ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.postinst-pkg ] && ( . ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.postinst-pkg )
> +       [ -n "${IPKG_INSTROOT}" ] || rm -f /tmp/luci-indexcache 2>/dev/null

You also moved the removal of the luci indexcache, but did not mention
that in the changelog. Please also describe why this is needed.

> +
>         [ "$PKG_UPGRADE" = "1" ] || for i in `cat ${IPKG_INSTROOT}/usr/lib/opkg/info/${name}.list | grep "^/etc/init.d/"`; do
>                 [ -n "${IPKG_INSTROOT}" ] && $(which bash) ${IPKG_INSTROOT}/etc/rc.common ${IPKG_INSTROOT}$i enable; \
>                 [ -n "${IPKG_INSTROOT}" ] || {
> @@ -219,7 +222,6 @@ default_postinst() {
>                         $i start
>                 }
>         done
> -       [ -n "${IPKG_INSTROOT}" ] || rm -f /tmp/luci-indexcache 2>/dev/null
>         return 0
>  }


Regards
Jonas
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list