-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathstart_installimage
More file actions
executable file
·42 lines (34 loc) · 1.24 KB
/
start_installimage
File metadata and controls
executable file
·42 lines (34 loc) · 1.24 KB
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
#!/bin/bash
##
# created by Tim Meusel
# with help from Silvio Knizek
##
# this script will download our installimage config
# get our config
config='/usr/local/bin/config_live.sh'
if [ -n "$config" ] && [ -e "$config" ]; then
# shellcheck disable=SC1090
. "${config}"
else
echo "Error: ${config} file isn't available"
exit 1
fi
set -e -u
# currently we need the mac from the interface we used for booting, not the first one
#mac="$(ifdata -ph eth0 | awk '{gsub(":",""); print tolower($1)}')"
mac=$(awk 'BEGIN {FS="="; RS=" ";} { if ($1 ~ /BOOTIF/) {gsub(/^[^-]+-/, "", $2); gsub(/-/, "_", $2); print tolower($2)}}' /proc/cmdline)
if [ -n "$CONFIG_PROTO" ] && [ -n "$CONFIG_PORT" ] && [ -n "$CONFIG_SERVER" ] && [ -n "$CONFIG_PATH" ] && [ -n "$mac" ] && [ -n "$CONFIG_FILE" ]; then
url="${CONFIG_PROTO}://${CONFIG_SERVER}:${CONFIG_PORT}/${CONFIG_PATH}/${mac}"
else
echo "One of the needed config options is missing"
exit 1
fi
# we need to allow variable expansion if someone tries to attach any params to the URL
# shellcheck disable=SC2086
curl --silent $url > /root/config.cfg
if [ $? != 0 ]; then
echo "failed to download config"
exit 1
fi
# start installimage with our config
/root/.installimage/installimage.in_screen -c config.cfg -a