2010-12-03 20:01:23 +00:00
|
|
|
#!/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_extroot_md5sum
|
|
|
|
if [ -f $md5sum_file ]; then
|
|
|
|
er_extroot_md5sum="$(cat $er_md5sum_file)"
|
|
|
|
fi
|
|
|
|
|
2011-03-13 09:24:24 +00:00
|
|
|
local er_overlay_file="${ER_OVERLAY_ROM}/etc/extroot.md5sum"
|
2011-02-01 06:28:59 +00:00
|
|
|
|
2010-12-03 20:01:23 +00:00
|
|
|
local er_extroot_overlay_md5sum
|
2011-02-01 06:28:59 +00:00
|
|
|
if [ -f "$er_overlay_file" ]; then
|
|
|
|
er_extroot_overlay_md5sum="$(cat $er_overlay_file)"
|
2010-12-03 20:01:23 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z "$er_extroot_overlay_md5sum" ]; then
|
2011-02-01 06:28:59 +00:00
|
|
|
cat $er_md5sum_file >$er_overlay_file
|
2010-12-03 20:01:23 +00:00
|
|
|
elif [ "$er_extroot_overlay_md5sum" != "$er_extroot_md5sum" ]; then
|
|
|
|
pi_extroot_mount_success="false"
|
2011-03-13 09:24:24 +00:00
|
|
|
mkdir -p /tmp${ER_OVERLAY_ROM}-disabled
|
|
|
|
mount --move ${ER_OVERLAY_ROM} /tmp${ER_OVERLAY_ROM}-disabled
|
2010-12-03 20:01:23 +00:00
|
|
|
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
|
|
|
|
|