summaryrefslogtreecommitdiff
path: root/parabolaweb-download
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-10-27 11:34:56 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-10-27 11:34:56 -0400
commit0d0f49a606d5228968476e5ab88a4081429e4f51 (patch)
treee01aac262605fcac05bee900e80f1b44a6ed1efe /parabolaweb-download
parentb27f7f38470297397a50e6fe810ccd908dc19fb7 (diff)
improve libre/parabolaweb-utils
filesystem: * pull parabolaweb-download out of parabolaweb-update * parabolaweb-update: teach about Makefiles * parabolaweb-update: use collectstatic
Diffstat (limited to 'parabolaweb-download')
-rw-r--r--parabolaweb-download47
1 files changed, 47 insertions, 0 deletions
diff --git a/parabolaweb-download b/parabolaweb-download
new file mode 100644
index 0000000..823a188
--- /dev/null
+++ b/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 "$@"