update updates misc if anything changed
This commit is contained in:
parent
6e7732c796
commit
faeff1759c
2 changed files with 34 additions and 1 deletions
1
makefile
1
makefile
|
|
@ -54,6 +54,7 @@ bundle:
|
|||
|
||||
cp ./src/boot/output/dmenu.bin ./build/BASE
|
||||
cp ./src/boot/output/dmenu.bin ./build/SYSTEM/rg35xx/dat
|
||||
echo "$(BUILD_HASH)" > ./build/SYSTEM/commit.txt
|
||||
|
||||
# populate system
|
||||
cp ~/buildroot/output/images/rootfs.ext2 ./build/SYSTEM/rg35xx
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ fi
|
|||
|
||||
# is there an update available?
|
||||
if [ -f $UPDATE_PATH ]; then
|
||||
{
|
||||
FLAG_PATH=/misc/.minstalled
|
||||
if [ ! -f $FLAG_PATH ]; then
|
||||
ACTION=installing
|
||||
|
|
@ -51,6 +52,8 @@ if [ -f $UPDATE_PATH ]; then
|
|||
dd if=/tmp/$ACTION of=/dev/fb0
|
||||
sync
|
||||
|
||||
# TODO: move this logic into MinUI.zip contents?
|
||||
|
||||
busybox unzip -o $UPDATE_PATH -d $SDCARD_PATH
|
||||
rm -f $UPDATE_PATH
|
||||
if [ ! -f $FLAG_PATH ]; then
|
||||
|
|
@ -60,15 +63,44 @@ if [ -f $UPDATE_PATH ]; then
|
|||
cp /misc/boot_logo.bmp.gz $BAK_PATH
|
||||
cp /misc/kernel.dtb $BAK_PATH
|
||||
cp /misc/uImage $BAK_PATH
|
||||
fi
|
||||
|
||||
was_updated() {
|
||||
for FILE in /misc/* /misc/*/*; do
|
||||
A_PATH=$FILE
|
||||
B_PATH=$SYSTEM_PATH/dat/$(busybox basename "$A_PATH")
|
||||
|
||||
if [ ! -f "$B_PATH" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
A_SUM=$(busybox md5sum $A_PATH | busybox cut -d ' ' -f 1)
|
||||
B_SUM=$(busybox md5sum $B_PATH | busybox cut -d ' ' -f 1)
|
||||
|
||||
if [[ "$A_SUM" != "$B_SUM" ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
if [ ! -f $FLAG_PATH ] || was_updated; then
|
||||
echo "updating misc partition"
|
||||
mount -o remount,rw /dev/block/actb /misc
|
||||
rm -f /misc/uImage
|
||||
cp $SYSTEM_PATH/dat/uImage /misc
|
||||
cp $SYSTEM_PATH/dat/boot_logo.bmp.gz /misc
|
||||
cp $SYSTEM_PATH/dat/dmenu.bin /misc
|
||||
if [ ! -f $FLAG_PATH ]; then
|
||||
# only replace boot logo on install not update
|
||||
cp $SYSTEM_PATH/dat/boot_logo.bmp.gz /misc
|
||||
fi
|
||||
cp $SYSTEM_PATH/dat/kernel.dtb /misc
|
||||
cp $SYSTEM_PATH/dat/gpio_keys_polled.ko /misc/modules
|
||||
touch $FLAG_PATH
|
||||
sync && reboot
|
||||
fi
|
||||
} &> /mnt/sdcard/install.txt
|
||||
fi
|
||||
|
||||
ROOTFS_IMAGE=$SYSTEM_PATH/rootfs.ext2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue