-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·61 lines (47 loc) · 1.05 KB
/
build.sh
File metadata and controls
executable file
·61 lines (47 loc) · 1.05 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
#!/bin/bash
PACKAGE=at.megathorx.wsc_api.tar
FILES=(package.xml aclOption.xml acpMenu.xml objectType.xml objectTypeDefinition.xml option.xml userGroupOption.xml userNotificationEvent.xml install.sql update_1.3.0.sql language)
cleanup() {
cd build
FILES_COUNT=$(ls -l | grep -v ^l | wc -l)
if [ $FILES_COUNT -ne 0 ]; then
rm -r *
fi
cd ..
}
archive() {
cd $2
FILES_COUNT=$(ls -l | grep -v ^l | wc -l)
if [ $FILES_COUNT -eq 0 ]; then
tar -cf "../$1" -T /dev/null
else
tar -cf "../$1" *
fi
cd ..
}
copy_pips() {
for i in "${FILES[@]}"
do
cp -r $i build_tmp/.
done
}
if [ ! -d build ]; then
mkdir build
fi
if [ ! -d build_tmp ]; then
mkdir build_tmp
fi
cleanup
if [ -d files ]; then
archive "build_tmp/files.tar" "files"
fi
if [ -d templates ]; then
archive "build_tmp/templates.tar" "templates"
fi
if [ -d acptemplates ]; then
archive "build_tmp/acptemplates.tar" "acptemplates"
fi
copy_pips
archive "build/$PACKAGE" "build_tmp"
rm -rf build_tmp
ls -l build/