diff --git a/src/Core/System/RootFS/sbin/firmware_upgrade.sh b/src/Core/System/RootFS/sbin/firmware_upgrade.sh index 089aacbb..734b27e1 100644 --- a/src/Core/System/RootFS/sbin/firmware_upgrade.sh +++ b/src/Core/System/RootFS/sbin/firmware_upgrade.sh @@ -36,7 +36,7 @@ fi # Global variables ENV_FILE=".env" if [ -f "$ENV_FILE" ]; then - export $(cat "$ENV_FILE" | grep -v '^#' | xargs) + export $(xargs < "$ENV_FILE"); fi # mountDiskPart: Mounts a disk partition by UUID. diff --git a/src/Core/System/RootFS/sbin/initial_storage_part_four b/src/Core/System/RootFS/sbin/initial_storage_part_four index 3e67a660..3eb2d3fc 100644 --- a/src/Core/System/RootFS/sbin/initial_storage_part_four +++ b/src/Core/System/RootFS/sbin/initial_storage_part_four @@ -117,9 +117,13 @@ done # If the partition was successfully created if [ "$resultParted" = "0" ];then if [ "$action" = "create" ]; then - /sbin/mkfs.ext4 -qF "${partitionFour}" + echo " - start mkfs.ext4 $partitionFour..."; + /sbin/mkfs.ext4 -qF "$partitionFour" + echo " - result $?..."; sleep 5; - resize2fs ${partitionFour} + echo " - start resize2fs $partitionFour..."; + resize2fs "$partitionFour" + echo " - result $?..."; sleep 5; fi @@ -137,6 +141,7 @@ if [ "$resultParted" = "0" ];then if [ "$mountResult" != "0" ]; then echo " - start check ${partitionFour}..."; /sbin/fsck.ext4 -p "$partitionFour"; + echo " - result $?..."; mount -t "$type" "${partitionFour}" "$tmp_dir" 2> /dev/null > /dev/null; mountResult=$?; fi; diff --git a/src/Core/System/RootFS/sbin/pbx_firmware b/src/Core/System/RootFS/sbin/pbx_firmware index eeab980b..08fabfc3 100644 --- a/src/Core/System/RootFS/sbin/pbx_firmware +++ b/src/Core/System/RootFS/sbin/pbx_firmware @@ -148,10 +148,12 @@ if [ -r "${img_file}" ]; then fi fi + part4Action='create'; if [ -n "$partitionFour" ]; then export FS_BACKUP_PART4=fs-backup-part4.img; echo " - Start backup fs $FS_BACKUP_PART4 super block for part4 ($partitionFour)" dd if="$partitionFour" of="$FS_BACKUP_PART4" bs=1M count=1 >/dev/null 2>&1; + part4Action='update'; fi echo " - Installing new image on $DISK" @@ -178,7 +180,7 @@ if [ -r "${img_file}" ]; then echo " - The execution of the dd command was finished..."; # Update the partition table - /sbin/initial_storage_part_four update "$DISK"; + /sbin/initial_storage_part_four "$part4Action" "$DISK"; echo " - Check if it necessary to update 4-th storage partition. The result is ${?}..."; fi diff --git a/src/Core/System/RootFS/sbin/pbx_replace_fake_img.sh b/src/Core/System/RootFS/sbin/pbx_replace_fake_img.sh index 8632a0c2..8285b67c 100644 --- a/src/Core/System/RootFS/sbin/pbx_replace_fake_img.sh +++ b/src/Core/System/RootFS/sbin/pbx_replace_fake_img.sh @@ -17,31 +17,29 @@ # ENV_FILE=".env" -# vars UUID_STORAGE, UPDATE_IMG_FILE in ENV_FILE +# vars STORAGE_UUID, UPDATE_IMG_FILE in ENV_FILE if [ -f "$ENV_FILE" ]; then - export $(cat "$ENV_FILE" | grep -v '^#' | xargs) + export $(xargs < "$ENV_FILE"); fi # Задание переменных MOUNT_DIR="/mnt" STORAGE_DIR="/storage/usbdisk1" -UPDATE_IMG_FILE_PATH="$UPDATE_IMG_FILE" -RAW_IMG_FILE="${UPDATE_IMG_FILE_PATH}_D.raw" -UUID_STORAGE="$STORAGE_UUID" FIRMWARE_IMG_PATH="/mnt/firmware.img" +RAW_IMG_FILE="${UPDATE_IMG_FILE}_D.raw" # Создание необходимых директорий mkdir -p "$MOUNT_DIR" "$STORAGE_DIR" echo " - mount storage for upgrade" -mount -rw UUID="$UUID_STORAGE" "$STORAGE_DIR" 2> /dev/null +mount -rw UUID="$STORAGE_UUID" "$STORAGE_DIR" 2> /dev/null MOUNT_RESULT=$? if [ "$MOUNT_RESULT" -ne 0 ]; then - echo " - Fail mount storage with UUID=$UUID_STORAGE to $STORAGE_DIR ..." + echo " - Fail mount storage with UUID=$STORAGE_UUID to $STORAGE_DIR ..." exit 1 fi echo " - unpack image file to raw format" -gunzip -c "$UPDATE_IMG_FILE_PATH" > "$RAW_IMG_FILE" +/bin/busybox gunzip -c "$UPDATE_IMG_FILE" > "$RAW_IMG_FILE" loopName="$(losetup --show -f -o 524288 "$RAW_IMG_FILE")" echo " - mount raw image file" @@ -55,7 +53,8 @@ fi if [ -f "$FIRMWARE_IMG_PATH" ]; then echo " - replace fake image file"; - cp "$FIRMWARE_IMG_PATH" "$UPDATE_IMG_FILE_PATH"; + /bin/busybox md5sum "$FIRMWARE_IMG_PATH" "$UPDATE_IMG_FILE"; + cp "$FIRMWARE_IMG_PATH" "$UPDATE_IMG_FILE"; else echo " - FAIL replace fake image file"; fi