From 42194a038a1cebd17e25ae52985ea55b51a241d9 Mon Sep 17 00:00:00 2001 From: PwnicornDev Date: Thu, 16 May 2013 06:11:49 +0200 Subject: [PATCH 1/2] Fix for issue #73 (Video script updater) This is a basic updater, accessible from admin interface. It checks which scripts are supported by the running build and fetches updates from GitHub. --- src/lounge/www/admin/cgi-bin/updater | 60 ++++++++++++++++++++++++++++ src/lounge/www/admin/index.html | 3 ++ 2 files changed, 63 insertions(+) create mode 100755 src/lounge/www/admin/cgi-bin/updater diff --git a/src/lounge/www/admin/cgi-bin/updater b/src/lounge/www/admin/cgi-bin/updater new file mode 100755 index 000000000..4024ca856 --- /dev/null +++ b/src/lounge/www/admin/cgi-bin/updater @@ -0,0 +1,60 @@ +#!/bin/bash +# +# ScreenInvader - A shared media experience. Instant and seamless. +# Copyright (C) 2012 Amir Hassan +# +# 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 <ScreenInvader Update
' + +for i in "${helpers[@]}" +do + md5=($(md5sum /lounge/triggers/helpers/$i | cut -d " " -f1)) + echo '' + else + cp -f /lounge/triggers/helpers/tmp/$i /lounge/triggers/helpers/$i + echo 'Sucessfully updated' + fi + else + error="1" + echo 'ERROR' + fi +done + +rm -r /lounge/triggers/helpers/tmp + +if [ "$error" == "1" ] +then + echo '
Update Results
'$i'' + if wget -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

Errors occured, try again later!
' +else + echo '
Update complete!' +fi + diff --git a/src/lounge/www/admin/index.html b/src/lounge/www/admin/index.html index 949f8b5a1..65197f558 100644 --- a/src/lounge/www/admin/index.html +++ b/src/lounge/www/admin/index.html @@ -143,6 +143,9 @@
+
+ Update Video Download Scripts +
From 6dd83f10599af758256148053a09ac229eff7320 Mon Sep 17 00:00:00 2001 From: Pwnicorn Date: Tue, 22 Apr 2014 06:47:29 +0200 Subject: [PATCH 2/2] Ignore certificate errors GitHub herped their derp and now wget fails to get the files securely. Added --no-check-certificate as a workaround. --- src/lounge/www/admin/cgi-bin/updater | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lounge/www/admin/cgi-bin/updater b/src/lounge/www/admin/cgi-bin/updater index 4024ca856..24fd34a08 100755 --- a/src/lounge/www/admin/cgi-bin/updater +++ b/src/lounge/www/admin/cgi-bin/updater @@ -34,7 +34,7 @@ for i in "${helpers[@]}" do md5=($(md5sum /lounge/triggers/helpers/$i | cut -d " " -f1)) echo ''$i'' - if wget -P "/lounge/triggers/helpers/tmp" $baseURL$i + 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