From cf73a43d444d244d52a1f2344b5027a8c9993084 Mon Sep 17 00:00:00 2001
From: alvaro <alvaro@alia.(none)>
Date: Tue, 18 Dec 2012 15:21:47 -0800
Subject: [PATCH] Adding update option

---
 utils/lodspk.sh                   | 10 +++++++++-
 utils/modules/update-lodspeakr.sh | 19 +++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100755 utils/modules/update-lodspeakr.sh

diff --git a/utils/lodspk.sh b/utils/lodspk.sh
index 502b8125..c73af22c 100755
--- a/utils/lodspk.sh
+++ b/utils/lodspk.sh
@@ -32,6 +32,8 @@ USAGE=$USAGE" Remove any variable:\t\t\t\t\t$0 remove variable\n"
 USAGE=$USAGE" If the variable is part of LODSPeaKr, it will return to its default value\n"
 USAGE=$USAGE" \n===ADMIN USER===\n"
 USAGE=$USAGE" Change password:\t\t\t\t\t$0 change password NEWPASSWORD\n"
+USAGE=$USAGE" \n===UPDATE===\n"
+USAGE=$USAGE" Update LODSPeaKr:\t\t\t\t\t$0 update\n"
 USAGE=$USAGE"\n===VERSION==\n"
 USAGE=$USAGE" Version:\t\t\t\t\t\t$0 version\n"
 USAGEDEBUG="Usage: $0 debug on|off"
@@ -41,7 +43,7 @@ if [[ $# -eq 0 || "$1" == "--help" ]]; then
 fi
 
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-operations=( create delete debug backup restore default cache version enable disable add remove list details change )
+operations=( create delete debug backup restore default cache version enable disable add remove list details change update )
 currentOperation=
 
 if [[ ${operations[@]} =~ $1 ]]; then
@@ -325,3 +327,9 @@ if [[ $currentOperation == "change" ]]; then
   php $DIR/modules/change-password.php $3
   exit
 fi
+
+## Update
+if [[ $currentOperation == "update" ]]; then
+  $DIR/modules/update-lodspeakr.sh
+  exit
+fi
diff --git a/utils/modules/update-lodspeakr.sh b/utils/modules/update-lodspeakr.sh
new file mode 100755
index 00000000..de6e5585
--- /dev/null
+++ b/utils/modules/update-lodspeakr.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+cd $DIR/../..
+GIT=`which git`
+if [ -z $GIT ];then
+  echo "No git found. Aborting"
+  exit 1
+fi
+
+echo Updating LODSPeaKr
+$GIT pull -q
+if [ "$?" != 0 ];then
+  echo "Update couldn't finish properly. Stopping further actions"
+  exit 0
+fi
+
+echo Updating GUI elements
+cp -rf doc/examples/originalComponents/static/admin/* components/static/admin/
-- 
GitLab