mirror of
https://github.com/nix-community/disko.git
synced 2024-08-15 01:10:28 +03:00
disko-install: improve error message if disk is not passed
This commit is contained in:
parent
0d11aa8d64
commit
cf185d687f
@ -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]}
|
||||
|
||||
|
@ -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; };
|
||||
|
Loading…
Reference in New Issue
Block a user