summaryrefslogtreecommitdiffstats
path: root/package/base-files/files.old/lib/firstboot/10_determine_parts
diff options
context:
space:
mode:
authorRoman Yeryomin <roman@advem.lv>2013-05-26 01:02:55 +0300
committerRoman Yeryomin <roman@advem.lv>2013-05-26 01:02:55 +0300
commit342045a35b1981a89e4bc80842b10c065e1050da (patch)
tree4140720b20e8d641c11da882010d6130a75fef21 /package/base-files/files.old/lib/firstboot/10_determine_parts
parent7338133dde8238afce34676214b494c8db96689b (diff)
parent1a116ce7818ecee5d167a9c0ebb1a0feca9120e6 (diff)
Merge trunk into realtek-unstable
Conflicts: Config.in feeds.conf.default package/base-files/files/etc/hotplug2-common.rules package/network/config/netifd/files/etc/init.d/network
Diffstat (limited to 'package/base-files/files.old/lib/firstboot/10_determine_parts')
-rw-r--r--package/base-files/files.old/lib/firstboot/10_determine_parts46
1 files changed, 46 insertions, 0 deletions
diff --git a/package/base-files/files.old/lib/firstboot/10_determine_parts b/package/base-files/files.old/lib/firstboot/10_determine_parts
new file mode 100644
index 000000000..3f56e32a8
--- /dev/null
+++ b/package/base-files/files.old/lib/firstboot/10_determine_parts
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+set_mtd_part() {
+ partname="rootfs_data"
+ mtdpart="$(find_mtd_part $partname)"
+}
+
+set_rom_part() {
+ rom=$(awk '/squashfs/ {print $2}' /proc/mounts)
+}
+
+set_jffs_part() {
+ jffs=$(awk '/jffs2/ {print $2}' /proc/mounts)
+}
+
+determine_mtd_part() {
+ set_mtd_part
+ if [ -z "$mtdpart" ]; then
+ echo "MTD partition not found."
+ exit 1
+ fi
+}
+
+determine_rom_part() {
+ check_skip || {
+ set_rom_part
+ if [ -z "$rom" ]; then
+ echo "You do not have a squashfs partition; aborting"
+ echo "(firstboot cannot be run on jffs2 based firmwares)"
+ exit 1
+ fi
+ }
+}
+
+determine_jffs2_part() {
+ check_skip || {
+ set_jffs_part
+ }
+}
+
+boot_hook_add switch2jffs determine_mtd_part
+boot_hook_add jffs2reset determine_mtd_part
+boot_hook_add switch2jffs determine_rom_part
+boot_hook_add jffs2reset determine_rom_part
+boot_hook_add switch2jffs determine_jffs2_part
+boot_hook_add jffs2reset determine_jffs2_part