[openwrt/openwrt] base-files: add missing $IPKG_INSTROOT to restorecon call

LEDE Commits lede-commits at lists.infradead.org
Tue May 3 12:33:48 PDT 2022


dangole pushed a commit to openwrt/openwrt.git, branch openwrt-22.03:
https://git.openwrt.org/6cb08b17979c93a7cc086127786ee813b3775783

commit 6cb08b17979c93a7cc086127786ee813b3775783
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Mon May 2 19:58:56 2022 +0100

    base-files: add missing $IPKG_INSTROOT to restorecon call
    
    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 at makrotopia.org>
    (cherry picked from commit 6d7272852e0b2634b2fa93a131ea8659ec87f079)
---
 package/base-files/files/lib/functions.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh
index 9db0871d6c..da2dd5b346 100644
--- a/package/base-files/files/lib/functions.sh
+++ b/package/base-files/files/lib/functions.sh
@@ -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
 }
 




More information about the lede-commits mailing list