hostcheck: apply suggestion from comment and replaced tab with spaces

Signed-off-by: Alessandro Comodi <acomodi@antmicro.com>
This commit is contained in:
Alessandro Comodi 2021-03-24 10:13:55 +01:00
parent 173bb3b34a
commit e418f024b9
1 changed files with 69 additions and 52 deletions

View File

@ -11,59 +11,76 @@ set -e
echo
echo "========================================"
echo "Check storage"
echo "Waiting for storage"
echo "----------------------------------------"
# Wait 30 seconds to not check the storage too early.
sleep 30
set -x +e
mount | grep /tmpfs
MOUNT_RET=$?
set +x -e
if [[ $MOUNT_RET != 0 ]] ; then
echo "----------------------------------------"
echo "Error: No storage is mounted on /tmpfs."
echo "----------------------------------------"
STORAGE_CHECK_ATTEMPTS=1
while true; do
# Check that tmpfs has been mounted correctly.
set -x +e
mount | grep /tmpfs
MOUNT_RET=$?
set +x -e
if [[ $MOUNT_RET == 0 ]] ; then
break;
else
echo "----------------------------------------"
echo "Error: No storage is mounted on /tmpfs."
echo "----------------------------------------"
echo ""
fi
echo "========================================"
echo "Dmesg dump"
echo "----------------------------------------"
dmesg
# Dump debugging information.
echo "========================================"
echo "Dmesg dump"
echo "----------------------------------------"
dmesg
echo "========================================"
echo "Partition information"
echo "----------------------------------------"
echo ""
echo "partprobe"
echo "----------------------------------------"
partprobe -s
echo ""
echo "cat /proc/partitions"
echo "----------------------------------------"
cat /proc/partitions
echo ""
echo "cat /etc/fstab"
echo "----------------------------------------"
cat /etc/fstab
echo ""
echo "cat /etc/mtab"
echo "----------------------------------------"
cat /etc/mtab
echo ""
echo "lsblk"
echo "----------------------------------------"
lsblk --list --output 'NAME,KNAME,FSTYPE,MOUNTPOINT,LABEL,UUID,PARTTYPE,PARTLABEL,PARTUUID'
echo ""
echo "sfdisk"
echo "----------------------------------------"
sudo sfdisk --list
echo ""
echo "systemctl | grep mount"
echo "----------------------------------------"
systemctl | grep mount
echo ""
echo "systemctl | grep dev"
echo "----------------------------------------"
systemctl | grep dev
echo "========================================"
echo "Partition information"
echo "----------------------------------------"
echo ""
echo "partprobe"
echo "----------------------------------------"
partprobe -s
echo ""
echo "cat /proc/partitions"
echo "----------------------------------------"
cat /proc/partitions
echo ""
echo "cat /etc/fstab"
echo "----------------------------------------"
cat /etc/fstab
echo ""
echo "cat /etc/mtab"
echo "----------------------------------------"
cat /etc/mtab
echo ""
echo "lsblk"
echo "----------------------------------------"
lsblk --list --output 'NAME,KNAME,FSTYPE,MOUNTPOINT,LABEL,UUID,PARTTYPE,PARTLABEL,PARTUUID'
echo ""
echo "sfdisk"
echo "----------------------------------------"
sudo sfdisk --list
echo ""
echo "systemctl | grep mount"
echo "----------------------------------------"
systemctl | grep mount
echo ""
echo "systemctl | grep dev"
echo "----------------------------------------"
systemctl | grep dev
exit $MOUNT_RET
fi
# Fail if we have waited to long.
if [[ $STORAGE_CHECK_ATTEMPTS -gt 5 ]]; then
exit $MOUNT_RET
else
STORAGE_CHECK_ATTEMPTS=$(( $STORAGE_CHECK_ATTEMPTS + 1 ))
fi
# Wait for a bit before rechecking.
SLEEP_FOR=$(( STORAGE_CHECK_ATTEMPTS * 10 ))
echo ""
echo "Sleeping for $SLEEP_FOR seconds before trying again..."
sleep $SLEEP_FOR
done