Only remount if already mounted read-only

This commit is contained in:
madaidan 2020-03-21 17:49:07 +00:00 committed by GitHub
parent 20f0c574d5
commit 89ada11cf9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,10 +16,15 @@ prereqs)
esac
## ${rootmnt} is mounted read-only in the initramfs so it needs to be remounted first.
if mount | grep "${rootmnt}" | grep -q "(ro,"; then
remount="yes"
mount -o remount,rw "${rootmnt}"
fi
sysctl -p ${rootmnt}/etc/sysctl.conf >/dev/null 2>${rootmnt}/var/log/sysctl-initramfs-error.log
sysctl -p ${rootmnt}/etc/sysctl.d/*.conf >/dev/null 2>>${rootmnt}/var/log/sysctl-initramfs-error.log
if [ "${remount}" = "yes" ]; then
mount -o remount,ro "${rootmnt}"
fi
grep -v "unprivileged_userfaultfd" "${rootmnt}/var/log/sysctl-initramfs-error.log"
true