1
1
#! /usr/bin/env bash
2
2
set -euo pipefail
3
3
4
- export DEBIAN_FRONTEND=noninteractive
5
- needrestart_conf_dir=" /etc/needrestart/conf.d"
6
- needrestart_conf_file=" ${needrestart_conf_dir} /temp-disable-for-umbrel-install.conf"
7
- sudo mkdir -p " ${needrestart_conf_dir} "
8
- echo " # Restart services (l)ist only, (i)nteractive or (a)utomatically.
9
- \$ nrconf{restart} = 'l';
10
- # Disable hints on pending kernel upgrades.
11
- \$ nrconf{kernelhints} = 0; " | sudo tee " ${needrestart_conf_file} " > /dev/null
12
- trap " sudo rm -f ${needrestart_conf_file} " EXIT
13
-
14
- # Default options
15
- BOOTSTRAPPED=" false"
16
- PRINT_DOCKER_WARNING=" true"
17
- UPDATE_APT=" true"
18
- INSTALL_APT_DEPS=" true"
19
- INSTALL_AVAHI=" true"
20
- INSTALL_YQ=" true"
21
- INSTALL_DOCKER=" true"
22
- INSTALL_DOCKER_COMPOSE=" true"
23
- INSTALL_START_SCRIPT=" true"
24
- INSTALL_UMBREL=" true"
25
- UMBREL_VERSION=" release"
26
- UMBREL_REPO=" getumbrel/umbrel"
27
- UMBREL_INSTALL_PATH=" $HOME /umbrel"
28
-
29
- # Parse arguments
30
- arguments=${@:- }
31
-
32
- if [[ " ${arguments} " = * " --bootstrapped" * ]]
33
- then
34
- BOOTSTRAPPED=" true"
35
- fi
36
-
37
- if [[ " ${arguments} " = * " --no-docker-warning" * ]]
38
- then
39
- PRINT_DOCKER_WARNING=" false"
40
- fi
41
-
42
- if [[ " ${arguments} " = * " --no-install-avahi" * ]]
43
- then
44
- INSTALL_AVAHI=" false"
45
- fi
46
-
47
- if [[ " ${arguments} " = * " --no-install-yq" * ]]
48
- then
49
- INSTALL_YQ=" false"
50
- fi
51
-
52
- if [[ " ${arguments} " = * " --no-install-docker" * ]]
53
- then
54
- INSTALL_DOCKER=" false"
55
- fi
56
-
57
- if [[ " ${arguments} " = * " --no-install-compose" * ]]
58
- then
59
- INSTALL_DOCKER_COMPOSE=" false"
60
- fi
61
-
62
- if [[ " ${arguments} " = * " --no-install-start-script" * ]]
63
- then
64
- INSTALL_START_SCRIPT=" false"
65
- fi
66
-
67
- if [[ " ${arguments} " = * " --no-install-umbrel" * ]]
68
- then
69
- INSTALL_UMBREL=" false"
70
- fi
71
-
72
- if [[ " ${arguments} " = * " --no-install-deps" * ]]
73
- then
74
- UPDATE_APT=" false"
75
- INSTALL_APT_DEPS=" false"
76
- INSTALL_AVAHI=" false"
77
- INSTALL_YQ=" false"
78
- INSTALL_DOCKER=" false"
79
- INSTALL_DOCKER_COMPOSE=" false"
80
- INSTALL_UMBREL=" true"
81
- fi
82
-
83
- if [[ " ${arguments} " = * " --version" * ]]
84
- then
85
- UMBREL_VERSION=" $( echo " ${arguments} " | sed ' s/.*--version \([^ ]*\).*/\1/' ) "
86
- fi
87
-
88
- if [[ " ${arguments} " = * " --install-path" * ]]
89
- then
90
- UMBREL_INSTALL_PATH=" $( echo " ${arguments} " | sed ' s/.*--install-path \([^ ]*\).*/\1/' ) "
91
- fi
92
-
93
- get_umbrel_version () {
94
- version=" ${UMBREL_VERSION} "
95
- if [[ " ${version} " = " release" ]]
96
- then
97
- version=$( curl --silent https://api.github.com/repos/${UMBREL_REPO} /releases/latest | sed -n ' s/.*"tag_name": "\([^"]*\).*/\1/p' )
98
- fi
99
-
100
- echo $version
101
- }
102
-
103
- bootstrap () {
104
- version=$( get_umbrel_version)
105
- curl --location --silent " https://raw.githubusercontent.com/${UMBREL_REPO} /${version} /scripts/install" | \
106
- bash -s -- --bootstrapped $arguments
107
- }
108
-
109
- update_apt () {
110
- sudo apt-get update --yes
111
- }
112
-
113
- install_apt_deps () {
114
- sudo apt-get install --yes fswatch jq rsync curl git gettext-base python3 gnupg
115
- }
116
-
117
- install_avahi () {
118
- sudo apt-get install --yes avahi-daemon avahi-discover libnss-mdns
119
- }
120
-
121
- install_yq () {
122
- # Define checksums for yq (4.24.5)
123
- declare -A yq_sha256
124
- yq_sha256[" arm64" ]=" 8879e61c0b3b70908160535ea358ec67989ac4435435510e1fcb2eda5d74a0e9"
125
- yq_sha256[" amd64" ]=" c93a696e13d3076e473c3a43c06fdb98fafd30dc2f43bc771c4917531961c760"
126
-
127
- yq_version=" v4.24.5"
128
- system_arch=$( dpkg --print-architecture)
129
- yq_binary=" yq_linux_${system_arch} "
130
-
131
- # Download yq from GitHub
132
- yq_temp_file=" /tmp/yq"
133
- curl -L " https://github.com/mikefarah/yq/releases/download/${yq_version} /${yq_binary} " -o " ${yq_temp_file} "
134
-
135
- # Check file matches checksum
136
- if [[ " $( sha256sum " ${yq_temp_file} " | awk ' { print $1 }' ) " == " ${yq_sha256[$system_arch]} " ]]; then
137
- sudo mv " ${yq_temp_file} " /usr/bin/yq
138
- sudo chmod +x /usr/bin/yq
139
-
140
- echo " yq installed successfully..."
141
- else
142
- echo " yq install failed. sha256sum mismatch"
143
- exit 1
144
- fi
145
- }
146
-
147
- install_docker () {
148
- # Install Docker
149
- curl -fsSL https://get.docker.com | sudo sh
150
- }
151
-
152
- install_docker_compose () {
153
- sudo apt-get install --yes python3-pip libffi-dev
154
- # We need to upgrade pip (via itself) because old pip versions in some OS repos fail to install deps.
155
- python3 -m pip install --upgrade pip
156
- sudo python3 -m pip install docker-compose
157
- }
158
-
159
- get_arch () {
160
- machine_arch=" $( uname --machine) "
161
- if [[ " ${machine_arch} " = " x86_64" ]]
162
- then
163
- binary_arch=" amd64"
164
- elif [[ " ${machine_arch} " = " aarch64" ]]
165
- then
166
- binary_arch=" arm64"
167
- else
168
- echo " Unsupported architecture: ${machine_arch} "
169
- exit 1
170
- fi
171
-
172
- echo " ${binary_arch} "
173
- }
174
-
175
- install_umbrel () {
176
- version=$( get_umbrel_version)
177
- binary_arch=$( get_arch)
178
- curl --location " https://api.github.com/repos/${UMBREL_REPO} /tarball/${version} " | \
179
- tar --extract --gzip --strip-components=1 --directory=" ${UMBREL_INSTALL_PATH} "
180
-
181
- binary_url=" https://github.com/${UMBREL_REPO} /releases/download/${version} /umbreld-${version} -${binary_arch} .tar.gz"
182
- curl --fail --location " ${binary_url} " | tar --extract --gzip --directory=" ${UMBREL_INSTALL_PATH} /bin"
183
- }
184
-
185
- install_systemd_service () {
186
- echo "
187
- [Unit]
188
- Wants=network-online.target
189
- After=network-online.target
190
- Wants=docker.service
191
- After=docker.service
192
-
193
- # This prevents us hitting restart rate limits and ensures we keep restarting
194
- # indefinitely.
195
- StartLimitInterval=0
196
-
197
- [Service]
198
- Type=forking
199
- TimeoutStartSec=infinity
200
- TimeoutStopSec=16min
201
- ExecStart=${UMBREL_INSTALL_PATH} /scripts/start
202
- ExecStop=${UMBREL_INSTALL_PATH} /scripts/stop
203
- User=root
204
- Group=root
205
- StandardOutput=syslog
206
- StandardError=syslog
207
- SyslogIdentifier=umbrel startup
208
- RemainAfterExit=yes
209
- Restart=always
210
- RestartSec=10
211
-
212
- [Install]
213
- WantedBy=multi-user.target" | sudo tee " /etc/systemd/system/umbrel-startup.service"
214
- sudo chmod 644 " /etc/systemd/system/umbrel-startup.service"
215
- sudo systemctl enable " umbrel-startup.service"
216
- }
217
-
218
- main () {
219
- if [[ " ${BOOTSTRAPPED} " = " false" ]]
220
- then
221
- bootstrap
222
- exit
223
- fi
224
-
225
- if [[ " ${INSTALL_UMBREL} " = " true" ]]
226
- then
227
- echo " About to install Umbrel in \" ${UMBREL_INSTALL_PATH} \" ."
228
- echo " If you would like to install somewhere else you can specify a custom location with:"
229
- echo
230
- echo " curl -L https://umbrel.sh | bash -s -- --install-path /some/path"
231
- echo
232
- echo " Waiting for 10 seconds..."
233
- echo
234
- echo " You may press Ctrl+C now to abort the install."
235
- echo
236
- sleep 10
237
- fi
238
-
239
- if [[ " ${PRINT_DOCKER_WARNING} " = " true" ]] && [[ " ${INSTALL_DOCKER} " = " true" ]] && command -v docker > /dev/null 2>&1
240
- then
241
-
242
- cat << 'EOF '
243
- It looks like you already have Docker installed. Umbrel requires a modern version of Docker so this script will update them with the official Docker install script.
244
-
245
- If you would like to disable this behaviour you can abort this install and run again with --no-install-docker or --no-install-compose.
246
-
247
- You can pass flags to the installer like this:
248
-
249
- curl -L https://umbrel.sh | bash -s -- --no-install-docker --no-install-compose
250
-
251
- Waiting for 30 seconds...
252
-
253
- You may press Ctrl+C now to abort the install.
254
-
255
- EOF
256
- sleep 30
257
- fi
258
-
259
- if [[ " ${INSTALL_UMBREL} " = " true" ]]
260
- then
261
- mkdir -p " ${UMBREL_INSTALL_PATH} "
262
- if [[ " $( ls --almost-all " ${UMBREL_INSTALL_PATH} " ) " ]]
263
- then
264
- echo " Error: Umbrel install path \" ${UMBREL_INSTALL_PATH} \" already contains files"
265
- echo " You can install Umbrel in a custom location with:"
266
- echo
267
- echo " curl -L https://umbrel.sh | bash -s -- --install-path /some/path"
268
- exit 1
269
- fi
270
- fi
271
-
272
- if [[ " ${UPDATE_APT} " = " true" ]]
273
- then
274
- update_apt
275
- fi
276
-
277
- if [[ " ${INSTALL_APT_DEPS} " = " true" ]]
278
- then
279
- install_apt_deps
280
- fi
281
-
282
- if [[ " ${INSTALL_AVAHI} " = " true" ]]
283
- then
284
- install_avahi
285
- fi
286
-
287
- if [[ " ${INSTALL_YQ} " = " true" ]]
288
- then
289
- install_yq
290
- fi
291
-
292
- if [[ " ${INSTALL_DOCKER} " = " true" ]]
293
- then
294
- install_docker
295
- fi
296
-
297
- if [[ " ${INSTALL_DOCKER_COMPOSE} " = " true" ]]
298
- then
299
- install_docker_compose
300
- fi
301
-
302
- if [[ " ${INSTALL_UMBREL} " = " true" ]]
303
- then
304
- install_umbrel
305
-
306
- if [[ " ${INSTALL_START_SCRIPT} " = " true" ]]
307
- then
308
- install_systemd_service
309
- fi
310
-
311
- # Do the initial start outside of systemd so we get logs
312
- sudo ${UMBREL_INSTALL_PATH} /scripts/start
313
-
314
- if [[ " ${INSTALL_START_SCRIPT} " = " true" ]]
315
- then
316
- # Kick off the systemd service again so it's in sync
317
- sudo systemctl start " umbrel-startup.service"
318
- fi
319
-
320
- echo
321
- echo " Umbrel has been sucessfully installed!"
322
- fi
323
- }
324
-
325
- main
4
+ cat << "EOF "
5
+
6
+ ,;###GGGGGGGGGGl#Sp
7
+ ,##GGGlW""^' '`""%GGGG#S,
8
+ ,#GGG" "lGG#o
9
+ #GGl^ '$GG#
10
+ ,#GGb umbrelOS 1.0 \GGG,
11
+ lGG" "GGG
12
+ #GGGlGGGl##p,,p##lGGl##p,,p###ll##GGGG
13
+ !GGGlW"""*GGGGGGG#""""WlGGGGG#W""*WGGGGS
14
+ "" "^ '" ""
15
+
16
+ ------------------------------------------------------
17
+ | |
18
+ | umbrelOS 1.0 is currently only compatable with |
19
+ | Umbrel Home, Raspberry Pi 4 and Raspberry Pi 5. |
20
+ | Support for more devices is coming in April 2024. |
21
+ | |
22
+ ------------------------------------------------------
23
+ EOF
0 commit comments