From 46b8015d93c260f46f16671e6f5f9f021f2aa938 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Thu, 17 Jun 2021 10:54:08 +0200 Subject: [PATCH] fallback if findmnt is absent --- CHANGELOG.md | 2 ++ evomaintenance.sh | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 632a30e..7371a85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ and this project **does not adhere to [Semantic Versioning](http://semver.org/sp ### Added +* fallback if findmnt is absent + ### Changed ### Deprecated diff --git a/evomaintenance.sh b/evomaintenance.sh index 1cd4ce7..384501a 100755 --- a/evomaintenance.sh +++ b/evomaintenance.sh @@ -178,9 +178,11 @@ is_repository_readonly() { if [ "$(get_system)" = "OpenBSD" ]; then partition=$(stat -f '%Sd' $1) mount | grep ${partition} | grep -q "read-only" - else + elif command -v findmnt >/dev/null; then mountpoint=$(stat -c '%m' $1) findmnt ${mountpoint} --noheadings --output OPTIONS -O ro + else + grep /usr /proc/mounts | grep -E '\bro\b' fi } remount_repository_readwrite() {