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