1
0
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:
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 [ -n "$device" ] || return 0
local fstabnew="$(mktemp -t '.fstab.XXXXXXXX')" local fstabnew
mkdir -p /var/lock mkdir -p /var/lock
lock /var/lock/fstab.lck lock -w /var/lock/fstab.lck && {
cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" >>"$fstabnew" lock /var/lock/fstab.lck
[ "$enabled" -eq 1 ] && echo "$device none swap sw 0 0" >> "$fstabnew" fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
cat "$fstabnew" >/tmp/fstab cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" >>"$fstabnew"
lock -u /var/lock/fstab.lck [ "$enabled" -eq 1 ] && echo "$device none swap sw 0 0" >> "$fstabnew"
rm -f $fstabnew cat "$fstabnew" >/tmp/fstab
rm -f $fstabnew
lock -u /var/lock/fstab.lck
}
} }
config_create_mount_fstab_entry() { config_create_mount_fstab_entry() {
@ -140,15 +143,18 @@ config_create_mount_fstab_entry() {
[ -n "$target" ] || return 0 [ -n "$target" ] || return 0
[ -n "$device" ] || return 0 [ -n "$device" ] || return 0
local fstabnew="$(mktemp -t '.fstab.XXXXXXXX')" local fstabnew
mkdir -p /var/lock mkdir -p /var/lock
lock /var/lock/fstab.lck lock -w /var/lock/fstab.lck && {
cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" | grep -v "$target" >>"$fstabnew" lock /var/lock/fstab.lck
echo "$device $target $fstype $options 0 0" >>"$fstabnew" fstabnew="$(mktemp -t '.fstab.XXXXXXXX')"
cat "$fstabnew" >/tmp/fstab cat /tmp/fstab | grep -E -v "^$device[[:blank:]]" | grep -v "$target" >>"$fstabnew"
lock -u /var/lock/fstab.lck echo "$device $target $fstype $options 0 0" >>"$fstabnew"
rm -f $fstabnew cat "$fstabnew" >/tmp/fstab
rm -f $fstabnew
lock -u /var/lock/fstab.lck
}
} }
libmount_find_token() { libmount_find_token() {

View File

@ -12,20 +12,18 @@ libmount_fsck() {
local found_fsck=0 local found_fsck=0
[ -n "$fsck_type" ] && [ "$fsck_type" != "swap" ] && { grep -q "$device" /proc/swaps || grep -q "$device" /proc/mounts || {
grep -q "$device" /proc/swaps || grep -q "$device" /proc/mounts || { [ -e "$device" ] && [ "$fsck_enabled" -eq 1 ] && {
[ -e "$device" ] && [ "$fsck_enabled" -eq 1 ] && { for known_type in $libmount_known_fsck; do
for known_type in $libmount_known_fsck; do if [ "$known_type" = "$fsck_fstype" ]; then
if [ "$known_type" = "$fsck_fstype" ]; then fsck_${known_type} "$device"
fsck_${known_type} "$device" found_fsck=1
found_fsck=1 break
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 fi
} done
if [ "$found_fsck" -ne 1 ]; then
logger -t 'fstab' "Unable to check/repair $device; no known fsck for filesystem type $fstype"
fi
} }
} }
} }

View File

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

View File

@ -28,14 +28,13 @@ config_mount_by_section() {
local is_rootfs="$9" local is_rootfs="$9"
shift shift
local found_device="" local found_device=""
local fsck_type=""
found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")" found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"
if [ -n "$found_device" ]; then if [ -n "$found_device" ]; then
if [ -z "$find_rootfs" ] || [ "$find_rootfs" -eq 0 ] || [ "$is_rootfs" -eq 1 ]; then if [ -z "$find_rootfs" ] || [ "$find_rootfs" -eq 0 ] || [ "$is_rootfs" -eq 1 ]; then
[ "$enabled_fsck" -eq 1 ] && { [ "$enabled_fsck" -eq 1 ] && {
grep -q "$found_device" /proc/swaps || grep -q "$found_device" /proc/mounts || { 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 label
local found_device="" local found_device=""
local fsck_type=""
found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")" found_device="$(libmount_find_device_by_id "$uuid" "$label" "$device" "$cfgdevice")"