dualboot: run the script only in dualboot systems
Signed-off-by: Francisco Gil <francisco.gilmartinez@digi.com>
This commit is contained in:
parent
6ffbbb390a
commit
0328295ea8
|
|
@ -14,35 +14,37 @@
|
||||||
#===============================================================================
|
#===============================================================================
|
||||||
|
|
||||||
dualboot_init () {
|
dualboot_init () {
|
||||||
ACTIVE_SYSTEM="$(fw_printenv -n active_system 2>/dev/null)"
|
if [ "$(fw_printenv -n dualboot 2>/dev/null)" = "yes" ]; then
|
||||||
if [ -z "${ACTIVE_SYSTEM}" ]; then
|
echo -n "Starting dualboot check: "
|
||||||
if grep -qs environment /proc/mtd; then
|
ACTIVE_SYSTEM="$(fw_printenv -n active_system 2>/dev/null)"
|
||||||
MTD_BOOT_PART="$(fw_printenv -n mtdbootpart 2>/dev/null)"
|
if [ -z "${ACTIVE_SYSTEM}" ]; then
|
||||||
fw_setenv active_system "${MTD_BOOT_PART}"
|
if grep -qs environment /proc/mtd; then
|
||||||
else
|
MTD_BOOT_PART="$(fw_printenv -n mtdbootpart 2>/dev/null)"
|
||||||
BOOT_PART="$(fw_printenv -n mmcpart 2>/dev/null)"
|
fw_setenv active_system "${MTD_BOOT_PART}"
|
||||||
BOOT_DEV="$(fw_printenv -n mmcbootdev 2>/dev/null)"
|
else
|
||||||
CURRENT_PART="$(ls -l /dev/disk/by-partlabel/ | grep -i mmcblk${BOOT_DEV}p${BOOT_PART} | awk '{print $9}')"
|
BOOT_PART="$(fw_printenv -n mmcpart 2>/dev/null)"
|
||||||
fw_setenv active_system "${CURRENT_PART}"
|
BOOT_DEV="$(fw_printenv -n mmcbootdev 2>/dev/null)"
|
||||||
|
CURRENT_PART="$(sed -ne 's,PARTNAME=,,g;T;p' /sys/class/block/mmcblk"${BOOT_DEV}"p"${BOOT_PART}"/uevent)"
|
||||||
|
fw_setenv active_system "${CURRENT_PART}"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
ISUPGRADING="$(fw_printenv -n upgrade_available 2>/dev/null)"
|
ISUPGRADING="$(fw_printenv -n upgrade_available 2>/dev/null)"
|
||||||
|
|
||||||
if [ "$ISUPGRADING" = "1" ]; then
|
if [ "$ISUPGRADING" = "1" ]; then
|
||||||
BOOTCOUNT="$(fw_printenv -n bootcount 2>/dev/null)"
|
BOOTCOUNT="$(fw_printenv -n bootcount 2>/dev/null)"
|
||||||
if [ "${BOOTCOUNT}" -lt 3 ]; then
|
if [ "${BOOTCOUNT}" -lt 3 ]; then
|
||||||
fw_setenv upgrade_available
|
fw_setenv upgrade_available
|
||||||
fw_setenv bootcount 0
|
fw_setenv bootcount 0
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
echo "done."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
echo -n "Starting dualboot check: "
|
|
||||||
dualboot_init
|
dualboot_init
|
||||||
echo "done."
|
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
;;
|
;;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue