-
Notifications
You must be signed in to change notification settings - Fork 40
/
test.sh
executable file
·61 lines (42 loc) · 1009 Bytes
/
test.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
#! /bin/bash
# Copyright (C) 2015 Sebastian Pipping <[email protected]>
# Licensed under AGPL v3 or later
on_exit() {
echo FAILED 1>&2
}
trap on_exit exit
FAIL_USAGE() {
echo "USAGE: $(basename "$0") BLOCK_DEV ROOT_PASSWORD" 1>&2
exit 1
}
DEBIAN_MIRROR_URL=http://ftp.de.debian.org/debian/
HTTP_PROXY_URL=http://127.0.0.1:8123/ # polipo
if [[ ! -b "$1" ]]; then
FAIL_USAGE
fi
target_device="$1"; shift
if [[ -z "$1" ]]; then
FAIL_USAGE
fi
root_password="$1"; shift
if [[ "$(id -u)" -ne 0 ]]; then
echo "ERROR: Yo do not seem to be root (user ID 0)." 1>&2
exit 1
fi
ECHO_RUN() {
echo '#' "$@"
"$@"
}
BUILD() {
name="$1"; shift
ECHO_RUN env http_proxy="${HTTP_PROXY_URL}" ./image-bootstrap --verbose --password "${root_password}" "$@" "${target_device}"
}
set -e
BUILD arch-openstack \
--openstack arch
BUILD debian-stretch-openstack \
--openstack debian --release stretch --mirror "${DEBIAN_MIRROR_URL}"
BUILD ubuntu-vivid \
ubuntu --release vivid
trap - exit
echo PASSED