aboutsummaryrefslogtreecommitdiffstats
path: root/package/block-mount/files
diff options
context:
space:
mode:
Diffstat (limited to 'package/block-mount/files')
-rw-r--r--package/block-mount/files/block.sh36
-rw-r--r--package/block-mount/files/fstab.init10
2 files changed, 20 insertions, 26 deletions
diff --git a/package/block-mount/files/block.sh b/package/block-mount/files/block.sh
index 72d6c3ab3c..80f74b210b 100644
--- a/package/block-mount/files/block.sh
+++ b/package/block-mount/files/block.sh
@@ -119,17 +119,15 @@ config_create_swap_fstab_entry() {
[ -n "$device" ] || return 0
local fstabnew
-
+
mkdir -p /var/lock
- lock -w /var/lock/fstab.lck && {
- lock /var/lock/fstab.lck
- fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
- cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" >>"$fstabnew"
- [ "$enabled" -eq 1 ] && echo "$device none swap sw 0 0" >> "$fstabnew"
- cat "$fstabnew" >/tmp/fstab
- rm -f $fstabnew
- lock -u /var/lock/fstab.lck
- }
+ lock /var/lock/fstab.lck
+ fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
+ cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" >>"$fstabnew"
+ [ "$enabled" -eq 1 ] && echo "$device none swap sw 0 0" >> "$fstabnew"
+ cat "$fstabnew" >/tmp/fstab
+ rm -f $fstabnew
+ lock -u /var/lock/fstab.lck
}
config_create_mount_fstab_entry() {
@@ -144,17 +142,15 @@ config_create_mount_fstab_entry() {
[ -n "$device" ] || return 0
local fstabnew
-
+
mkdir -p /var/lock
- lock -w /var/lock/fstab.lck && {
- lock /var/lock/fstab.lck
- fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
- cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" | grep -v "$target" >>"$fstabnew"
- echo "$device $target $fstype $options 0 0" >>"$fstabnew"
- cat "$fstabnew" >/tmp/fstab
- rm -f $fstabnew
- lock -u /var/lock/fstab.lck
- }
+ lock /var/lock/fstab.lck
+ fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
+ cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" | grep -v "$target" >>"$fstabnew"
+ echo "$device $target $fstype $options 0 0" >>"$fstabnew"
+ cat "$fstabnew" >/tmp/fstab
+ rm -f $fstabnew
+ lock -u /var/lock/fstab.lck
}
libmount_find_token() {
diff --git a/package/block-mount/files/fstab.init b/package/block-mount/files/fstab.init
index aba50ba93a..f54051ebb7 100644
--- a/package/block-mount/files/fstab.init
+++ b/package/block-mount/files/fstab.init
@@ -66,13 +66,11 @@ start() {
config_load fstab
mkdir -p /var/lock
- lock -w /var/lock/fstab.lck && {
- lock /var/lock/fstab.lck
- [ -e /tmp/fstab ] || {
- echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /tmp/fstab
- }
- lock -u /var/lock/fstab.lck
+ lock /var/lock/fstab.lck
+ [ -e /tmp/fstab ] || {
+ echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /tmp/fstab
}
+ lock -u /var/lock/fstab.lck
config_foreach do_swapon swap
config_foreach do_mount mount
config_foreach do_swapon swap # do swap a second time so that swap on filesystems is enabled