copy opk to /mnt/apps if it does not exist yet

Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
This commit is contained in:
Michel-FK 2020-12-12 19:24:32 +01:00
parent 3fb448651c
commit 9d371bdcc1
1 changed files with 20 additions and 4 deletions

View File

@ -9,20 +9,36 @@ root_mount=/tmp/rootfs
do_preinst()
{
notif " 1/3 EXTRACT FIRMWARE UPDATE..^DO NOT TURN OFF THE CONSOLE"
notif " 1/4 EXTRACT FIRMWARE UPDATE..^DO NOT TURN OFF THE CONSOLE"
exit 0
}
do_postinst()
{
notif " 2/3 RESIZE ROOT FILESYSTEM^DO NOT TURN OFF THE CONSOLE"
notif " 2/4 RESIZE ROOT FILESYSTEM^DO NOT TURN OFF THE CONSOLE"
resize2fs ${root_part}
if [ $? -ne 0 ]; then
notif " CANNOT RESIZE ROOT ^FILESYSTEM"
notif " CANNOT RESIZE ROOT^FILESYSTEM"
exit 1
fi
notif " 3/4 COPY OPKS TO USB MOUNT^DO NOT TURN OFF THE CONSOLE"
if [ ! -d /mnt/apps ]; then
mkdir -p /mnt/apps
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 /mnt/apps/
umount ${root_mount}
if [ $? -ne 0 ]; then
notif "CANNOT UNMOUNT ROOT^FILESYSTEM"
exit 1
fi
fi
for file in $(ls /mnt/FunKey-*.fwu); do
notif " 3/3 ERASE UPDATE FILE^DO NOT TURN OFF THE CONSOLE"
notif " 4/4 ERASE UPDATE FILE^DO NOT TURN OFF THE CONSOLE"
rm -f "${file}"
done
exit 0