-
Notifications
You must be signed in to change notification settings - Fork 4
/
build_tar_files.sh
executable file
·110 lines (97 loc) · 1.51 KB
/
build_tar_files.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
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/bash
quiet=false
force=false
runtest=true
error=false
usage() {
echo "Pack all custom emojis to .tar.gz files for mastodon import"
echo ""
echo "usage: $0 [-q][-f][-u][-h]"
echo ""
echo -e "\t-q\tQuiet, no output"
echo -e "\t-f\tForce, ignore failed test"
echo -e "\t-n\tDon't run tests"
echo -e "\t-u\tPrint usage (this) and exit"
echo -e "\t-h\tPrint usage (this) and exit"
echo -e ""
echo -e "The Source code is available at https://github.com/cuties-social/custom-emojis"
echo
}
while getopts 'qfnuh' option; do
case $option in
q)
quiet=true;;
f)
force=true;;
n)
runtest=false;;
h)
usage
exit 0;;
u)
usage
exit 0;;
esac
done
if $runtest
then
output="$(bash ./test.sh)"
if [ $? != 0 ]
then
if [ $quiet != true ]
then
echo "Tests failed:"
printf "${output}"
echo ""
fi
if [ $force != true ]
then
exit 1
else
if [ $quiet != true ]
then
echo "Forced to continue"
fi
fi
fi
fi
mkdir -p build/
for d in */ ; do
d=${d%/}
if [ "$d" != "build" -a "$d" != "import" ]
then
cd $d
if [ $quiet != true ]
then
printf "Packing $d.tar.gz... "
fi
tarout="$(tar cfz ../build/$d.tar.gz * 2>&1)"
if [ $? != 0 ]
then
error=true
fi
cd ..
if [ $error != true ]
then
if [ $quiet != true ]
then
printf "OK\n"
fi
else
if [ $quiet != true ]
then
printf "Failed\t\t\t\t!!!\n"
if [ $force != true -a $quiet != true ]
then
printf "$tarout"
fi
fi
if [ $force != true ]
then
exit 1
fi
fi
error=false
fi
done
exit 0