-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmmupdate.icg
36 lines (36 loc) · 1.09 KB
/
mmupdate.icg
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
#!/bin/bash
## Settings ##
DIR="release/"
TTL="golly_vectorializer"
APP=".app/Contents/Java"
EXT=".java"
cd $DIR
if [ "$REQUEST_METHOD" = POST ]; then
query=$( head --bytes="$CONTENT_LENGTH" )
else
query="$QUERY_STRING"
fi
echo "Content-Type: text/plain"
echo
if [ "$query" = "" ]; then
echo "Giovine, che stai a prendere in giro?"
else
echo "Query=$query"
## gathering latest file info ##
latestEdited=$(ls -ltr | grep '.zip' | tail -1 | awk '{print $9}')
unzip -ou $latestEdited
cd $TTL$APP
latestJar=$(ls -l | grep $TTL )
latestFilename=$(echo $latestJar | awk '{print $9}')
latestSize=$(echo $latestJar | awk '{print $5}')
latestMD5=$(md5sum $latestFilename | awk '{print $1}')
if [ "$latestEdited" = "" ]; then
echo "Answer=:NoFilesFound"
else
if [ "?$latestMD5" == "$query" ]; then
echo "Answer=:UpToDate"
else
echo "Answer=:"$latestMD5":"$latestFilename":"$latestSize
fi
fi
fi