[package] base-files:
[openwrt.git] / package / base-files / files / lib / firstboot / 10_determine_parts
1 #!/bin/sh
2
3 set_mtd_part() {
4 partname="rootfs_data"
5 mtdpart="$(find_mtd_part $partname)"
6 }
7
8 set_rom_part() {
9 rom=$(awk '/squashfs/ {print $2}' /proc/mounts)
10 }
11
12 set_jffs_part() {
13 jffs=$(awk '/jffs2/ {print $2}' /proc/mounts)
14 }
15
16 determine_mtd_part() {
17 set_mtd_part
18 if [ -z "$mtdpart" ]; then
19 echo "MTD partition not found."
20 exit 1
21 fi
22 }
23
24 determine_rom_part() {
25 check_skip || {
26 set_rom_part
27 if [ -z "$rom" ]; then
28 echo "You do not have a squashfs partition; aborting"
29 echo "(firstboot cannot be run on jffs2 based firmwares)"
30 exit 1
31 fi
32 }
33 }
34
35 determine_jffs2_part() {
36 check_skip || {
37 set_jffs_part
38 }
39 }
40
41 boot_hook_add switch2jffs determine_mtd_part
42 boot_hook_add jffs2reset determine_mtd_part
43 boot_hook_add switch2jffs determine_rom_part
44 boot_hook_add jffs2reset determine_rom_part
45 boot_hook_add switch2jffs determine_jffs2_part
46 boot_hook_add jffs2reset determine_jffs2_part
This page took 0.04899 seconds and 5 git commands to generate.