Skip to content

Commit 09d2e07

Browse files
authored
feat: Display version number
1 parent d29c8b8 commit 09d2e07

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

entry.sh

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,50 @@
11
#!/usr/bin/env bash
22
set -Eeuo pipefail
33

4+
info () { printf "%b%s%b" "\E[1;34m❯ \E[1;36m" "${1:-}" "\E[0m\n"; }
5+
error () { printf "%b%s%b" "\E[1;31m❯ " "ERROR: ${1:-}" "\E[0m\n" >&2; }
6+
warn () { printf "%b%s%b" "\E[1;31m❯ " "Warning: ${1:-}" "\E[0m\n" >&2; }
7+
8+
trap 'error "Status $? while: $BASH_COMMAND (line $LINENO/$BASH_LINENO)"' ERR
9+
10+
[ ! -f "/run/entry.sh" ] && error "Script must run inside Docker container!" && exit 11
11+
[ "$(id -u)" -ne "0" ] && error "Script must be executed with root privileges." && exit 12
12+
13+
echo "❯ Starting umbrelOS for Docker v$(</run/version)..."
14+
echo "❯ For support visit https://github.com/dockur/umbrel/issues"
15+
416
if [ ! -S /var/run/docker.sock ]; then
5-
echo "ERROR: Docker socket is missing? Please bind /var/run/docker.sock in your compose file." && exit 13
17+
error "Docker socket is missing? Please bind /var/run/docker.sock in your compose file." && exit 13
618
fi
719

820
if ! docker network inspect umbrel_main_network &>/dev/null; then
921
if ! docker network create --driver=bridge --subnet="10.21.0.0/16" umbrel_main_network >/dev/null; then
10-
echo "ERROR: Failed to create network 'umbrel_main_network'!" && exit 14
22+
error "Failed to create network 'umbrel_main_network'!" && exit 14
1123
fi
1224
if ! docker network inspect umbrel_main_network &>/dev/null; then
13-
echo "ERROR: Network 'umbrel_main_network' does not exist?" && exit 15
25+
error "Network 'umbrel_main_network' does not exist?" && exit 15
1426
fi
1527
fi
1628

1729
target=$(hostname)
1830

1931
if ! docker inspect "$target" &>/dev/null; then
20-
echo "ERROR: Failed to find a container with name '$target'!" && exit 16
32+
error "Failed to find a container with name '$target'!" && exit 16
2133
fi
2234

2335
resp=$(docker inspect "$target")
2436
network=$(echo "$resp" | jq -r '.[0].NetworkSettings.Networks["umbrel_main_network"]')
2537

2638
if [ -z "$network" ] || [[ "$network" == "null" ]]; then
2739
if ! docker network connect umbrel_main_network "$target"; then
28-
echo "ERROR: Failed to connect container to network!" && exit 17
40+
error "Failed to connect container to network!" && exit 17
2941
fi
3042
fi
3143

3244
mount=$(echo "$resp" | jq -r '.[0].Mounts[] | select(.Destination == "/data").Source')
3345

3446
if [ -z "$mount" ] || [[ "$mount" == "null" ]] || [ ! -d "/data" ]; then
35-
echo "ERROR: You did not bind the /data folder!" && exit 18
47+
error "You did not bind the /data folder!" && exit 18
3648
fi
3749

3850
# Create directories
@@ -46,7 +58,7 @@ if [[ "$mount" == *":\\"* ]]; then
4658
fi
4759

4860
if [[ "$mount" != "/"* ]]; then
49-
echo "ERROR: Please bind the /data folder to an absolute path!" && exit 19
61+
error "Please bind the /data folder to an absolute path!" && exit 19
5062
fi
5163

5264
# Mirror external folder to local filesystem

0 commit comments

Comments
 (0)