2007-03-02 01:23:36 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-01-25 17:11:17 +00:00
|
|
|
switch2jffs_hook=
|
|
|
|
jffs2reset_hook=
|
|
|
|
no_fo_hook=
|
2007-03-02 01:23:36 +00:00
|
|
|
|
2010-01-25 17:11:17 +00:00
|
|
|
. /lib/functions/boot.sh
|
2007-03-02 01:23:36 +00:00
|
|
|
|
2010-01-25 17:11:17 +00:00
|
|
|
firstboot_skip_next=false
|
2007-03-02 01:23:36 +00:00
|
|
|
|
2010-01-25 17:11:17 +00:00
|
|
|
for fb_source_file in /lib/firstboot/*; do
|
|
|
|
. $fb_source_file
|
|
|
|
done
|
2007-03-02 01:23:36 +00:00
|
|
|
|
|
|
|
# invoked as an executable
|
2010-01-25 17:11:17 +00:00
|
|
|
if [ "${0##*/}" = "firstboot" ]; then
|
|
|
|
if [ "$1" = "switch2jffs" ]; then
|
|
|
|
boot_run_hook switch2jffs
|
|
|
|
elif [ -z "$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
|
2007-03-02 01:23:36 +00:00
|
|
|
mtd erase "$partname"
|
|
|
|
mount "$mtdpart" /jffs -t jffs2
|
|
|
|
fopivot /jffs /rom 1
|
2010-01-25 17:11:17 +00:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
set_mtd_part
|
|
|
|
set_rom_part
|
|
|
|
set_jffs_part
|
|
|
|
fi
|
|
|
|
|