1 #!/bin/sh /etc/rc.common
2 # Copyright (C) 2007 OpenWrt.org
3 # Copyright (C) 2010 Vertical Communications
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
11 EXTRA_COMMANDS
="overlay_enable whole_root_enable"
12 EXTRA_HELP
=" overlay_enable Reenable overlay rootfs. (After you fix it).
13 whole_root_enable Reenable whole-disk rootfs. (After you fix it)."
16 local extroot_type
="$1"
18 if [ ! -d /tmp
/${extroot_type}-disabled ]; then
19 echo "No disabled ${extroot_type} present (/tmp/${extroot_type}-disabled). Can't renable."
23 rm -f /tmp
/${extroot_type}-disabled/.extroot.
md5sum
24 rm -f /tmp
/${extroot_type}-disabled/etc
/extroot.
md5sum
25 echo "Please reboot router to complete re-enabling external rootfs."
33 rootfs_enable whole_root
38 config_mount_by_section
"$cfg"
43 config_swapon_by_section
"$cfg"
49 config_get target
"$cfg" target
50 config_get_bool enabled
"$cfg" "enabled" '1'
51 [ -n "$target" -a "$enabled" -gt 0 ] ||
return 0
58 config_get device
"$cfg" device
59 config_get_bool enabled
"$cfg" "enabled" '1'
60 [ -n "$device" -a "$enabled" -gt 0 ] && type swapoff
>/dev
/null ||
return 0
65 .
/lib
/functions
/mount.sh
69 lock
/var
/lock
/fstab.lck
70 [ -e /tmp
/fstab
] ||
{
71 echo '# WARNING: this is an auto generated file, please use uci to set defined filesystems' > /tmp
/fstab
73 lock
-u /var
/lock
/fstab.lck
74 config_foreach do_swapon swap
75 config_foreach do_mount mount
76 config_foreach do_swapon swap
# do swap a second time so that swap on filesystems is enabled
80 .
/lib
/functions
/mount.sh
83 config_foreach do_unmount mount
84 config_foreach do_swapoff swap