-
Notifications
You must be signed in to change notification settings - Fork 5
/
build
executable file
·146 lines (109 loc) · 3.61 KB
/
build
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/bin/env bash
set -euo pipefail
usage() {
echo "Usage: $0 {vm|develop|validation|master|stuck|lab-key|shed-key|test-e2e|all}"
exit 1
}
if [ $# -eq 0 ]; then
usage
fi
TARGET="$1"
# Allow unfree packages, required for zerotier using a BSL 1.1 licence
# See https://nixos.wiki/wiki/FAQ/How_can_I_install_a_proprietary_or_unfree_package%3F
export NIXPKGS_ALLOW_UNFREE=1
if [ "$TARGET" == "vm" ]; then
(set -x; nix-build \
--arg buildInstaller false \
--arg buildBundle false \
--arg buildLive false \
--arg buildDisk false)
echo -e "
Run ./result/bin/run-in-vm to start a VM.
QEMU Shortcuts:
- Grab/release cursor: ctrl-alt-g
- Quit: ctrl-alt-q
PlayOS shortcuts:
- Toggle controller: ctrl-shift-f12
You can switch virtual consoles in the guest via QEMU monitor (ctrl-alt-2), sending a key combination via 'sendkey <key-comb>, and returning to QEMU display (ctrl-alt-1).
- Status console: ctrl-alt-f8
- Graphical system: ctrl-alt-f7
"
elif [ "$TARGET" == "develop" ]; then
scripts/info-branch-commit
scripts/confirm-or-abort
(set -x; nix-build \
--arg updateCert ./pki/develop/cert.pem \
--arg updateUrl https://dist.dividat.com/releases/playos/develop/ \
--arg deployUrl s3://dist.dividat.ch/releases/playos/develop/ \
--arg kioskUrl https://dev-play.dividat.com/ \
--arg buildDisk false)
echo
echo "Run ./result/bin/deploy-update to deploy."
elif [ "$TARGET" == "validation" ]; then
scripts/info-branch-commit
scripts/confirm-or-abort
(set -x; nix-build \
--arg updateCert ./pki/validation/cert.pem \
--arg updateUrl https://dist.dividat.com/releases/playos/validation/ \
--arg deployUrl s3://dist.dividat.ch/releases/playos/validation/ \
--arg kioskUrl https://val-play.dividat.com/ \
--arg buildDisk false)
echo
echo "Run ./result/bin/deploy-update to deploy."
elif [ "$TARGET" == "master" ]; then
scripts/info-branch-commit
scripts/confirm-or-abort
(set -x; nix-build \
--arg updateCert ./pki/master/cert.pem \
--arg updateUrl https://dist.dividat.com/releases/playos/master/ \
--arg deployUrl s3://dist.dividat.ch/releases/playos/master/ \
--arg kioskUrl https://play.dividat.com/ \
--arg buildDisk false)
echo
echo "Run ./result/bin/deploy-update to deploy."
elif [ "$TARGET" == "stuck" ]; then
echo "Creating a stuck system that will not self-update."
echo
printf "Kiosk URL? "
read KIOSK_URL
KIOSK_URL=$(echo "$KIOSK_URL" | xargs) # Trim
(set -x; nix-build \
--arg kioskUrl "$KIOSK_URL" \
--arg buildBundle false \
--arg buildDisk false)
elif [ "$TARGET" == "lab-key" ]; then
(set -x; nix-build \
--arg kioskUrl https://lab.dividat.com/ \
--arg buildInstaller false \
--arg buildBundle false \
--arg buildDisk false)
elif [ "$TARGET" == "shed-key" ]; then
(set -x; nix-build \
--arg kioskUrl https://shed.dividat.com/ \
--arg buildInstaller false \
--arg buildBundle false \
--arg buildDisk false)
elif [ "$TARGET" == "test-e2e" ]; then
test_flags="
--arg kioskUrl http://10.0.2.99:8989/ \
--arg updateUrl http://update-server.local/ \
--arg buildVm false \
--arg buildInstaller false \
--arg buildBundle false \
--arg buildLive false \
--arg buildDisk false \
--arg buildTest true
"
echo "Building interactive e2e test runners."
(set -x; nix-build $test_flags)
echo "Running e2e tests..."
(set -x; nix-build $test_flags -A tests --no-out-link)
echo "Done. All e2e tests passed."
elif [ "$TARGET" == "all" ]; then
(set -x; nix-build)
else
echo
echo "I do not know how to build '$TARGET'."
echo "Aborting."
usage
fi