-
Notifications
You must be signed in to change notification settings - Fork 57
/
util
38 lines (34 loc) · 1020 Bytes
/
util
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
set -eu
check_existence()
{
set +e
which "$1" > /dev/null 2>&1
exists=$?
if [ ! "$exists" -eq "0" ];
then
log_end "$1 not found; see the README for dependencies" 1>&2
exit 1
fi
set -e
}
show_help()
{
log "usage: $0 [OPTION...]"
log
log " -h Show this help message"
log " -g <dev> Set GRUB target device (default: ${grub_device:-undefined})"
log " -r <dev> Set root filesystem target device (default: ${root_mount:-undefined})"
log " -t <type> Set root filesystem type (default: ${root_type:-undefined})"
log " -G Use the graphical NixOS ISO (default: ${iso:-undefined})"
log " -c Set extra Nix config file (default: ${extra_config:-undefined})"
log " -d Prepare for use with Digital Ocean (default: ${digitalocean:-undefined})"
log " -w <dir> Specify the working directory (default: random in /tmp)"
exit 1
}
log()
{ printf ">>> %s\n" "$*"; }
log_start()
{ printf ">>> %s" "$*"; }
log_end()
{ printf "%s\n" "$*"; }