2007-03-02 09:23:36 +08:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-01-26 01:11:17 +08:00
|
|
|
switch2jffs_hook=
|
|
|
|
jffs2reset_hook=
|
|
|
|
no_fo_hook=
|
2007-03-02 09:23:36 +08:00
|
|
|
|
2010-01-26 01:11:17 +08:00
|
|
|
. /lib/functions/boot.sh
|
2007-03-02 09:23:36 +08:00
|
|
|
|
2010-01-26 01:11:17 +08:00
|
|
|
firstboot_skip_next=false
|
2007-03-02 09:23:36 +08:00
|
|
|
|
2010-01-26 01:11:17 +08:00
|
|
|
for fb_source_file in /lib/firstboot/*; do
|
|
|
|
. $fb_source_file
|
|
|
|
done
|
2007-03-02 09:23:36 +08:00
|
|
|
|
2010-03-05 08:53:51 +08:00
|
|
|
set_mtd_part
|
|
|
|
set_rom_part
|
|
|
|
set_jffs_part
|
|
|
|
|
2007-03-02 09:23:36 +08:00
|
|
|
# invoked as an executable
|
2010-01-26 01:11:17 +08:00
|
|
|
if [ "${0##*/}" = "firstboot" ]; then
|
|
|
|
if [ "$1" = "switch2jffs" ]; then
|
|
|
|
boot_run_hook switch2jffs
|
2010-03-05 08:53:51 +08:00
|
|
|
elif [ -n "$jffs" ]; then
|
2010-01-26 01:11:17 +08:00
|
|
|
reset_has_fo=true
|
|
|
|
echo "firstboot has already been run"
|
|
|
|
echo "jffs2 partition is mounted, only resetting files"
|
|
|
|
boot_run_hook jffs2reset
|
|
|
|
else
|
2007-03-02 09:23:36 +08:00
|
|
|
mtd erase "$partname"
|
2010-03-22 01:16:50 +08:00
|
|
|
mount "$mtdpart" /overlay -t jffs2
|
|
|
|
fopivot /overlay /rom 1
|
2010-01-26 01:11:17 +08:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|