summaryrefslogtreecommitdiff
path: root/libre/parabolaweb-utils/parabolaweb-download
diff options
context:
space:
mode:
authorAndré Fabian Silva Delgado <emulatorman@lavabit.com>2012-10-27 15:11:21 -0200
committerAndré Fabian Silva Delgado <emulatorman@lavabit.com>2012-10-27 15:11:21 -0200
commit2f1f1d2d1b65f6620a3246a477a8829fbd0c6ed6 (patch)
treefec094bf9628b277ed62530e9c91ab67dc321eac /libre/parabolaweb-utils/parabolaweb-download
parentc208af690e803333dfe44031126a677755196353 (diff)
parenta957024315d06271ceb557b40512d728a15da2b4 (diff)
downloadabslibre-2f1f1d2d1b65f6620a3246a477a8829fbd0c6ed6.tar.gz
abslibre-2f1f1d2d1b65f6620a3246a477a8829fbd0c6ed6.tar.bz2
abslibre-2f1f1d2d1b65f6620a3246a477a8829fbd0c6ed6.zip
Merge branch 'master' of ssh://parabolagnulinux.org:1863/srv/git/abslibre
Diffstat (limited to 'libre/parabolaweb-utils/parabolaweb-download')
-rw-r--r--libre/parabolaweb-utils/parabolaweb-download47
1 files changed, 47 insertions, 0 deletions
diff --git a/libre/parabolaweb-utils/parabolaweb-download b/libre/parabolaweb-utils/parabolaweb-download
new file mode 100644
index 000000000..823a18811
--- /dev/null
+++ b/libre/parabolaweb-utils/parabolaweb-download
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+. /etc/conf.d/parabolaweb
+. /usr/bin/libremessages
+
+dir=$WEBDIR
+repo=git://parabolagnulinux.org/parabolaweb.git
+ref=master
+
+cd_safe() {
+ if ! cd "$1"; then
+ error "$(gettext "Failed to change to directory %s")" "$1"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+}
+
+download_git() {
+ if [[ ! -d "$dir/.git" ]] ; then
+ msg2 "$(gettext "Cloning %s %s repo...")" "${repo}" "git"
+ if ! git clone "$repo" "$dir"; then
+ error "$(gettext "Failure while downloading %s %s repo")" "${repo}" "git"
+ plain "$(gettext "Aborting...")"
+ exit 1
+ fi
+ else
+ cd_safe "$dir"
+ # Make sure we are fetching the right repo
+ # if [[ "$repo" != "$(git config --get remote.origin.url)" ]] ; then
+ # error "$(gettext "%s is not a clone of %s")" "$dir" "$repo"
+ # plain "$(gettext "Aborting...")"
+ # exit 1
+ # fi
+ msg2 "$(gettext "Updating %s %s repo...")" "${repo}" "git"
+ if ! git pull origin "$ref"; then
+ # only warn on failure to allow offline builds
+ warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "git"
+ fi
+ fi
+}
+
+main() {
+ [[ -d "${dir%/*}" ]] || mkdir -p "${dir%/*}"
+ download_git
+}
+
+main "$@"