-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-lightonly.sh
56 lines (48 loc) · 1.07 KB
/
build-lightonly.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
#!/bin/bash
#2020 by Rizal Muttaqin
if ! command -v optipng >/dev/null
then
echo "Please install optipng"
exit 1
fi
if ! command -v svgcleaner >/dev/null
then
echo "Please install svgcleaner"
exit 1
fi
echo "=> Remove old PNG version"
cp "colibre/links.txt" \
"colibre_svg"
rm -Rf "colibre"
cd "colibre_svg"
echo "=> Clean SVG files ..."
find -name "*.svg" -o -name "*.SVG" | while read i;
do
echo "This $i file is compressed"
fname=$( basename "$i")
# echo "has the name: $fname"
fdir=$( dirname "$i")
# echo "and is in the directory: ${fdir##*/}"
svgcleaner "$i" "${i%.*}.svg"
done
cd "./.."
cp -Rf "colibre_svg" \
"colibre"
rm "colibre_svg/links.txt"
cd "colibre"
echo "=> Export SVG to PNG ..."
find -name "*.svg" -o -name "*.SVG" | while read i;
do
echo "This $i file is compressed"
fname=$( basename "$i")
fdir=$( dirname "$i")
inkscape -f "$i" -e "${i%.*}.png"
optipng -o7 "${i%.*}.png"
done
echo "=> Delete SVG files ..."
find -name "*.svg" -o -name "*.SVG" | while read i;
do
fname=$( basename "$i")
fdir=$( dirname "$i")
rm "$i"
done