-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·98 lines (79 loc) · 1.64 KB
/
setup.sh
File metadata and controls
executable file
·98 lines (79 loc) · 1.64 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
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
#!/bin/bash
# remember current directory
CUR_DIR=`pwd`
DO_HELP=false
DO_CLEAN=false
COL_BRIGHT="\033[1m"
COL_NORMAL="\033[0m"
# force script to run from within script directory
EXEC_PATH=`echo $0 | sed 's/\(.*\)\/[^\/]*$/\1/'`
# cd to scripts directory
cd 1>/dev/null $EXEC_PATH/scripts
source scripts.env
exec_script()
{
SCRIPT=$1
if [ $# == 2 ]; then
if [ "$2" == "-" ]; then
PRINTLN "$SCRIPT... skipped"
return 0
fi
fi
shift
./$SCRIPT $@
if [ $? -eq 0 ]; then
PRINTLN "Done!"
else
PRINTLN "Failed, Aborting..."
exit 1
fi
}
help_print_tool()
{
printf "$COL_BRIGHT%-15s$COL_NORMAL - %s.\n" "$1 | $2" "$3"
}
usage()
{
printf "Usage:\n"
printf " $ $COL_BRIGHT$0 [options]$COL_NORMAL\n"
printf "\n"
printf "Where 'options' is one of:\n"
help_print_tool -c --clean "Clean up (reset) the project environment"
help_print_tool -h --help "Display this message and exit"
printf "\n"
printf "Running without any options sets up the project environment.\n"
}
TEMP=`getopt -o c,h --long clean,help -- "$@"`
if [ $? != 0 ]; then
echo "Terminating..." >&2;
exit 1;
fi
eval set -- "$TEMP"
while true; do
case "$1" in
-h|--help)
DO_HELP=true
shift; break;;
--) shift; break;;
-c|--clean)
DO_CLEAN=true
shift; break;;
--) shift; break;;
*) echo "Illegal option: $1!"; exit 1;;
esac
done
if [ $DO_HELP == "true" ]; then
# display usage
usage
exit 0
fi
if [ $DO_CLEAN == "true" ]; then
printf "Nothing to do\n"
exit 0
fi
# get prerequisite software
exec_script get_prerequisite_software.sh
# setup mobilehost gpg public key
exec_script setup_gpg_public_key.sh
# cd to execution direcory
cd 1>/dev/null $CUR_DIR