forked from genny-project/keycloak-themes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.sh
executable file
·46 lines (39 loc) · 1.14 KB
/
package.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
#!/bin/bash
# Clear the deployments directory
rm -rf deployments
mkdir deployments
# Enter themes and clear the temporary directory
cd themes
rm -rf tmpDir
echo "packaging jar - ${1}"
# Create temporary directory for jarring and copy theme contents
mkdir -p tmpDir/META-INF
mkdir tmpDir/theme
cp -r $1 tmpDir/theme
cd $1
# create the keycloak-themes.json file used for jarring
echo "{" >> ../tmpDir/META-INF/keycloak-themes.json
echo " \"themes\": [{" >> ../tmpDir/META-INF/keycloak-themes.json
echo " \"name\" : \"${1}\"," >> ../tmpDir/META-INF/keycloak-themes.json
echo " \"types\": [ " >> ../tmpDir/META-INF/keycloak-themes.json
for t in */ ; do
t=${t%*/}
if [ $t == "welcome" ]
then
echo " \"$t\"" >> ../tmpDir/META-INF/keycloak-themes.json
else
echo " \"$t\"," >> ../tmpDir/META-INF/keycloak-themes.json
fi
done
echo " ]" >> ../tmpDir/META-INF/keycloak-themes.json
echo " }]" >> ../tmpDir/META-INF/keycloak-themes.json
echo "}" >> ../tmpDir/META-INF/keycloak-themes.json
cd ../tmpDir
# create the jar file and copy to deployments dir
rm ${1}.jar 2> /dev/null
jar cf ${1}.jar .
mv ${1}.jar ../../deployments
cd ..
# clean up
rm -rf tmpDir
cd ..