summaryrefslogtreecommitdiff
path: root/recipes-core/mlinux-scripts
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2017-10-06 14:20:12 -0500
committerJohn Klug <john.klug@multitech.com>2017-10-06 14:20:12 -0500
commitceea6086bae74bbdcb2af2b9cd40431b2ec13488 (patch)
tree323e58f78dc4eb1cd1303d20b8b2d85c518588f4 /recipes-core/mlinux-scripts
parentf09b3db8259a9bf3f7c798c621b14c9c44fc9b0d (diff)
downloadmeta-mlinux-ceea6086bae74bbdcb2af2b9cd40431b2ec13488.tar.gz
meta-mlinux-ceea6086bae74bbdcb2af2b9cd40431b2ec13488.tar.bz2
meta-mlinux-ceea6086bae74bbdcb2af2b9cd40431b2ec13488.zip
Add install script check and verify do_flas_upgrade root ownership
Diffstat (limited to 'recipes-core/mlinux-scripts')
-rwxr-xr-xrecipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-firmware-upgrade16
-rw-r--r--recipes-core/mlinux-scripts/mlinux-scripts_1.1.bb2
2 files changed, 15 insertions, 3 deletions
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-firmware-upgrade b/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-firmware-upgrade
index 94027d5..a377309 100755
--- a/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-firmware-upgrade
+++ b/recipes-core/mlinux-scripts/mlinux-scripts-1.1/mlinux-firmware-upgrade
@@ -1,4 +1,5 @@
#!/bin/bash
+dofile=/var/volatile/do_flash_upgrade
if [ $# != 1 ]; then
echo "Usage: $0 upgrade.bin"
@@ -22,7 +23,7 @@ if [[ ! "$hw_version" =~ ^$firmware_model- ]]; then
exit 1
fi
-files=(bstrap.bin uboot.bin uImage.bin config.jffs2 oem.jffs2 rootfs.jffs2)
+files=(bstrap.bin uboot.bin uImage.bin config.jffs2 oem.jffs2 rootfs.jffs2 install.sh)
tobeflashed=0
# verify all MD5 sums
@@ -46,7 +47,18 @@ done
if (( $tobeflashed )); then
mkdir -p /var/volatile/flash-upgrade
mv -f $upgrade /var/volatile/flash-upgrade/upgrade.bin
- touch /var/volatile/do_flash_upgrade
+ touch "${dofile}"
+ chown "root:root" "${dofile}" || true
+ uid=$(stat -c %u "${dofile}") || true
+ result=$?
+ if ((result != 0)) ; then
+ logger -s -t firmware_upgrade "Cannot create ${dofile}"
+ exit 1
+ fi
+ if ((uid != 0)) ; then
+ logger -s -t firmware_upgrade "Cannot set ownership of ${dofile} to root"
+ exit 1
+ fi
logger -s -t firmware_upgrade "Rebooting"
sleep 1
reboot
diff --git a/recipes-core/mlinux-scripts/mlinux-scripts_1.1.bb b/recipes-core/mlinux-scripts/mlinux-scripts_1.1.bb
index 43dc162..338b62f 100644
--- a/recipes-core/mlinux-scripts/mlinux-scripts_1.1.bb
+++ b/recipes-core/mlinux-scripts/mlinux-scripts_1.1.bb
@@ -2,6 +2,6 @@ DESCRIPTION = "Scripts to easily get started with common mLinux use cases"
require mlinux-scripts.inc
-PR = "r2"
+PR = "r3"
S = "${WORKDIR}/mlinux-scripts-${PV}"