diff options
author | John Crispin <john@openwrt.org> | 2013-04-25 19:02:32 +0000 |
---|---|---|
committer | John Crispin <john@openwrt.org> | 2013-04-25 19:02:32 +0000 |
commit | 811d90ff40eddb4dec53aef5276424f25fff4606 (patch) | |
tree | 5976a18073a6523e2126bb4c9ccca6e2ce7fd608 /package/base-files | |
parent | 39469dea7f2f0fe1d68e27ca2f790e44e03f3126 (diff) | |
download | upstream-811d90ff40eddb4dec53aef5276424f25fff4606.tar.gz upstream-811d90ff40eddb4dec53aef5276424f25fff4606.tar.bz2 upstream-811d90ff40eddb4dec53aef5276424f25fff4606.zip |
mount_root: prepare base-files
Signed-off-by: John Crispin <blogic@openwrt.org>
SVN-Revision: 36429
Diffstat (limited to 'package/base-files')
-rwxr-xr-x | package/base-files/files.old/etc/init.d/done | 20 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/05_firstboot_skip (renamed from package/base-files/files/lib/firstboot/05_firstboot_skip) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/10_determine_parts (renamed from package/base-files/files/lib/firstboot/10_determine_parts) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/10_no_fo_clear_overlay (renamed from package/base-files/files/lib/firstboot/10_no_fo_clear_overlay) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/10_reset_has_mini_fo (renamed from package/base-files/files/lib/firstboot/10_reset_has_mini_fo) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/20_has_mini_fo (renamed from package/base-files/files/lib/firstboot/20_has_mini_fo) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/20_no_fo_mount_jffs (renamed from package/base-files/files/lib/firstboot/20_no_fo_mount_jffs) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/20_reset_clear_jffs (renamed from package/base-files/files/lib/firstboot/20_reset_clear_jffs) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/30_is_rootfs_mounted (renamed from package/base-files/files/lib/firstboot/30_is_rootfs_mounted) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/30_no_fo_pivot (renamed from package/base-files/files/lib/firstboot/30_no_fo_pivot) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/30_reset_copy_rom (renamed from package/base-files/files/lib/firstboot/30_reset_copy_rom) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/40_copy_ramoverlay (renamed from package/base-files/files/lib/firstboot/40_copy_ramoverlay) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/40_no_fo_copy_ramoverlay (renamed from package/base-files/files/lib/firstboot/40_no_fo_copy_ramoverlay) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/50_pivot (renamed from package/base-files/files/lib/firstboot/50_pivot) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/99_10_no_fo_cleanup (renamed from package/base-files/files/lib/firstboot/99_10_no_fo_cleanup) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/firstboot/99_10_with_fo_cleanup | 2 | ||||
-rw-r--r-- | package/base-files/files.old/lib/preinit/05_mount_skip (renamed from package/base-files/files/lib/preinit/05_mount_skip) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/preinit/10_check_for_mtd (renamed from package/base-files/files/lib/preinit/10_check_for_mtd) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/preinit/20_check_jffs2_ready (renamed from package/base-files/files/lib/preinit/20_check_jffs2_ready) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/preinit/40_mount_jffs2 (renamed from package/base-files/files/lib/preinit/40_mount_jffs2) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/preinit/41_merge_overlay_hooks (renamed from package/base-files/files/lib/preinit/41_merge_overlay_hooks) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/preinit/70_pivot_jffs2_root (renamed from package/base-files/files/lib/preinit/70_pivot_jffs2_root) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/preinit/90_mount_no_jffs2 (renamed from package/base-files/files/lib/preinit/90_mount_no_jffs2) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/preinit/90_restore_config (renamed from package/base-files/files/lib/preinit/90_restore_config) | 0 | ||||
-rw-r--r-- | package/base-files/files.old/lib/preinit/99_10_mount_no_mtd (renamed from package/base-files/files/lib/preinit/99_10_mount_no_mtd) | 0 | ||||
-rwxr-xr-x | package/base-files/files.old/sbin/firstboot | 44 | ||||
-rwxr-xr-x | package/base-files/files.old/sbin/mount_root (renamed from package/base-files/files/sbin/mount_root) | 0 | ||||
-rwxr-xr-x | package/base-files/files/etc/init.d/done | 2 | ||||
-rwxr-xr-x | package/base-files/files/etc/rc.button/reset | 2 | ||||
-rw-r--r-- | package/base-files/files/lib/firstboot/99_10_with_fo_cleanup | 25 | ||||
-rw-r--r-- | package/base-files/files/lib/preinit/80_mount_root | 11 | ||||
-rwxr-xr-x | package/base-files/files/sbin/firstboot | 43 | ||||
-rwxr-xr-x | package/base-files/files/sbin/sysupgrade | 2 |
33 files changed, 80 insertions, 71 deletions
diff --git a/package/base-files/files.old/etc/init.d/done b/package/base-files/files.old/etc/init.d/done new file mode 100755 index 0000000000..8278669120 --- /dev/null +++ b/package/base-files/files.old/etc/init.d/done @@ -0,0 +1,20 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +START=95 +boot() { + [ -d /tmp/root ] && { + lock /tmp/.switch2jffs + firstboot switch2jffs + lock -u /tmp/.switch2jffs + } + + # process user commands + [ -f /etc/rc.local ] && { + sh /etc/rc.local + } + + # set leds to normal state + . /etc/diag.sh + set_state done +} diff --git a/package/base-files/files/lib/firstboot/05_firstboot_skip b/package/base-files/files.old/lib/firstboot/05_firstboot_skip index 5f44df6218..5f44df6218 100644 --- a/package/base-files/files/lib/firstboot/05_firstboot_skip +++ b/package/base-files/files.old/lib/firstboot/05_firstboot_skip diff --git a/package/base-files/files/lib/firstboot/10_determine_parts b/package/base-files/files.old/lib/firstboot/10_determine_parts index 3f56e32a89..3f56e32a89 100644 --- a/package/base-files/files/lib/firstboot/10_determine_parts +++ b/package/base-files/files.old/lib/firstboot/10_determine_parts diff --git a/package/base-files/files/lib/firstboot/10_no_fo_clear_overlay b/package/base-files/files.old/lib/firstboot/10_no_fo_clear_overlay index 8a7d9b066f..8a7d9b066f 100644 --- a/package/base-files/files/lib/firstboot/10_no_fo_clear_overlay +++ b/package/base-files/files.old/lib/firstboot/10_no_fo_clear_overlay diff --git a/package/base-files/files/lib/firstboot/10_reset_has_mini_fo b/package/base-files/files.old/lib/firstboot/10_reset_has_mini_fo index 4e285840a9..4e285840a9 100644 --- a/package/base-files/files/lib/firstboot/10_reset_has_mini_fo +++ b/package/base-files/files.old/lib/firstboot/10_reset_has_mini_fo diff --git a/package/base-files/files/lib/firstboot/20_has_mini_fo b/package/base-files/files.old/lib/firstboot/20_has_mini_fo index 8ca6a4fe58..8ca6a4fe58 100644 --- a/package/base-files/files/lib/firstboot/20_has_mini_fo +++ b/package/base-files/files.old/lib/firstboot/20_has_mini_fo diff --git a/package/base-files/files/lib/firstboot/20_no_fo_mount_jffs b/package/base-files/files.old/lib/firstboot/20_no_fo_mount_jffs index c03714fa6d..c03714fa6d 100644 --- a/package/base-files/files/lib/firstboot/20_no_fo_mount_jffs +++ b/package/base-files/files.old/lib/firstboot/20_no_fo_mount_jffs diff --git a/package/base-files/files/lib/firstboot/20_reset_clear_jffs b/package/base-files/files.old/lib/firstboot/20_reset_clear_jffs index a3cd24fe9a..a3cd24fe9a 100644 --- a/package/base-files/files/lib/firstboot/20_reset_clear_jffs +++ b/package/base-files/files.old/lib/firstboot/20_reset_clear_jffs diff --git a/package/base-files/files/lib/firstboot/30_is_rootfs_mounted b/package/base-files/files.old/lib/firstboot/30_is_rootfs_mounted index 7233fd9039..7233fd9039 100644 --- a/package/base-files/files/lib/firstboot/30_is_rootfs_mounted +++ b/package/base-files/files.old/lib/firstboot/30_is_rootfs_mounted diff --git a/package/base-files/files/lib/firstboot/30_no_fo_pivot b/package/base-files/files.old/lib/firstboot/30_no_fo_pivot index b5c2601ee8..b5c2601ee8 100644 --- a/package/base-files/files/lib/firstboot/30_no_fo_pivot +++ b/package/base-files/files.old/lib/firstboot/30_no_fo_pivot diff --git a/package/base-files/files/lib/firstboot/30_reset_copy_rom b/package/base-files/files.old/lib/firstboot/30_reset_copy_rom index d91c68947b..d91c68947b 100644 --- a/package/base-files/files/lib/firstboot/30_reset_copy_rom +++ b/package/base-files/files.old/lib/firstboot/30_reset_copy_rom diff --git a/package/base-files/files/lib/firstboot/40_copy_ramoverlay b/package/base-files/files.old/lib/firstboot/40_copy_ramoverlay index 39c2edacba..39c2edacba 100644 --- a/package/base-files/files/lib/firstboot/40_copy_ramoverlay +++ b/package/base-files/files.old/lib/firstboot/40_copy_ramoverlay diff --git a/package/base-files/files/lib/firstboot/40_no_fo_copy_ramoverlay b/package/base-files/files.old/lib/firstboot/40_no_fo_copy_ramoverlay index ced7c1b668..ced7c1b668 100644 --- a/package/base-files/files/lib/firstboot/40_no_fo_copy_ramoverlay +++ b/package/base-files/files.old/lib/firstboot/40_no_fo_copy_ramoverlay diff --git a/package/base-files/files/lib/firstboot/50_pivot b/package/base-files/files.old/lib/firstboot/50_pivot index 53801d7a8f..53801d7a8f 100644 --- a/package/base-files/files/lib/firstboot/50_pivot +++ b/package/base-files/files.old/lib/firstboot/50_pivot diff --git a/package/base-files/files/lib/firstboot/99_10_no_fo_cleanup b/package/base-files/files.old/lib/firstboot/99_10_no_fo_cleanup index 6dedcb1e87..6dedcb1e87 100644 --- a/package/base-files/files/lib/firstboot/99_10_no_fo_cleanup +++ b/package/base-files/files.old/lib/firstboot/99_10_no_fo_cleanup diff --git a/package/base-files/files.old/lib/firstboot/99_10_with_fo_cleanup b/package/base-files/files.old/lib/firstboot/99_10_with_fo_cleanup index 0181b39d49..560169901c 100644 --- a/package/base-files/files.old/lib/firstboot/99_10_with_fo_cleanup +++ b/package/base-files/files.old/lib/firstboot/99_10_with_fo_cleanup @@ -6,7 +6,7 @@ with_fo_cleanup() { # try to get rid of /tmp/root # this will almost always fail - umount /tmp/root 2>&- + umount -l /tmp/root 2>&- grep -q overlay /proc/filesystems && { cd / ( diff --git a/package/base-files/files/lib/preinit/05_mount_skip b/package/base-files/files.old/lib/preinit/05_mount_skip index c2b7ee79d6..c2b7ee79d6 100644 --- a/package/base-files/files/lib/preinit/05_mount_skip +++ b/package/base-files/files.old/lib/preinit/05_mount_skip diff --git a/package/base-files/files/lib/preinit/10_check_for_mtd b/package/base-files/files.old/lib/preinit/10_check_for_mtd index 6a7bd307f8..6a7bd307f8 100644 --- a/package/base-files/files/lib/preinit/10_check_for_mtd +++ b/package/base-files/files.old/lib/preinit/10_check_for_mtd diff --git a/package/base-files/files/lib/preinit/20_check_jffs2_ready b/package/base-files/files.old/lib/preinit/20_check_jffs2_ready index 3c5cf67e8d..3c5cf67e8d 100644 --- a/package/base-files/files/lib/preinit/20_check_jffs2_ready +++ b/package/base-files/files.old/lib/preinit/20_check_jffs2_ready diff --git a/package/base-files/files/lib/preinit/40_mount_jffs2 b/package/base-files/files.old/lib/preinit/40_mount_jffs2 index ded785ed58..ded785ed58 100644 --- a/package/base-files/files/lib/preinit/40_mount_jffs2 +++ b/package/base-files/files.old/lib/preinit/40_mount_jffs2 diff --git a/package/base-files/files/lib/preinit/41_merge_overlay_hooks b/package/base-files/files.old/lib/preinit/41_merge_overlay_hooks index 4ca6877bea..4ca6877bea 100644 --- a/package/base-files/files/lib/preinit/41_merge_overlay_hooks +++ b/package/base-files/files.old/lib/preinit/41_merge_overlay_hooks diff --git a/package/base-files/files/lib/preinit/70_pivot_jffs2_root b/package/base-files/files.old/lib/preinit/70_pivot_jffs2_root index b76f111ca3..b76f111ca3 100644 --- a/package/base-files/files/lib/preinit/70_pivot_jffs2_root +++ b/package/base-files/files.old/lib/preinit/70_pivot_jffs2_root diff --git a/package/base-files/files/lib/preinit/90_mount_no_jffs2 b/package/base-files/files.old/lib/preinit/90_mount_no_jffs2 index d8ad4ae119..d8ad4ae119 100644 --- a/package/base-files/files/lib/preinit/90_mount_no_jffs2 +++ b/package/base-files/files.old/lib/preinit/90_mount_no_jffs2 diff --git a/package/base-files/files/lib/preinit/90_restore_config b/package/base-files/files.old/lib/preinit/90_restore_config index 210bf61847..210bf61847 100644 --- a/package/base-files/files/lib/preinit/90_restore_config +++ b/package/base-files/files.old/lib/preinit/90_restore_config diff --git a/package/base-files/files/lib/preinit/99_10_mount_no_mtd b/package/base-files/files.old/lib/preinit/99_10_mount_no_mtd index c4f38e415b..c4f38e415b 100644 --- a/package/base-files/files/lib/preinit/99_10_mount_no_mtd +++ b/package/base-files/files.old/lib/preinit/99_10_mount_no_mtd diff --git a/package/base-files/files.old/sbin/firstboot b/package/base-files/files.old/sbin/firstboot new file mode 100755 index 0000000000..06b64c3133 --- /dev/null +++ b/package/base-files/files.old/sbin/firstboot @@ -0,0 +1,44 @@ +#!/bin/sh + +switch2jffs_hook= +jffs2reset_hook= +no_fo_hook= + +. /lib/functions.sh + +firstboot_skip_next=false + +for fb_source_file in /lib/firstboot/*; do + . $fb_source_file +done + +set_mtd_part +set_rom_part +set_jffs_part + +# invoked as an executable +if [ "${0##*/}" = "firstboot" ]; then + if [ "$1" = "switch2jffs" ]; then + boot_run_hook switch2jffs + else + if [ -t 0 ] && [ "$1" != "-y" ]; then + local input + + echo -n "firstboot will erase all settings and remove any installed packages. Are you sure? [N/y]" + read input + [ "$input" = "y" ] || [ "$input" = "Y" ] || return 0 + fi + + if [ -n "$jffs" ]; then + reset_has_fo=true + echo "firstboot has already been run" + echo "jffs2 partition is mounted, only resetting files" + boot_run_hook jffs2reset + else + mtd erase "$partname" + mount -o noatime "$mtdpart" /overlay -t jffs2 + fopivot /overlay /rom 1 + fi + fi +fi + diff --git a/package/base-files/files/sbin/mount_root b/package/base-files/files.old/sbin/mount_root index 1c48ebab1e..1c48ebab1e 100755 --- a/package/base-files/files/sbin/mount_root +++ b/package/base-files/files.old/sbin/mount_root diff --git a/package/base-files/files/etc/init.d/done b/package/base-files/files/etc/init.d/done index 8278669120..8040766dc2 100755 --- a/package/base-files/files/etc/init.d/done +++ b/package/base-files/files/etc/init.d/done @@ -5,7 +5,7 @@ START=95 boot() { [ -d /tmp/root ] && { lock /tmp/.switch2jffs - firstboot switch2jffs + switch2jffs lock -u /tmp/.switch2jffs } diff --git a/package/base-files/files/etc/rc.button/reset b/package/base-files/files/etc/rc.button/reset index 763994d075..229b503a69 100755 --- a/package/base-files/files/etc/rc.button/reset +++ b/package/base-files/files/etc/rc.button/reset @@ -14,5 +14,5 @@ then elif [ "$SEEN" -gt 5 ] then echo "FACTORY RESET" > /dev/console - firstboot && reboot & + jffs2reset -y && reboot & fi diff --git a/package/base-files/files/lib/firstboot/99_10_with_fo_cleanup b/package/base-files/files/lib/firstboot/99_10_with_fo_cleanup deleted file mode 100644 index 560169901c..0000000000 --- a/package/base-files/files/lib/firstboot/99_10_with_fo_cleanup +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2006-2010 OpenWrt.org -# Copyright (C) 2010 Vertical Communications - -with_fo_cleanup() { - # try to get rid of /tmp/root - # this will almost always fail - umount -l /tmp/root 2>&- - grep -q overlay /proc/filesystems && { - cd / - ( - cd /overlay - find -type l - ) | while read FILE; do - [ -z "$FILE" ] && break - if ls -la "$FILE" 2>&- | grep -q '(overlay-whiteout)'; then - rm -f "$FILE" - fi - done - } - exit 0 -} - -boot_hook_add switch2jffs with_fo_cleanup diff --git a/package/base-files/files/lib/preinit/80_mount_root b/package/base-files/files/lib/preinit/80_mount_root index 9a99ee9109..0292d82d4a 100644 --- a/package/base-files/files/lib/preinit/80_mount_root +++ b/package/base-files/files/lib/preinit/80_mount_root @@ -3,7 +3,16 @@ # Copyright (C) 2010 Vertical Communications do_mount_root() { - boot_run_hook preinit_mount_root + mount_root + boot_run_hook preinit_mount_root + [ -f /sysupgrade.tgz ] && { + echo "- config restore -" + cd / + mv sysupgrade.tgz /tmp + tar xzf /tmp/sysupgrade.tgz + rm -f /tmp/sysupgrade.tgz + sync + } } [ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main do_mount_root diff --git a/package/base-files/files/sbin/firstboot b/package/base-files/files/sbin/firstboot index 06b64c3133..081febb7ba 100755 --- a/package/base-files/files/sbin/firstboot +++ b/package/base-files/files/sbin/firstboot @@ -1,44 +1,3 @@ #!/bin/sh -switch2jffs_hook= -jffs2reset_hook= -no_fo_hook= - -. /lib/functions.sh - -firstboot_skip_next=false - -for fb_source_file in /lib/firstboot/*; do - . $fb_source_file -done - -set_mtd_part -set_rom_part -set_jffs_part - -# invoked as an executable -if [ "${0##*/}" = "firstboot" ]; then - if [ "$1" = "switch2jffs" ]; then - boot_run_hook switch2jffs - else - if [ -t 0 ] && [ "$1" != "-y" ]; then - local input - - echo -n "firstboot will erase all settings and remove any installed packages. Are you sure? [N/y]" - read input - [ "$input" = "y" ] || [ "$input" = "Y" ] || return 0 - fi - - if [ -n "$jffs" ]; then - reset_has_fo=true - echo "firstboot has already been run" - echo "jffs2 partition is mounted, only resetting files" - boot_run_hook jffs2reset - else - mtd erase "$partname" - mount -o noatime "$mtdpart" /overlay -t jffs2 - fopivot /overlay /rom 1 - fi - fi -fi - +/sbin/jffs2reset diff --git a/package/base-files/files/sbin/sysupgrade b/package/base-files/files/sbin/sysupgrade index 67019307d1..1ad6ea44a1 100755 --- a/package/base-files/files/sbin/sysupgrade +++ b/package/base-files/files/sbin/sysupgrade @@ -179,6 +179,8 @@ fi run_hooks "" $sysupgrade_pre_upgrade +ubus call system upgrade + kill_remaining TERM sleep 3 kill_remaining KILL |