1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-27 16:43:09 +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:
jow 2010-10-13 19:21:41 +00:00
parent a29d533594
commit e24db8edb4
4 changed files with 41 additions and 34 deletions

View File

@ -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 -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
lock -u /var/lock/fstab.lck
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 -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
lock -u /var/lock/fstab.lck
rm -f $fstabnew
lock -u /var/lock/fstab.lck
}
}
libmount_find_token() {

View File

@ -12,7 +12,6 @@ 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
@ -27,7 +26,6 @@ libmount_fsck() {
fi
}
}
}
}
libmount_known_fsck=""

View File

@ -41,11 +41,16 @@ start() {
config_load fstab
mkdir -p /var/lock
lock -w /var/lock/fstab.lck && {
lock /var/lock/fstab.lck
echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /etc/fstab
[ -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_mount mount
}
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() {

View File

@ -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")"