aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilo Casagrande <milo@ubuntu.com>2013-09-09 11:03:52 +0200
committerMilo Casagrande <milo@ubuntu.com>2013-09-09 11:04:30 +0200
commitcd2caa750648dd9175ebe46db136fa267a6793b9 (patch)
treec8c74e23b3d77297f4bbb4c6d8107fa8104cdbf9
parent7c1cf4854c4efb526d6448fb3415208d2e04c4e8 (diff)
downloadgerrit-linaro-theme-cd2caa750648dd9175ebe46db136fa267a6793b9.tar.gz
Added simple update scripts to deploy changes, updated README.
Change-Id: Ie1ed44274f70dea0d35f8f4c7fc35a89def3ff47
-rw-r--r--README7
-rwxr-xr-xupdate/update-gerrit-theme36
2 files changed, 43 insertions, 0 deletions
diff --git a/README b/README
index 3be8b2a..b59be22 100644
--- a/README
+++ b/README
@@ -13,6 +13,13 @@ Install
That's all!
+Automatically Update
+====================
+
+In the `update/' directory there is a script to automatically pull changes
+from the gerrit-linaro-theme repository and copy the files in the correct
+directories.
+
Gerrit Documentation
====================
diff --git a/update/update-gerrit-theme b/update/update-gerrit-theme
new file mode 100755
index 0000000..3fb0a0c
--- /dev/null
+++ b/update/update-gerrit-theme
@@ -0,0 +1,36 @@
+#!/bin/bash
+# Simple script to auotmatically update gerrit linaro theme. Meant to run as
+# a cron job from the user owner of the gerrit directories.
+
+REPO_URL='http://staging.git.linaro.org/git-ro/lava-team/gerrit-linaro-theme'
+GIT_HOME=/home/git
+CO_DIR=$GIT_HOME/gerrit-linaro-theme
+GERRIT_DIR=/srv/gerrit
+TMP_FILE=/tmp/update-gerrit-theme.tmp
+# String to check if the git pull command pulls new changes.
+GIT_NO_UPDATE='Already up-to-date.'
+
+function update_repo() {
+ cd $CO_DIR
+ LANG=C git pull 2>/dev/null 1>$TMP_FILE
+ GIT_STATUS=`head -1 $TMP_FILE`
+ if [[ "$GIT_STATUS" = "$GIT_NO_UPDATE" ]]; then
+ return 1
+ fi
+}
+
+function copy_files() {
+ cp $CO_DIR/etc/* $GERRIT_DIR/etc/
+ cp $CO_DIR/static/* $GERRIT_DIR/static/
+}
+
+function clone_repo() {
+ cd $GIT_HOME
+ git clone $REPO_URL 2>/dev/null 1>/dev/null
+}
+
+if [[ -d $CO_DIR ]]; then
+ update_repo && copy_files
+else
+ clone_repo && copy_files
+fi