aboutsummaryrefslogtreecommitdiffstats
path: root/setupdisk.sh
diff options
context:
space:
mode:
authorWilliam Harrington <kb0iic@berzerkula.org>2021-04-02 10:37:30 -0500
committerWilliam Harrington <kb0iic@berzerkula.org>2021-04-02 10:37:30 -0500
commit8999cb53387e2007d755d345e452dd9bd65c267f (patch)
tree63f5bf13fca429753455b0b86d3f6ea393eaab76 /setupdisk.sh
parent48c1619900e36297e9ac36bd1294f396e954ccfb (diff)
Exit when creating partition or filesystem fails. Use LFS_FS variable from env.sh so user can decide which filesystem to use.
Diffstat (limited to 'setupdisk.sh')
-rw-r--r--setupdisk.sh14
1 files changed, 11 insertions, 3 deletions
diff --git a/setupdisk.sh b/setupdisk.sh
index 569cb2d..d9bd8d7 100644
--- a/setupdisk.sh
+++ b/setupdisk.sh
@@ -20,7 +20,15 @@ p
w
q
EOF
-
+if [[ "$?" -ne 0 ]]; then
+ printf "%b" " ${IGRN}Creating partition ${IWHT}${LFS_DISK}${LFS_PART} \
+${IRED}FAILED!${RST}\n"
+ exit 1
+fi
printf "%b" " ${IGRN}Formatting ${IWHT}${LFS_DISK}${LFS_PART} with \
-${YLW}EXT4${IGRN} filesystem and label ${IWHT}${LFS_VER}${RST}\n"
-sudo /sbin/mkfs -t ext4 -L "${LFS_VER}" -F "${LFS_DISK}${LFS_PART}" >/dev/null 2>&1
+${IWHT}${LFS_FS}${IGRN} filesystem and label ${IWHT}${LFS_VER}${RST}\n"
+if ! sudo /sbin/mkfs -t ${LFS_FS} -L "${LFS_VER}" -F "${LFS_DISK}${LFS_PART}" >/dev/null 2>&1; then
+ printf "%b" " ${IGRN}Creating ${IWHT}${LFS_FS}${IGRN} filesystem at \
+${IWHT}${LFS_DISK}${LFS_PART} ${IRED}FAILED!${RST}\n"
+ exit 1
+fi