From bf37e1024564d25afa37094e0da3e805d496d6a5 Mon Sep 17 00:00:00 2001 From: Fabian Vogt Date: Thu, 26 Sep 2024 15:41:33 +0200 Subject: [PATCH] Make sure / is writable when migrating to /etc/selinux/.autorelabel --- selinux/98selinux-microos/selinux-microos-relabel.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/selinux/98selinux-microos/selinux-microos-relabel.sh b/selinux/98selinux-microos/selinux-microos-relabel.sh index fc98a2e..0d68974 100755 --- a/selinux/98selinux-microos/selinux-microos-relabel.sh +++ b/selinux/98selinux-microos/selinux-microos-relabel.sh @@ -105,8 +105,9 @@ rd_microos_relabel() return $ret } -if test -e "$NEWROOT"/.autorelabel -a "$NEWROOT"/.autorelabel -nt "$NEWROOT"/etc/selinux/.relabelled ; then - cp -a "$NEWROOT"/.autorelabel "$NEWROOT"/etc/selinux/.autorelabel +if [ -e "$NEWROOT"/.autorelabel ] && [ "$NEWROOT"/.autorelabel -nt "$NEWROOT"/etc/selinux/.relabelled ]; then + mount -o remount,rw "$NEWROOT" || return 1 + cp -a "$NEWROOT"/.autorelabel "$NEWROOT"/etc/selinux/.autorelabel || return 1 rm -f "$NEWROOT"/.autorelabel 2>/dev/null fi