X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/e874a71630703178e6d9cf86f4c1072e7f0426bc..HEAD:/package/block-mount/files/block.sh?ds=inline diff --git a/package/block-mount/files/block.sh b/package/block-mount/files/block.sh index 72d6c3ab3..ac8ca3bfb 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,24 +142,22 @@ 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() { local token="$1" local value="$2" local device - device="$(blkid | grep "$token=\"$value\"" | cut -f1 -d:)" + device="$(blkid -w /dev/null -c /dev/null | grep "$token=\"$value\"" | cut -f1 -d:)" echo "$device" }