disko-install: improve error message if disk is not passed

This commit is contained in:
Jörg Thalheim authored and mergify[bot] committed 2024-03-05 14:03:10 +00:00
1 parent 0d11aa8d64
commit cf185d687f
2 files changed
+15 -13

No files matched your search

+14 -12
View File
@@ -78,17 +78,17 @@ parseArgs() {
exit 1
fi
case $2 in
format)
diskoAttr=diskoScript
;;
mount)
diskoAttr=mountScript
;;
*)
echo "Invalid mode: $2" >&2
echo "Valid modes are: format, mount" >&2
exit 1
;;
format)
diskoAttr=diskoScript
;;
mount)
diskoAttr=mountScript
;;
*)
echo "Invalid mode: $2" >&2
echo "Valid modes are: format, mount" >&2
exit 1
;;
esac
mode=$2
shift
@@ -163,7 +163,7 @@ main() {
# shellcheck disable=SC2064
trap "cleanupMountPoint ${escapeMountPoint}" EXIT
IFS=$'\n' mapfile -t artifacts < <(nix-build "${libexec_dir}"/install-cli.nix \
outputs=$(nix-build "${libexec_dir}"/install-cli.nix \
"${nix_args[@]}" \
--no-out-link \
--impure \
@@ -174,6 +174,8 @@ main() {
--arg diskMappings "$(serialiaseArrayToNix diskMappings)" \
-A installToplevel \
-A "$diskoAttr")
IFS=$'\n' mapfile -t artifacts <<<"$outputs"
nixos_system=${artifacts[0]}
disko_script=${artifacts[1]}
+1 -1
View File
@@ -15,7 +15,7 @@ let
dev = if diskMappings ? ${name} then
diskMappings.${name}
else
throw "No device passed for disk '${name}'";
throw "No device passed for disk '${name}'. Pass `--disk ${name} /dev/name` via commandline";
in value // {
device = dev;
content = value.content // { device = dev; };