From 0afbcc55f24e4d3b5028afbe03b9a4ce7d6aaede Mon Sep 17 00:00:00 2001 From: fbt Date: Tue, 27 Oct 2015 18:43:56 +0300 Subject: [PATCH] rc.mount rewrite --- rc.in | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/rc.in b/rc.in index 0050fe6..12002e9 100644 --- a/rc.in +++ b/rc.in @@ -29,13 +29,21 @@ rc.tmpfiles() { rc.mount() { for fs in "${cfg_mounts[@]}"; do echo "$fs" | while IFS=':' read device fs_type mountpoint mount_options; do + if mountpoint -q "$mountpoint"; then + if [[ "$mount_options" ]]; then + mount -o "remount,$mount_options" "$mountpoint" + fi + else + if ! [[ -d "$mountpoint" ]]; then + mkdir -p "$mountpoint" + fi - [[ "$mount_options" ]] || { mount_options='defaults'; } + if ! [[ "$mount_options" ]]; then + mount_options='defaults' + fi - mountpoint -q "$mountpoint" || { - [[ -d "$mountpoint" ]] || { mkdir -p "$mountpoint"; } mount "$device" -n -t "$fs_type" -o "$mount_options" "$mountpoint" - } + fi done done }