-
Notifications
You must be signed in to change notification settings - Fork 0
/
install
executable file
·78 lines (53 loc) · 1.78 KB
/
install
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash -eu
readonly SCRIPT_NAME="$(basename "$0")"
readonly SCRIPT_DIR="$(dirname "$(realpath "$0")")"
source "$SCRIPT_DIR"/lib/install.sh
usage() {
die <<EOM
Usage: $SCRIPT_NAME [OPTION]... MACHINE PROFILE DEVICE
Installs a Gentoo system on the given DEVICE.
The system will have MACHINE as default hostname.
The system is built with settings from the profiles/\$PROFILE.* files.
Options:
-w wipe DEVICE before installing
-q log messages in scripting mode
-m configure kernel before building
-h print this help message
Environment variables:
WIPE same as -w
QUIET same as -q
MENUCONFIG same as -m
PASSWORD set root password to \$PASSWORD
For further environment variables that can customize the installation process,
see '$(realpath --relative-to="$(pwd)" $SCRIPT_DIR)/bootstrap -h'.
Sample invocation:
sudo env SSH_AUTHORIZED_KEYS=$HOME/.ssh/openpgp-79131759.pub $0 gentoo rpi4 /dev/mmcblk0
EOM
}
while getopts :hwqm OPTION; do
case $OPTION in
h) usage ;;
w) WIPE=true ;;
q) QUIET=true ;;
m) MENUCONFIG=true ;;
\?) usage ;;
esac
done
shift $((OPTIND-1))
(( $# == 3 )) || usage
readonly MACHINE="$1"
readonly PROFILE="$2"
readonly DEVICE="$3"
[ -n "$MACHINE" ] || die 'please specify a non-empty machine name'
[ -n "$PROFILE" ] || die 'please specify a non-empty profile'
[ -b "$DEVICE" ] || die "'$DEVICE' is not a block device"
[ -f profiles/"$PROFILE".sh ] || die "unsupported profile '$PROFILE'"
source profiles/"$PROFILE".sh
cd "$SCRIPT_DIR"
install
${QUIET:-false} || cat <<EOM
Gentoo has been installed on $DEVICE.
Once booted, you can access the system with
ssh root@$MACHINE.local
For proper resolution of the .local domain, your system must support Multicast DNS.
EOM