-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathinizialize_gui.sh
97 lines (78 loc) · 2.39 KB
/
inizialize_gui.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
declare -a modular_dir=(
"base"
"gui_file"
"traffic_mon"
"upgrade-pack-specificDGA"
"upgrade-pack-specificTG800"
"upgrade-pack-specificTG789"
"upgrade-pack-specificTG789Xtream35B"
"telstra_gui"
"ledfw_support-specificTG788"
"ledfw_support-specificTG789"
"ledfw_support-specificTG799"
"ledfw_support-specificTG800"
"ledfw_support-specificDGA"
"ledfw_support-specificDGA4131"
)
if [ "$1" == "dev" ]; then
echo "Dev build detected"
type="_dev"
fi
if [ "$CI" == "true" ]; then
TYPE="$(cat $HOME/gui_build/data/type)"
if [ $TYPE == "PREVIEW" ]; then
type="_preview"
elif [ $TYPE == "DEV" ]; then
type="_dev"
elif [ $TYPE != "STABLE" ]; then
type="_"$TYPE
fi
fi
mkdir tar_tmp
for index in "${modular_dir[@]}"; do
if [ "$CI" == "true" ] && [ -f $HOME/gui-dev-build-auto/modular/$index.tar.bz2 ]; then
old_md5=$(md5sum <(bzcat $HOME/gui-dev-build-auto/modular/$index.tar.bz2) | awk '{print $1}')
fi
cd decompressed/$index
#Creating md5sum file for status led eventing
if [[ $index == "gui_file" ]]; then
md5sum tmp/status-led-eventing.lua_new > tmp/status-led-eventing.md5sum
fi
#Creating md5sum for every ledfw_support modular dir
if [[ $index == *"ledfw_support"* ]]; then
md5sum etc/ledfw/stateMachines.lua > stateMachines.md5sum
fi
BZIP2=-9 tar --mtime='2018-01-01' -cjf ../../tar_tmp/$index.tar.bz2 * --owner=0 --group=0
cd ../../
new_md5=$(md5sum <(bzcat tar_tmp/$index.tar.bz2) | awk '{print $1}')
if [ -z "$old_md5" ] || [ "$old_md5" != "$new_md5" ]; then
echo "Changes detected in modular package $index, updating..."
cp tar_tmp/$index.tar.bz2 $HOME/gui-dev-build-auto/modular/
fi
done
rm -r tar_tmp
echo "Creating GUI dir"
if [ -d total ]; then
rm -r total
fi
if [ ! -d compressed ]; then
mkdir compressed
fi
mkdir total
if [ ! -d total/tmp ]; then
mkdir total/tmp
#This is needed as on installation this will overwrite permission of /tmp dir
chmod 777 total/tmp
fi
for index in "${modular_dir[@]}"; do
if [ $index == "base" ] || [ $index == "gui_file" ] || [ $index == "traffic_mon" ]; then
echo "Copying file from "$index" to GUI dir"
cp -dr decompressed/$index/* total
elif [ -z "$(echo $index | grep upgrade-pack-)" ]; then
cp $HOME/gui-dev-build-auto/modular/$index.tar.bz2 total/tmp
echo "Adding specific file from "$index" to tmp virtual dir"
fi
done
cd total && BZIP2=-9 tar -cjf ../compressed/GUI$type.tar.bz2 * --owner=0 --group=0
cd ../