2
0
Эх сурвалжийг харах

mount_root: prepare base-files

Signed-off-by: John Crispin <[email protected]>

SVN-Revision: 36429
John Crispin 12 жил өмнө
parent
commit
811d90ff40
33 өөрчлөгдсөн 80 нэмэгдсэн , 71 устгасан
  1. 20 0
      package/base-files/files.old/etc/init.d/done
  2. 0 0
      package/base-files/files.old/lib/firstboot/05_firstboot_skip
  3. 0 0
      package/base-files/files.old/lib/firstboot/10_determine_parts
  4. 0 0
      package/base-files/files.old/lib/firstboot/10_no_fo_clear_overlay
  5. 0 0
      package/base-files/files.old/lib/firstboot/10_reset_has_mini_fo
  6. 0 0
      package/base-files/files.old/lib/firstboot/20_has_mini_fo
  7. 0 0
      package/base-files/files.old/lib/firstboot/20_no_fo_mount_jffs
  8. 0 0
      package/base-files/files.old/lib/firstboot/20_reset_clear_jffs
  9. 0 0
      package/base-files/files.old/lib/firstboot/30_is_rootfs_mounted
  10. 0 0
      package/base-files/files.old/lib/firstboot/30_no_fo_pivot
  11. 0 0
      package/base-files/files.old/lib/firstboot/30_reset_copy_rom
  12. 0 0
      package/base-files/files.old/lib/firstboot/40_copy_ramoverlay
  13. 0 0
      package/base-files/files.old/lib/firstboot/40_no_fo_copy_ramoverlay
  14. 0 0
      package/base-files/files.old/lib/firstboot/50_pivot
  15. 0 0
      package/base-files/files.old/lib/firstboot/99_10_no_fo_cleanup
  16. 1 1
      package/base-files/files.old/lib/firstboot/99_10_with_fo_cleanup
  17. 0 0
      package/base-files/files.old/lib/preinit/05_mount_skip
  18. 0 0
      package/base-files/files.old/lib/preinit/10_check_for_mtd
  19. 0 0
      package/base-files/files.old/lib/preinit/20_check_jffs2_ready
  20. 0 0
      package/base-files/files.old/lib/preinit/40_mount_jffs2
  21. 0 0
      package/base-files/files.old/lib/preinit/41_merge_overlay_hooks
  22. 0 0
      package/base-files/files.old/lib/preinit/70_pivot_jffs2_root
  23. 0 0
      package/base-files/files.old/lib/preinit/90_mount_no_jffs2
  24. 0 0
      package/base-files/files.old/lib/preinit/90_restore_config
  25. 0 0
      package/base-files/files.old/lib/preinit/99_10_mount_no_mtd
  26. 44 0
      package/base-files/files.old/sbin/firstboot
  27. 0 0
      package/base-files/files.old/sbin/mount_root
  28. 1 1
      package/base-files/files/etc/init.d/done
  29. 1 1
      package/base-files/files/etc/rc.button/reset
  30. 0 25
      package/base-files/files/lib/firstboot/99_10_with_fo_cleanup
  31. 10 1
      package/base-files/files/lib/preinit/80_mount_root
  32. 1 42
      package/base-files/files/sbin/firstboot
  33. 2 0
      package/base-files/files/sbin/sysupgrade

+ 20 - 0
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
+}

+ 0 - 0
package/base-files/files/lib/firstboot/05_firstboot_skip → package/base-files/files.old/lib/firstboot/05_firstboot_skip


+ 0 - 0
package/base-files/files/lib/firstboot/10_determine_parts → package/base-files/files.old/lib/firstboot/10_determine_parts


+ 0 - 0
package/base-files/files/lib/firstboot/10_no_fo_clear_overlay → package/base-files/files.old/lib/firstboot/10_no_fo_clear_overlay


+ 0 - 0
package/base-files/files/lib/firstboot/10_reset_has_mini_fo → package/base-files/files.old/lib/firstboot/10_reset_has_mini_fo


+ 0 - 0
package/base-files/files/lib/firstboot/20_has_mini_fo → package/base-files/files.old/lib/firstboot/20_has_mini_fo


+ 0 - 0
package/base-files/files/lib/firstboot/20_no_fo_mount_jffs → package/base-files/files.old/lib/firstboot/20_no_fo_mount_jffs


+ 0 - 0
package/base-files/files/lib/firstboot/20_reset_clear_jffs → package/base-files/files.old/lib/firstboot/20_reset_clear_jffs


+ 0 - 0
package/base-files/files/lib/firstboot/30_is_rootfs_mounted → package/base-files/files.old/lib/firstboot/30_is_rootfs_mounted


+ 0 - 0
package/base-files/files/lib/firstboot/30_no_fo_pivot → package/base-files/files.old/lib/firstboot/30_no_fo_pivot


+ 0 - 0
package/base-files/files/lib/firstboot/30_reset_copy_rom → package/base-files/files.old/lib/firstboot/30_reset_copy_rom


+ 0 - 0
package/base-files/files/lib/firstboot/40_copy_ramoverlay → package/base-files/files.old/lib/firstboot/40_copy_ramoverlay


+ 0 - 0
package/base-files/files/lib/firstboot/40_no_fo_copy_ramoverlay → package/base-files/files.old/lib/firstboot/40_no_fo_copy_ramoverlay


+ 0 - 0
package/base-files/files/lib/firstboot/50_pivot → package/base-files/files.old/lib/firstboot/50_pivot


+ 0 - 0
package/base-files/files/lib/firstboot/99_10_no_fo_cleanup → package/base-files/files.old/lib/firstboot/99_10_no_fo_cleanup


+ 1 - 1
package/base-files/files.old/lib/firstboot/99_10_with_fo_cleanup

@@ -6,7 +6,7 @@
 with_fo_cleanup() {
 with_fo_cleanup() {
     # try to get rid of /tmp/root
     # try to get rid of /tmp/root
     # this will almost always fail
     # this will almost always fail
-    umount /tmp/root 2>&-
+    umount -l /tmp/root 2>&-
 	grep -q overlay /proc/filesystems && {
 	grep -q overlay /proc/filesystems && {
 		cd /
 		cd /
 		(
 		(

+ 0 - 0
package/base-files/files/lib/preinit/05_mount_skip → package/base-files/files.old/lib/preinit/05_mount_skip


+ 0 - 0
package/base-files/files/lib/preinit/10_check_for_mtd → package/base-files/files.old/lib/preinit/10_check_for_mtd


+ 0 - 0
package/base-files/files/lib/preinit/20_check_jffs2_ready → package/base-files/files.old/lib/preinit/20_check_jffs2_ready


+ 0 - 0
package/base-files/files/lib/preinit/40_mount_jffs2 → package/base-files/files.old/lib/preinit/40_mount_jffs2


+ 0 - 0
package/base-files/files/lib/preinit/41_merge_overlay_hooks → package/base-files/files.old/lib/preinit/41_merge_overlay_hooks


+ 0 - 0
package/base-files/files/lib/preinit/70_pivot_jffs2_root → package/base-files/files.old/lib/preinit/70_pivot_jffs2_root


+ 0 - 0
package/base-files/files/lib/preinit/90_mount_no_jffs2 → package/base-files/files.old/lib/preinit/90_mount_no_jffs2


+ 0 - 0
package/base-files/files/lib/preinit/90_restore_config → package/base-files/files.old/lib/preinit/90_restore_config


+ 0 - 0
package/base-files/files/lib/preinit/99_10_mount_no_mtd → package/base-files/files.old/lib/preinit/99_10_mount_no_mtd


+ 44 - 0
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
+

+ 0 - 0
package/base-files/files/sbin/mount_root → package/base-files/files.old/sbin/mount_root


+ 1 - 1
package/base-files/files/etc/init.d/done

@@ -5,7 +5,7 @@ START=95
 boot() {
 boot() {
 	[ -d /tmp/root ] && {
 	[ -d /tmp/root ] && {
 		lock /tmp/.switch2jffs
 		lock /tmp/.switch2jffs
-		firstboot switch2jffs
+		switch2jffs
 		lock -u /tmp/.switch2jffs
 		lock -u /tmp/.switch2jffs
 	}
 	}
 
 

+ 1 - 1
package/base-files/files/etc/rc.button/reset

@@ -14,5 +14,5 @@ then
 elif [ "$SEEN" -gt 5 ]
 elif [ "$SEEN" -gt 5 ]
 then
 then
 	echo "FACTORY RESET" > /dev/console
 	echo "FACTORY RESET" > /dev/console
-	firstboot && reboot &
+	jffs2reset -y && reboot &
 fi
 fi

+ 0 - 25
package/base-files/files/lib/firstboot/99_10_with_fo_cleanup

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

+ 10 - 1
package/base-files/files/lib/preinit/80_mount_root

@@ -3,7 +3,16 @@
 # Copyright (C) 2010 Vertical Communications
 # Copyright (C) 2010 Vertical Communications
 
 
 do_mount_root() {
 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
 [ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main do_mount_root

+ 1 - 42
package/base-files/files/sbin/firstboot

@@ -1,44 +1,3 @@
 #!/bin/sh
 #!/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

+ 2 - 0
package/base-files/files/sbin/sysupgrade

@@ -179,6 +179,8 @@ fi
 
 
 run_hooks "" $sysupgrade_pre_upgrade
 run_hooks "" $sysupgrade_pre_upgrade
 
 
+ubus call system upgrade
+
 kill_remaining TERM
 kill_remaining TERM
 sleep 3
 sleep 3
 kill_remaining KILL
 kill_remaining KILL