From c8f149db95f96d029e55a1142542fd57c57e4cd7 Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 4 Oct 2017 17:37:31 -0500 Subject: New package update via tarball --- recipes-core/initscripts/initscripts-1.0/umountfs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'recipes-core/initscripts/initscripts-1.0') diff --git a/recipes-core/initscripts/initscripts-1.0/umountfs b/recipes-core/initscripts/initscripts-1.0/umountfs index 300de4f..17b44cf 100644 --- a/recipes-core/initscripts/initscripts-1.0/umountfs +++ b/recipes-core/initscripts/initscripts-1.0/umountfs @@ -106,6 +106,7 @@ flash_upgrade() { local rootfs_file=rootfs.jffs2 local kernel_file=uImage.bin local uboot_file=uboot.bin + local install_file=install.sh if [ ! -d "${flash_dir}" ]; then echo "${flash_dir} not present, skipping" @@ -172,7 +173,7 @@ flash_upgrade() { cd /var/volatile # rootfs should always be flashed last, so always keep it last here - local files=(${bootstrap_file} ${uboot_file} ${config_file} ${oem_file} ${kernel_file} ${rootfs_file}) + local files=(${bootstrap_file} ${uboot_file} ${config_file} ${oem_file} ${kernel_file} ${rootfs_file} ${install_file}) local devs=(${bootstrap_mtd} ${uboot_mtd} ${config_mtd} ${oem_mtd} ${kernel_mtd} ${rootfs_mtd}) if [ -f "${upgrade_file}" ]; then @@ -189,6 +190,7 @@ flash_upgrade() { fi echo "Checking MD5s" + ((upgrade_script=0)) # check md5sum for (( i = 0; i < ${#files[@]}; i++ )); do local file=${files[i]} @@ -202,6 +204,11 @@ flash_upgrade() { return fi fi + # Extract files early if we are going to + # execute the upgrade script. + if [[ ${file} == ${install_file} ]] ; then + ((upgrade_script=1)) + fi done fi @@ -237,6 +244,18 @@ flash_upgrade() { err_leds return 1 fi + + # Run the upgrade script, if it exists, before we change + # flash-root to read-only + if ((upgrade_script == 1)) ; then + if (cd ${flash_dir};tar -xf ${upgrade_file}) ; then + exec ${flash_dir}/${install_file} ${flash_root} + else + echo "Extraction of ${upgrade_file} failed" + echo "Upgrade aborted" + umount_all + fi + fi sync sleep 2 mount -o remount,ro ${flash_root} -- cgit v1.2.3