summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--update-me.in20
1 files changed, 11 insertions, 9 deletions
diff --git a/update-me.in b/update-me.in
index 09025fc..cff74f3 100644
--- a/update-me.in
+++ b/update-me.in
@@ -4,15 +4,17 @@ preCmds=('hostname')
cmds=()
postCmds=('sync')
-if mountpoint -q /boot \
-&& mount \
- | grep -wF '/boot' \
- | cut -d' ' -f6 \
- | grep -qwF 'ro' \
-&& [ ! -d '#ETCDIR#/ports' ]; then
- preCmds+=('mount -o remount,rw /boot')
- postCmds+=('mount -o remount,ro /boot')
-fi
+for mp in '/' '/boot'; do
+ mountpoint -q "${mp}" || continue
+ mount \
+ | cut -d' ' -f3,6 \
+ | grep "^${mp}\s" \
+ | cut -d' ' -f2 \
+ | grep -qwF 'ro' || continue
+ [ "${mp}" = '/boot' ] && [ -d '#ETCDIR#/ports' ] && continue
+ preCmds+=('mount -o remount,rw '"${mp}")
+ postCmds+=('mount -o remount,ro '"${mp}")
+done
if command -v check-kernel >/dev/null; then
postCmds+=('check-kernel -r')