-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal-prep.sh
executable file
·79 lines (65 loc) · 1.45 KB
/
local-prep.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
set -xe
FILER_SERVER="http://filer.dev.eng.nutanix.com:8080/"
FILER_DIRECTORY="Users/ashah/filer/snooper/"
FILES=(
"v1.1.0.tar.gz"
"wireshark-2.6.3-1.x86_64.rpm"
"wireshark-qt-2.6.3-1.x86_64.rpm"
)
PROJ_NAME="snooper"
_CWD=${PWD}
BUILD_DIR="__build"
_ROOT_DIR="ROOTDIR"
_OUTPUT_DIR="OUTPUT"
mkdir ${BUILD_DIR}
pushd ${BUILD_DIR}
mkdir ${_ROOT_DIR}
pushd ${_ROOT_DIR}
root_dir=${PWD}
mkdir ${PROJ_NAME}
pushd ${PROJ_NAME}
payload_dir=${PWD}
popd #PROJ_NAME
popd #_ROOT_DIR
popd #BUILD_DIR
cp -rf etc configs infra packages ${payload_dir}
cp -f setmeup.sh ${root_dir}
pushd ${payload_dir}
mkdir logs
function _check_integrity {
local file_name="$1"
(
set -e
md5sum -c ${file_name}
rm -f ${file_name}
)
_ret=$?
if [ ${_ret} -ne 0 ]; then
exit ${_ret}
fi
}
function download {
local file_name="$1"
local md5_file=${file_name}.md5
wget -O ${file_name} ${FILER_SERVER}/${FILER_DIRECTORY}/${file_name}
wget -O ${md5_file} ${FILER_SERVER}/${FILER_DIRECTORY}/${md5_file}
_check_integrity ${md5_file}
}
pushd packages
for file in "${FILES[@]}"; do
download "$file"
done
popd #packages
popd #payload_dir
pushd ${BUILD_DIR}
mkdir ${_OUTPUT_DIR}
pushd ${_OUTPUT_DIR}
output_dir_path="$PWD"
popd #_OUTPUT_DIR
popd #BUILD_DIR
pushd ${root_dir}
tar zcvf ${output_dir_path}/snooper.tar.gz ${PROJ_NAME}
cp setmeup.sh ${output_dir_path}/.
popd #root_dir
#tar zcvf snooper.tar.gz requirements.txt infra