forked from ikipro/aos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwhonix_build
executable file
·104 lines (75 loc) · 2.21 KB
/
whonix_build
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
## This file is part of Whonix.
## Copyright (C) 2012 - 2014 Patrick Schleizer <adrelanos@riseup.net>
## See the file COPYING for copying conditions.
set -x
true "INFO: Currently running script: $0${1+"$@"}"
set -o pipefail
error_handler_build-machine() {
: echo "
${red}${bold}BASH_COMMAND${reset}: $BASH_COMMAND
${red}${bold}ERROR $0: | caller: $(caller)${reset}
"
exit 1
}
MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MY_PARENTDIR="$(dirname "$MYDIR")"
cd "$MYDIR"
source ./help-steps/pre
export WHONIX_BUILD_MAIN_SCRIPT_STARTED="1"
whonix_build_preparation() {
trap "error_handler_general" ERR INT TERM
cd help-steps
source parse-cmd
export WHONIX_BUILD_PARSED="1"
source pre
cd ..
}
whonix_build_machine() {
trap "error_handler_build-machine" ERR INT TERM
run-parts --verbose --test ./build-steps.d
run-parts --verbose --exit-on-error ./build-steps.d
}
whonix_build_clean() {
trap "error_handler_general" ERR INT TERM
./help-steps/delete-vbox-vm
}
whonix_build_preparation ${1+"$@"}
if [ "$WHONIX_BUILD_CLEAN" = "1" ]; then
if [ "$WHONIX_BUILD_ALL" = "1" ]; then
WHONIX_BUILD_GATEWAY="1"
WHONIX_BUILD_WORKSTATION="0"
whonix_build_clean
WHONIX_BUILD_GATEWAY="0"
WHONIX_BUILD_WORKSTATION="1"
whonix_build_clean
exit 0
fi
if [ "$WHONIX_BUILD_GATEWAY" = "1" ]; then
whonix_build_clean
exit 0
fi
if [ "$WHONIX_BUILD_WORKSTATION" = "1" ]; then
whonix_build_clean
exit 0
fi
elif [ "$WHONIX_BUILD_BUILD" = "1" ]; then
if [ "$WHONIX_BUILD_ALL" = "1" ]; then
WHONIX_BUILD_GATEWAY="1"
WHONIX_BUILD_WORKSTATION="0"
whonix_build_machine
WHONIX_BUILD_GATEWAY="0"
WHONIX_BUILD_WORKSTATION="1"
whonix_build_machine
fi
if [ "$WHONIX_BUILD_GATEWAY" = "1" ]; then
whonix_build_machine
fi
if [ "$WHONIX_BUILD_WORKSTATION" = "1" ]; then
whonix_build_machine
fi
benchmark_time_end ## sets benchmark_took_time (implemented in help-steps/pre)
true "${bold}${green}INFO: End of: $0 No error detected. (benchmark: $benchmark_took_time)${reset}"
else
true "${bold}${red}ERROR $0: You must either use --build or --clean. ${reset}"
fi