From fca58bcc06234bddfe4ee25a5f3b47072afcf7c0 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 22 Aug 2019 13:55:28 +0200 Subject: update-me: check /boot _and_ / for remount --- update-me.in | 20 +++++++++++--------- 1 file 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') -- cgit v1.2.3-54-g00ecf