summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-01-23 18:24:54 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-01-23 18:24:54 (EST)
commit0e5897958196a6d5748973e0cce5c6e2cef9dbd5 (patch)
tree55b6c5d9e69d5975d3194ae5cdbdb00cf56f4d50
parent120579750ee34fe4d43be87e41bf1ea4a58a84d9 (diff)
cmd/installer-pc: Print error on dd, (s)fdisk, or mke2fs failure
-rw-r--r--locale/en_US.sh3
-rw-r--r--src/cmd/installer-pc.sh4
2 files changed, 7 insertions, 0 deletions
diff --git a/locale/en_US.sh b/locale/en_US.sh
index 1cd4695..cb5fe5d 100644
--- a/locale/en_US.sh
+++ b/locale/en_US.sh
@@ -105,6 +105,9 @@ msg_prokit_cmd_build_not_a_dir='Not a directory: %s'
msg_prokit_cmd_installer_pc_summary='install a PC system onto a block device'
msg_prokit_cmd_installer_pc_usage='-a <arch> -p <plat> [-m <mirror>] '\
'<suite> <device>'
+msg_prokit_cmd_installer_pc_dd_fail='Failed to clear MBR and partition table'
+msg_prokit_cmd_installer_pc_fdisk_fail='Failed to create partition table'
+msg_prokit_cmd_installer_pc_mkfs_fail='Failed to create file system'
# src/cmd/mkinitramfs.sh
msg_prokit_cmd_mkinitramfs_summary='generate an initramfs containing an '\
diff --git a/src/cmd/installer-pc.sh b/src/cmd/installer-pc.sh
index 848af10..c0162cc 100644
--- a/src/cmd/installer-pc.sh
+++ b/src/cmd/installer-pc.sh
@@ -107,21 +107,25 @@ cmd_installer_pc_make_partition_and_fs()
local dev="${1}"
if ! dd if=/dev/zero of="${dev}" bs=512 count=1; then
+ error "$(get_msg 'cmd_installer_pc_dd_fail')"
return 1
fi
if ${HAVE_SFDISK}; then
if ! printf ',,83,*\n' | ${SFDISK} "${dev}"; then
+ error "$(get_msg 'cmd_installer_pc_fdisk_fail')"
return 1
fi
elif ${HAVE_FDISK}; then
if ! printf 'n\np\n1\n\n\nt\n83\na\n1\nw\n' | ${FDISK} "${dev}"
then
+ error "$(get_msg 'cmd_installer_pc_fdisk_fail')"
return 1
fi
fi
if ! ${MKE2FS} -t ext4 "${dev}1"; then
+ error "$(get_msg 'cmd_installer_pc_mkfs_fail')"
return 1
fi