summaryrefslogtreecommitdiffstats
path: root/src/cmd
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-01-23 14:25:27 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-01-23 14:32:05 (EST)
commitac643e5ca41743fc4fa320308648b1a8d90804e5 (patch)
tree7ae3a75b68d6b359d4cc309ed98b867784684ba2 /src/cmd
parentdfd0c5352252189f39fefb1083f5a3c4bafb387d (diff)
cmd/installer-pc: Check exit status of dd, (s)fdisk, and mke2fs
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/installer-pc.sh25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/cmd/installer-pc.sh b/src/cmd/installer-pc.sh
index ce155f3..595e9c9 100644
--- a/src/cmd/installer-pc.sh
+++ b/src/cmd/installer-pc.sh
@@ -67,7 +67,9 @@ cmd_installer_pc_main()
fi
suite="$(profile_normalize_suite "${suite}")"
- cmd_installer_pc_make_partition_and_fs "${dev}"
+ if ! cmd_installer_pc_make_partition_and_fs "${dev}"; then
+ return 2
+ fi
if ! root="$(block_mount "${dev}1")"; then
return 2
fi
@@ -104,13 +106,26 @@ cmd_installer_pc_make_partition_and_fs()
{
local dev="${1}"
- dd if=/dev/zero of="${dev}" bs=512 count=1
+ if ! dd if=/dev/zero of="${dev}" bs=512 count=1; then
+ return 1
+ fi
+
if ${HAVE_SFDISK}; then
- printf ',,83,*\n' | ${SFDISK} "${dev}"
+ if ! printf ',,83,*\n' | ${SFDISK} "${dev}"; then
+ return 1
+ fi
elif ${HAVE_FDISK}; then
- printf 'n\np\n1\n\n\nt\n83\na\n1\nw\n' | ${FDISK} "${dev}"
+ if ! printf 'n\np\n1\n\n\nt\n83\na\n1\nw\n' | ${FDISK} "${dev}"
+ then
+ return 1
+ fi
+ fi
+
+ if ! ${MKE2FS} -t ext4 "${dev}1"; then
+ return 1
fi
- ${MKE2FS} -t ext4 "${dev}1"
+
+ return 0
}
cmd_installer_pc_register()