base-files: add missing $IPKG_INSTROOT to restorecon call
authorDaniel Golle <daniel@makrotopia.org>
Mon, 2 May 2022 18:58:56 +0000 (19:58 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Mon, 2 May 2022 18:59:58 +0000 (19:59 +0100)
Update to overlooked v2 version of Dominick Grift's patch.

Fixes: 5109bd164c ("base-files: address sed in-place without SELinux awareness")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
package/base-files/files/lib/functions.sh

index 9db0871d6ccbb5413c452c12a3864a780093c68e..da2dd5b34643688b863e4ff817d5d4508e733300 100644 (file)
@@ -386,7 +386,9 @@ group_add_user() {
        echo "$grp" | grep -q ":$" && delim=""
        [ -n "$IPKG_INSTROOT" ] || lock /var/lock/passwd
        sed -i "s/$grp/$grp$delim$2/g" ${IPKG_INSTROOT}/etc/group
-       selinuxenabled 2>/dev/null && restorecon /etc/group
+       if [ -x /usr/sbin/selinuxenabled ] && selinuxenabled; then
+               selinuxenabled 2>/dev/null && restorecon ${IPKG_INSTROOT}/etc/group
+       fi
        [ -n "$IPKG_INSTROOT" ] || lock -u /var/lock/passwd
 }