Skip to content

Instantly share code, notes, and snippets.

@mcprat
Created June 26, 2020 03:31
Show Gist options
  • Save mcprat/8a48e5a0ee8d73c6812b9fc65ab6ae07 to your computer and use it in GitHub Desktop.
Save mcprat/8a48e5a0ee8d73c6812b9fc65ab6ae07 to your computer and use it in GitHub Desktop.
ENS202EXT OEM upgrade process pre-script
#!/bin/sh
rootfs_mtd="$(cat /proc/mtd | grep \"rootfs\" | cut -d : -f 1)"
rootfs_size="$(($( ( fw_printenv | grep ^rootfs_size= | cut -d = -f 2 ) 2>&- )))"
if [ ! -f "/rom/note" -a -n "${rootfs_mtd}" -a ${rootfs_size} -gt 0 ]; then
. /lib/functions/boot.sh &&
umount -l /jffs &&
pivot /rom /mnt &&
umount -l /mnt &&
{
dd if=/dev/${rootfs_mtd} of=/tmp/root.squashfs bs=${rootfs_size} count=1 &&
mount /tmp/root.squashfs /mnt &&
pivot /mnt /rom &&
umount -l /rom
} 2>&- || true &&
ramoverlay &&
[ -n "${flag_disable_umount}" ] && touch ${flag_disable_umount}
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment