-
Notifications
You must be signed in to change notification settings - Fork 0
/
jss_rebuild.sh
executable file
·60 lines (57 loc) · 1.33 KB
/
jss_rebuild.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
#!/bin/bash
unzip -qq -o -d /tmp/JSS ~/Downloads/JSSInstallation/JSS\ Components/ROOT.war
OLD="Library\/JSS\/Logs"
NEW="var\/log\/JSS"
DPATH="/tmp/JSS/WEB-INF/classes/log4j.properties"
BPATH="/tmp"
TFILE="/tmp/out.tmp.$$"
[ ! -d $BPATH ] && mkdir -p $BPATH || :
for f in $DPATH
do
if [ -f $f -a -r $f ]; then
/bin/cp -f $f $BPATH
sed "s/$OLD/$NEW/g" "$f" > $TFILE && mv $TFILE "$f"
else
echo "Error: Cannot read $f"
fi
done
/bin/rm $TFILE
OLD2="jamfsw03"
NEW2="YOUR_PASSWORD"
DPATH2="/tmp/JSS/WEB-INF/xml/DataBase.xml"
BPATH2="/tmp"
TFILE2="/tmp/out.tmp.$$"
[ ! -d $BPATH2 ] && mkdir -p $BPATH2 || :
for f in $DPATH2
do
if [ -f $f -a -r $f ]; then
/bin/cp -f $f $BPATH2
sed "s/$OLD2/$NEW2/g" "$f" > $TFILE2 && mv $TFILE2 "$f"
else
echo "Error: Cannot read $f"
fi
done
/bin/rm $TFILE2
OLD3="localhost"
NEW3="YOUR_DB_SERVER"
DPATH3="/tmp/JSS/WEB-INF/xml/DataBase.xml"
BPATH3="/tmp"
TFILE3="/tmp/out.tmp.$$"
[ ! -d $BPATH3 ] && mkdir -p $BPATH3 || :
for f in $DPATH3
do
if [ -f $f -a -r $f ]; then
/bin/cp -f $f $BPATH3
sed "s/$OLD3/$NEW3/g" "$f" > $TFILE3 && mv $TFILE3 "$f"
else
echo "Error: Cannot read $f"
fi
done
echo 'Files edited'
cd /tmp/JSS ;
echo 'Building WAR file'
zip -r -qq ~/Documents/NEW_ROOT.war *
echo 'Cleaning up'
/bin/rm -rf /tmp/JSS /tmp/log4j.properties /tmp/DataBase.xml
echo 'All done'
exit 0