gcc: remove arch default duplication, fix version selection for !TOOLCHAINOPTS
[openwrt.git] / package / block-extroot / files / 55_determine_extroot_sysupgrade
1 #!/bin/sh
2 # Copyright (C) 2010 Daniel Dickinson
3 # This is free software, licensed under the GNU General Public License v2.
4 # See /LICENSE for more information.
5
6
7 check_set_md5sum() {
8 local er_md5sum_file
9 er_md5sum_file="${ER_OVERLAY_PREFIX}/.extroot.md5sum"
10
11 local er_extroot_md5sum
12 if [ -f $md5sum_file ]; then
13 er_extroot_md5sum="$(cat $er_md5sum_file)"
14 fi
15
16 local er_overlay_file="/overlay/etc/extroot.md5sum"
17
18 local er_extroot_overlay_md5sum
19 if [ -f "$er_overlay_file" ]; then
20 er_extroot_overlay_md5sum="$(cat $er_overlay_file)"
21 fi
22
23 if [ -z "$er_extroot_overlay_md5sum" ]; then
24 cat $er_md5sum_file >$er_overlay_file
25 elif [ "$er_extroot_overlay_md5sum" != "$er_extroot_md5sum" ]; then
26 pi_extroot_mount_success="false"
27 mkdir -p /tmp/overlay-disabled
28 mount --move /overlay /tmp/overlay-disabled
29 fi
30 }
31
32 set_jffs_md5sum() {
33 # We do this anytime block-extroot exists, even on the first boot with
34 # no extroot defined.
35
36 local er_md5sum_file
37 er_md5sum_file="${ER_OVERLAY_PREFIX}/.extroot.md5sum"
38
39 local er_extroot_md5sum
40 if [ -f $er_md5sum_file ]; then
41 er_extroot_md5sum="$(cat $er_md5sum_file)"
42 fi
43 if [ -z "$er_extroot_md5sum" ]; then
44 dd if=/dev/urandom count=32 bs=1k 2>/dev/null | md5sum | cut -f1 -d\ >$er_md5sum_file
45 fi
46 }
47
48 determine_extroot_sysupgrade() {
49 check_skip || set_jffs_md5sum
50
51 check_skip || [ "$pi_extroot_mount_success" != "true" ] || {
52 check_set_md5sum
53 }
54 }
55
56 boot_hook_add preinit_mount_root determine_extroot_sysupgrade
57
This page took 0.052538 seconds and 5 git commands to generate.