-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbs_maker.sh
executable file
·138 lines (126 loc) · 3.36 KB
/
bs_maker.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/bash
usage() { echo "Usage: $0 [-l <logo> ] [-s <spinner> (optional)] [-n <name> (optional)] [-p <position> (optional)] [-c <hexcolor> (optional)]" 1>&2; exit 1; }
while getopts :l:s:n:p:c: opt; do
case $opt in
l) LOGO=${OPTARG}
;;
s)
if [ -z "${OPTARG}" ]
then
usage
else
SPINNER=${OPTARG}
fi
;;
n) NAME=${OPTARG}
;;
p)
if [ -z "${OPTARG}" ]
then
usage
else
case ${OPTARG} in
tl) POSITION=00
;;
t) POSITION=01
;;
tr) POSITION=02
;;
r) POSITION=03
;;
br) POSITION=04
;;
b) POSITION=05 #default
;;
bl) POSITION=06
;;
l) POSITION=07
;;
esac
fi
;;
c)
if [ -z "${OPTARG}" ]
then
usage
else
RCOLOR=${OPTARG:0:2}
GCOLOR=${OPTARG:2:2}
BCOLOR=${OPTARG:4}
fi
;;
:)
echo "Error: -${OPTARG} requires an argument."
usage
exit 1
;;
esac
done
if [ -z "$LOGO" ]
then
usage
fi
if [ -z "$NAME" ]
then
NAME="$(basename $LOGO)"
NAME="${NAME%.png}"
echo "Name not specified, using logo name: $NAME"
fi
if [ ! -f "$LOGO" ]
then
echo "Logo doesn't exist"
exit 1
fi
if [[ ! -z "$SPINNER" ]] && [[ ! -f "$SPINNER" ]]
then
SPINNER=".template/spinner.gif"
echo "Spinner doesn't exist, using default one"
elif [[ -z "$SPINNER" ]]
then
SPINNER=".template/spinner.gif"
echo "Spinner not specified, using default one"
fi
if [ -z "$POSITION" ]
then
POSITION=05
echo "Position not specified, using default one: bottom"
fi
if [ -z "$RCOLOR" ]
then
RCOLOR=00
GCOLOR=00
BCOLOR=00
echo "Color not specified, using default one: black"
fi
FRAMES=$(identify -format "%n\n" $SPINNER | head -1)
THDIR="manjaro-bootsplash-$NAME"
mkdir $THDIR
#cp ".template/bootsplash-manjaro-template.sh" "$THDIR/bootsplash-manjaro-$NAME.sh"
sed "s/template/$NAME/g" ".template/bootsplash-manjaro-template.sh" > "$THDIR/bootsplash-manjaro-$NAME.sh"
sed -i "s/logo.png/$(basename $LOGO)/g" "$THDIR/bootsplash-manjaro-$NAME.sh"
sed -i "s/spinner.gif/$(basename $SPINNER)/g" "$THDIR/bootsplash-manjaro-$NAME.sh"
sed -i "s/05/$POSITION/g" "$THDIR/bootsplash-manjaro-$NAME.sh"
sed -i "s/XX/$RCOLOR/g" "$THDIR/bootsplash-manjaro-$NAME.sh"
sed -i "s/YY/$GCOLOR/g" "$THDIR/bootsplash-manjaro-$NAME.sh"
sed -i "s/ZZ/$BCOLOR/g" "$THDIR/bootsplash-manjaro-$NAME.sh"
for (( i=0; i<10 && i<FRAMES; i++ ))
do
echo -e "\t--blob throbber0$i.rgb \\" >> "$THDIR/bootsplash-manjaro-$NAME.sh"
done
for (( i=10; i<FRAMES; i++ ))
do
echo -e "\t--blob throbber$i.rgb \\" >> "$THDIR/bootsplash-manjaro-$NAME.sh"
done
echo -e "\tbootsplash-manjaro-$NAME" >> "$THDIR/bootsplash-manjaro-$NAME.sh"
echo >> "$THDIR/bootsplash-manjaro-$NAME.sh"
echo "rm *.rgb" >> "$THDIR/bootsplash-manjaro-$NAME.sh"
sed "s/template/$NAME/g" ".template/bootsplash-manjaro-template.initcpio_install" > "$THDIR/bootsplash-manjaro-$NAME.initcpio_install"
sed "s/template/$NAME/g" ".template/PKGBUILD" > "$THDIR/PKGBUILD"
sed -i "s/logo.png/$(basename $LOGO)/g" "$THDIR/PKGBUILD"
sed -i "s/spinner.gif/$(basename $SPINNER)/g" "$THDIR/PKGBUILD"
sed "s/template/$NAME/g" ".template/README.md" > "$THDIR/README.md"
cp ".template/bootsplash-packer" "$THDIR/bootsplash-packer"
cp ".template/bootsplash-packer.rst" "$THDIR/bootsplash-packer.rst"
cp "$LOGO" "$THDIR/$(basename $LOGO)"
cp "$SPINNER" "$THDIR/$(basename $SPINNER)"
#( cd "$THDIR" && makepkg -sci ) for building and installing directly