2020-10-25 21:04:47 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Update partition script
|
|
|
|
|
|
|
|
source /usr/local/lib/utils
|
|
|
|
|
|
|
|
root_part_num=2
|
|
|
|
root_part=/dev/mmcblk0p${root_part_num}
|
|
|
|
root_mount=/tmp/rootfs
|
|
|
|
|
|
|
|
do_preinst()
|
|
|
|
{
|
2021-03-01 22:23:34 +00:00
|
|
|
notif " 1/5 EXTRACT FIRMWARE UPDATE..^DO NOT TURN OFF THE CONSOLE"
|
2020-10-25 21:04:47 +00:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
do_postinst()
|
|
|
|
{
|
2021-03-01 22:23:34 +00:00
|
|
|
notif " 2/5 FIX RECOVERY GPIO MANAGER"
|
|
|
|
rw
|
|
|
|
cp -a /tmp/funkey_gpio_management /usr/local/sbin/
|
|
|
|
chmod +x /usr/local/sbin/funkey_gpio_management
|
|
|
|
ro
|
|
|
|
notif " 3/5 RESIZE ROOT FILESYSTEM^DO NOT TURN OFF THE CONSOLE"
|
2020-10-31 23:49:56 +00:00
|
|
|
resize2fs ${root_part}
|
2020-10-25 21:04:47 +00:00
|
|
|
if [ $? -ne 0 ]; then
|
2020-12-12 18:24:32 +00:00
|
|
|
notif " CANNOT RESIZE ROOT^FILESYSTEM"
|
2020-11-16 09:10:47 +00:00
|
|
|
exit 1
|
2020-11-12 21:30:23 +00:00
|
|
|
fi
|
2021-03-01 22:23:34 +00:00
|
|
|
notif " 4/5 COPY OPKS TO USB MOUNT^DO NOT TURN OFF THE CONSOLE"
|
2021-01-15 14:02:18 +00:00
|
|
|
folder_opks_emulators=/mnt/Emulators
|
|
|
|
if [ ! -d "$folder_opks_emulators" ]; then
|
|
|
|
mkdir -p "$folder_opks_emulators"
|
|
|
|
mkdir -p ${root_mount}
|
|
|
|
mount -t ext4 ${root_part} ${root_mount}
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
notif "CANNOT MOUNT ROOT^FILESYSTEM"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
cp -f ${root_mount}/usr/games/opk/*.opk "$folder_opks_emulators"
|
|
|
|
umount ${root_mount}
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
notif "CANNOT UNMOUNT ROOT^FILESYSTEM"
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-12-12 18:24:32 +00:00
|
|
|
fi
|
2020-11-16 09:10:47 +00:00
|
|
|
for file in $(ls /mnt/FunKey-*.fwu); do
|
2021-03-01 22:23:34 +00:00
|
|
|
notif " 5/5 ERASE UPDATE FILE^DO NOT TURN OFF THE CONSOLE"
|
2020-11-16 09:10:47 +00:00
|
|
|
rm -f "${file}"
|
2020-10-31 23:49:56 +00:00
|
|
|
done
|
2020-10-25 21:04:47 +00:00
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
|
|
|
echo $0 $1
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
preinst)
|
|
|
|
do_preinst
|
|
|
|
;;
|
|
|
|
postinst)
|
|
|
|
do_postinst
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|