rc.mount rewrite

This commit is contained in:
Jack L. Frost 2015-10-27 18:43:56 +03:00
parent 1d5e825201
commit 0afbcc55f2
1 changed files with 12 additions and 4 deletions

16
rc.in
View File

@ -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
}