-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathupdater
More file actions
executable file
·60 lines (51 loc) · 2.26 KB
/
updater
File metadata and controls
executable file
·60 lines (51 loc) · 2.26 KB
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
#!/bin/bash
#
# ScreenInvader - A shared media experience. Instant and seamless.
# Copyright (C) 2012 Amir Hassan <amir@viel-zu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
. ./initcgi "text/html"
# Get root privileges
sudo -s <<EOF
EOF
baseURL="https://raw.github.com/Metalab/ScreenInvader/master/src/lounge/triggers/helpers/"
helpers=($(cat /lounge/www/cgi-bin/show | grep /]=\' | cut -d "'" -f2 | sort -u))
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><meta http-equiv="Content-type" content="text/html;charset=UTF-8"></meta><title>ScreenInvader Update</title><html><head><link rel="stylesheet" type="text/css" href="../../_inc/css/lounge.css"><link rel="stylesheet" type="text/css" href="../_inc/css/admin.css"></link></head><body><form id="admin"><table><tbody><tr><td colspan="2" class="header">Update Results</td></tr>'
for i in "${helpers[@]}"
do
md5=($(md5sum /lounge/triggers/helpers/$i | cut -d " " -f1))
echo '<tr><td class="left">'$i'</td><td class="right">'
if wget --no-check-certificate -P "/lounge/triggers/helpers/tmp" $baseURL$i
then
if [ "$md5" == "$(md5sum /lounge/triggers/helpers/tmp/$i | cut -d ' ' -f1)" ]
then
echo 'Already up to date</td></tr>'
else
cp -f /lounge/triggers/helpers/tmp/$i /lounge/triggers/helpers/$i
echo 'Sucessfully updated</td></tr>'
fi
else
error="1"
echo 'ERROR</td></tr>'
fi
done
rm -r /lounge/triggers/helpers/tmp
if [ "$error" == "1" ]
then
echo '</tbody></table><br><span>Errors occured, try again later!</span></form></body>'
else
echo '</tbody></table><br><span>Update complete!</span></form></body>'
fi