40 lines
863 B
Bash
Executable File
40 lines
863 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
ceph=true zfs=true
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
"-h" | "--help")
|
|
echo "Usage:"
|
|
echo "$0 [-h|--help] --disk /dev/sdx --name chaos [--no-ceph] [--no-zfs]"
|
|
exit 0
|
|
;;
|
|
"--disk")
|
|
disk=$2
|
|
shift
|
|
;;
|
|
"--name")
|
|
name=$2
|
|
shift
|
|
;;
|
|
"--no-ceph") ceph=false ;;
|
|
"--no-zfs") zfs=false ;;
|
|
*)
|
|
echo "Argument $1 is not understood."
|
|
exit 2
|
|
;;
|
|
esac
|
|
shift
|
|
done
|
|
|
|
if [[ -z ${disk:-} || -z ${name:-} ]]; then
|
|
echo "--disk and --name must be supplied!"
|
|
exit 1
|
|
fi
|
|
|
|
|
|
# TODO: wait for https://github.com/nix-community/disko/pull/211 to be merged
|
|
sudo nix run github:SuperSandro2000/disko/zpool-R -- --mode zap_create ./disko-config.nix --debug \
|
|
--arg disk '"'"$disk"'"' --arg name '"'"$name"'"' \
|
|
--arg enableCeph "$ceph" --arg enableZfs "$zfs"
|