recovery: init script mount fixes
- Added a 5 seconds delay before mounting external disks so they have time to be recognized in the system. - Check if UBI volume is mounted before formatting it. - Check if eMMC block device exists before formatting it. Signed-off-by: David Escalona <david.escalona@digi.com>
This commit is contained in:
parent
047849b848
commit
f4ece3821e
|
|
@ -248,6 +248,12 @@ format_ubi_volume() {
|
|||
if [ -z "${mtd_num}" ]; then
|
||||
quit_with_error "Could not find MTD partition for volume '${1}'"
|
||||
else
|
||||
# Umount in case partition is mounted, ignore errors.
|
||||
if grep -qs "${1}" /proc/mounts; then
|
||||
local path="$(sed -ne "s/.*:${1} \(.*\) ubifs.*/\1/g;T;p" /proc/mounts 2>/dev/null)"
|
||||
umount "${path}" >/dev/null 2>&1
|
||||
ubidetach -p "/dev/mtd${mtd_num}" >/dev/null 2>&1
|
||||
fi
|
||||
# Format MTD partition.
|
||||
ubiformat "/dev/mtd${mtd_num}" >/dev/null 2>&1
|
||||
if [ "$?" != "0" ]; then
|
||||
|
|
@ -277,6 +283,7 @@ format_ubi_volume() {
|
|||
format_emmc_block() {
|
||||
# Find partition block number.
|
||||
local partition_block="/dev/mmcblk0p$(parted -s /dev/mmcblk0 print | sed -ne "s,^[^0-9]*\([0-9]\+\).*\<${1}\>.*,\1,g;T;p")"
|
||||
if [ -b "${partition_block}" ]; then
|
||||
# Umount in case partition is mounted, ignore errors.
|
||||
if grep -qs "${partition_block}" /proc/mounts; then
|
||||
umount "${partition_block}" >/dev/null 2>&1
|
||||
|
|
@ -288,6 +295,9 @@ format_emmc_block() {
|
|||
else
|
||||
quit_with_error "Error erasing '${1}' partition"
|
||||
fi
|
||||
else
|
||||
quit_with_error "Could not find partition block for '${1}'"
|
||||
fi
|
||||
}
|
||||
|
||||
# Main
|
||||
|
|
@ -376,6 +386,7 @@ if [ -n "${update_package_bool}" ]; then
|
|||
else
|
||||
log "Update package location: ${update_package}"
|
||||
# Mount external disks.
|
||||
sleep 5
|
||||
mount_external_disks
|
||||
# Mount update partition.
|
||||
mount_partition update "${UPDATE_MOUNT_DIR}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue