firstboot 896 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh
  2. switch2jffs_hook=
  3. jffs2reset_hook=
  4. no_fo_hook=
  5. . /lib/functions.sh
  6. firstboot_skip_next=false
  7. for fb_source_file in /lib/firstboot/*; do
  8. . $fb_source_file
  9. done
  10. set_mtd_part
  11. set_rom_part
  12. set_jffs_part
  13. # invoked as an executable
  14. if [ "${0##*/}" = "firstboot" ]; then
  15. if [ "$1" = "switch2jffs" ]; then
  16. boot_run_hook switch2jffs
  17. else
  18. if [ -t 0 ] && [ "$1" != "-y" ]; then
  19. local input
  20. echo -n "firstboot will erase all settings and remove any installed packages. Are you sure? [N/y]"
  21. read input
  22. [ "$input" = "y" ] || [ "$input" = "Y" ] || return 0
  23. fi
  24. if [ -n "$jffs" ]; then
  25. reset_has_fo=true
  26. echo "firstboot has already been run"
  27. echo "jffs2 partition is mounted, only resetting files"
  28. boot_run_hook jffs2reset
  29. else
  30. mtd erase "$partname"
  31. mount -o noatime "$mtdpart" /overlay -t jffs2
  32. fopivot /overlay /rom 1
  33. fi
  34. fi
  35. fi