From c3eadd27e1eb82e52ee9b801d57131d72ed41e01 Mon Sep 17 00:00:00 2001 From: Cem Keylan Date: Mon, 1 Jun 2020 12:52:00 +0300 Subject: init: make mnt function similar to KISS --- rc.lib | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'rc.lib') diff --git a/rc.lib b/rc.lib index 03ef793..1df98ff 100644 --- a/rc.lib +++ b/rc.lib @@ -75,13 +75,19 @@ device_helper() { esac } -mnt() { - [ -f /proc/mounts ] && while read -r _ mnt _; do +mounted() { + [ -e "$1" ] && + [ -f /proc/mounts ] && + while read -r _ mnt _; do case "$mnt" in "$1") return 0; esac done < /proc/mounts - mnt="$1"; shift - mount "$@" "$mnt" 2>&1 | log + return 1 +} + +mnt() { + mounted "$4" && set -- "remount,$1" "$2" "$3" "$4" + mount -o "$1" -t "$2" "$3" "$4" } parse_cmdline() { -- cgit v1.2.3