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