mirror of
https://github.com/openwrt/openwrt.git
synced 2025-01-20 03:36:29 +00:00
mvebu/uDPU: remove $? usage
shellcheck warns against it with SC2086. It also hides a bug that shellcheck marks with SC2015. Fixed those with explicit if/else. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
3b80b8e560
commit
cb6df29cbd
@ -42,8 +42,11 @@ udpu_do_part_check() {
|
|||||||
# Format the /misc part right away as we will need it for the firmware
|
# Format the /misc part right away as we will need it for the firmware
|
||||||
printf "Formating /misc partition, this make take a while..\n"
|
printf "Formating /misc partition, this make take a while..\n"
|
||||||
udpu_part_prep ${emmc_dev}p4
|
udpu_part_prep ${emmc_dev}p4
|
||||||
mkfs.f2fs -q -l misc ${emmc_dev}p4
|
if mkfs.f2fs -q -l misc ${emmc_dev}p4; then
|
||||||
[ $? -eq 0 ] && printf "/misc partition formated successfully\n" || printf "/misc partition formatting failed\n"
|
printf "/misc partition formated successfully\n"
|
||||||
|
else
|
||||||
|
printf "/misc partition formatting failed\n"
|
||||||
|
fi
|
||||||
|
|
||||||
udpu_do_initial_setup
|
udpu_do_initial_setup
|
||||||
else
|
else
|
||||||
@ -54,19 +57,17 @@ udpu_do_part_check() {
|
|||||||
udpu_do_misc_prep() {
|
udpu_do_misc_prep() {
|
||||||
if ! grep -woq /misc /proc/mounts; then
|
if ! grep -woq /misc /proc/mounts; then
|
||||||
mkdir -p /misc
|
mkdir -p /misc
|
||||||
mount ${emmc_dev}p4 /misc
|
|
||||||
|
|
||||||
# If the mount fails, try to reformat partition
|
# If the mount fails, try to reformat partition
|
||||||
# Leaving possiblity for multiple iterations
|
# Leaving possiblity for multiple iterations
|
||||||
if [ $? -ne 0 ]; then
|
if ! mount ${emmc_dev}p4 /misc; then
|
||||||
printf "Error while mounting /misc, trying to reformat..\n"
|
printf "Error while mounting /misc, trying to reformat..\n"
|
||||||
|
|
||||||
format_count=0
|
format_count=0
|
||||||
while [ "$format_count" -lt "1" ]; do
|
while [ "$format_count" -lt "1" ]; do
|
||||||
udpu_part_prep ${emmc_dev}p4
|
udpu_part_prep ${emmc_dev}p4
|
||||||
mkfs.f2fs -q -l misc ${emmc_dev}p4
|
mkfs.f2fs -q -l misc ${emmc_dev}p4
|
||||||
mount ${emmc_dev}p4 /misc
|
if ! mount ${emmc_dev}p4 /misc; then
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
umount -l /misc
|
umount -l /misc
|
||||||
printf "Failed while mounting /misc\n"
|
printf "Failed while mounting /misc\n"
|
||||||
format_count=$((format_count +1))
|
format_count=$((format_count +1))
|
||||||
@ -91,8 +92,7 @@ udpu_do_initial_setup() {
|
|||||||
# Prepare /root partition
|
# Prepare /root partition
|
||||||
printf "Formating /root partition, this may take a while..\n"
|
printf "Formating /root partition, this may take a while..\n"
|
||||||
udpu_part_prep ${emmc_dev}p3
|
udpu_part_prep ${emmc_dev}p3
|
||||||
mkfs.f2fs -q -l rootfs ${emmc_dev}p3
|
mkfs.f2fs -q -l rootfs ${emmc_dev}p3 && printf "/root partition reformated\n"
|
||||||
[ $? -eq 0 ] && printf "/root partition reformated\n"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
udpu_do_regular_upgrade() {
|
udpu_do_regular_upgrade() {
|
||||||
@ -122,13 +122,19 @@ platform_do_upgrade_uDPU() {
|
|||||||
udpu_do_regular_upgrade
|
udpu_do_regular_upgrade
|
||||||
|
|
||||||
printf "Updating /boot partition\n"
|
printf "Updating /boot partition\n"
|
||||||
tar xzf /misc/firmware/boot.tgz -C /tmp/boot
|
if tar xzf /misc/firmware/boot.tgz -C /tmp/boot; then
|
||||||
[ $? -eq 0 ] && printf "/boot partition updated successfully\n" || printf "/boot partition update failed\n"
|
printf "/boot partition updated successfully\n"
|
||||||
|
else
|
||||||
|
printf "/boot partition update failed\n"
|
||||||
|
fi
|
||||||
sync
|
sync
|
||||||
|
|
||||||
printf "Updating /root partition\n"
|
printf "Updating /root partition\n"
|
||||||
tar xzf /misc/firmware/rootfs.tgz -C /tmp/rootpart
|
if tar xzf /misc/firmware/rootfs.tgz -C /tmp/rootpart; then
|
||||||
[ $? -eq 0 ] && printf "/root partition updated successfully\n" || printf "/root partition update failed\n"
|
printf "/root partition updated successfully\n"
|
||||||
|
else
|
||||||
|
printf "/root partition update failed\n"
|
||||||
|
fi
|
||||||
sync
|
sync
|
||||||
|
|
||||||
# Saving configuration files over sysupgrade
|
# Saving configuration files over sysupgrade
|
||||||
|
Loading…
Reference in New Issue
Block a user