mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-23 22:52:28 +02:00
[backfire] merge r21987, r22002, r22147, r22148 and r22150
git-svn-id: svn://svn.openwrt.org/openwrt/branches/backfire@23429 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
a29d533594
commit
e24db8edb4
@ -118,15 +118,18 @@ config_create_swap_fstab_entry() {
|
||||
|
||||
[ -n "$device" ] || return 0
|
||||
|
||||
local fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
|
||||
local fstabnew
|
||||
|
||||
mkdir -p /var/lock
|
||||
lock /var/lock/fstab.lck
|
||||
cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" >>"$fstabnew"
|
||||
[ "$enabled" -eq 1 ] && echo "$device none swap sw 0 0" >> "$fstabnew"
|
||||
cat "$fstabnew" >/tmp/fstab
|
||||
lock -u /var/lock/fstab.lck
|
||||
rm -f $fstabnew
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
config_create_mount_fstab_entry() {
|
||||
@ -140,15 +143,18 @@ config_create_mount_fstab_entry() {
|
||||
[ -n "$target" ] || return 0
|
||||
[ -n "$device" ] || return 0
|
||||
|
||||
local fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
|
||||
local fstabnew
|
||||
|
||||
mkdir -p /var/lock
|
||||
lock /var/lock/fstab.lck
|
||||
cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" | grep -v "$target" >>"$fstabnew"
|
||||
echo "$device $target $fstype $options 0 0" >>"$fstabnew"
|
||||
cat "$fstabnew" >/tmp/fstab
|
||||
lock -u /var/lock/fstab.lck
|
||||
rm -f $fstabnew
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
libmount_find_token() {
|
||||
|
@ -12,20 +12,18 @@ libmount_fsck() {
|
||||
local found_fsck=0
|
||||
|
||||
|
||||
[ -n "$fsck_type" ] && [ "$fsck_type" != "swap" ] && {
|
||||
grep -q "$device" /proc/swaps || grep -q "$device" /proc/mounts || {
|
||||
[ -e "$device" ] && [ "$fsck_enabled" -eq 1 ] && {
|
||||
for known_type in $libmount_known_fsck; do
|
||||
if [ "$known_type" = "$fsck_fstype" ]; then
|
||||
fsck_${known_type} "$device"
|
||||
found_fsck=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$found_fsck" -ne 1 ]; then
|
||||
logger -t 'fstab' "Unable to check/repair $device; no known fsck for filesystem type $fstype"
|
||||
grep -q "$device" /proc/swaps || grep -q "$device" /proc/mounts || {
|
||||
[ -e "$device" ] && [ "$fsck_enabled" -eq 1 ] && {
|
||||
for known_type in $libmount_known_fsck; do
|
||||
if [ "$known_type" = "$fsck_fstype" ]; then
|
||||
fsck_${known_type} "$device"
|
||||
found_fsck=1
|
||||
break
|
||||
fi
|
||||
}
|
||||
done
|
||||
if [ "$found_fsck" -ne 1 ]; then
|
||||
logger -t 'fstab' "Unable to check/repair $device; no known fsck for filesystem type $fstype"
|
||||
fi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,11 +41,16 @@ start() {
|
||||
|
||||
config_load fstab
|
||||
mkdir -p /var/lock
|
||||
lock /var/lock/fstab.lck
|
||||
echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /etc/fstab
|
||||
lock -u /var/lock/fstab.lck
|
||||
config_foreach do_mount mount
|
||||
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
|
||||
}
|
||||
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
|
||||
}
|
||||
|
||||
stop() {
|
||||
|
@ -28,14 +28,13 @@ config_mount_by_section() {
|
||||
local is_rootfs="$9"
|
||||
shift
|
||||
local found_device=""
|
||||
local fsck_type=""
|
||||
|
||||
found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"
|
||||
if [ -n "$found_device" ]; then
|
||||
if [ -z "$find_rootfs" ] || [ "$find_rootfs" -eq 0 ] || [ "$is_rootfs" -eq 1 ]; then
|
||||
[ "$enabled_fsck" -eq 1 ] && {
|
||||
grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || {
|
||||
libmount_fsck "$found_device" "$fsck_type" "$enabled_fsck"
|
||||
libmount_fsck "$found_device" "$fstype" "$enabled_fsck"
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,7 +71,6 @@ config_swapon_by_section() {
|
||||
local label
|
||||
|
||||
local found_device=""
|
||||
local fsck_type=""
|
||||
|
||||
found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user