forked from wouldgo/alpine-raspberry-pi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-build.sh
executable file
·63 lines (57 loc) · 1.43 KB
/
docker-build.sh
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
#!/usr/bin/env bash
function do_it() {
set -xe
docker run \
-it \
--privileged \
--rm \
-v /dev:/dev:ro \
-v "$PWD":/runner \
-w /runner \
-e ALPINE_BRANCH=latest-stable \
-e ALPINE_MIRROR="http://dl-cdn.alpinelinux.org/alpine" \
-e ARCH=aarch64 \
-e TARGET_HOSTNAME="${TARGET_HOSTNAME}" \
-e DEVICE_NAME="${DEVICE_NAME}" \
-e ROOT_PASSWORD="${ROOT_PASSWORD}" \
-e TLD="${TLD}" \
-e USERNAME="${USERNAME}" \
-e PASSWORD="${PASSWORD}" \
-e LOCALE="${LOCALE}" \
-e TIMEZONE="${TIMEZONE}" \
-e DNS_SERVER="${DNS_SERVER}" \
-e DNS_DOMAIN="${DNS_DOMAIN}" \
runner ./make-image
}
while getopts ":f:h:d:r:i:u:p:l:t:s:v:" arg; do
case $arg in
f) CONFIG=$OPTARG;;
h) TARGET_HOSTNAME=$OPTARG;;
d) DEVICE_NAME=$OPTARG;;
r) ROOT_PASSWORD=$OPTARG;;
i) TLD=$OPTARG;;
u) USERNAME=$OPTARG;;
p) PASSWORD=$OPTARG;;
l) LOCALE=$OPTARG;;
t) TIMEZONE=$OPTARG;;
s) DNS_SERVER=$OPTARG;;
v) DNS_DOMAIN=$OPTARG;;
*) echo "Invalid option
Options are:
- f: file that contains the export of all variables you want to specify;
- h: hostname;
- d: device-name;
- r: root-passowrd;
- i: internal lan suffix;
- u: user name;
- p: user password;
- l: locale;
- t: timezone;
- s: dns server name;
- v: dns domain name;"; exit 1
esac
done
if [[ -n "${CONFIG}" ]] && [[ -f "${CONFIG}" ]]; then
env "$(xargs < "${CONFIG}")"
fi
do_it "$@"