summaryrefslogtreecommitdiff
path: root/parabolaweb-update
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2012-10-21 01:07:09 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2012-10-21 01:07:09 -0400
commitdc45b9430e9c3716cd51152ca757753ebb177d66 (patch)
tree4bda2ef090ee0b4570d317e5cb7135f586eeb928 /parabolaweb-update
parent8a605d4d9f6a191081d2d2e71badfd75a3c0a66a (diff)
improve libre/parabolaweb-utils
meta: * add `python2-flup` as a dependency (needed for fcgi) filesystem: * mv `/usr/sbin/{update-parabolaweb,parabolaweb-update}` * pull `/usr/sbin/parabolaweb-fgci` out of `/etc/rc.d/parabolaweb` * pull `/etc/conf.d/parabolaweb` out of `/etc/rc.d/parabolaweb` * add `/usr/lib/systemd/system/parabolaweb.service`
Diffstat (limited to 'parabolaweb-update')
-rw-r--r--parabolaweb-update81
1 files changed, 81 insertions, 0 deletions
diff --git a/parabolaweb-update b/parabolaweb-update
new file mode 100644
index 0000000..e4d65c2
--- /dev/null
+++ b/parabolaweb-update
@@ -0,0 +1,81 @@
+#!/bin/bash
+set -e
+
+_install_dir=/srv/http
+_gitname=web
+_gitroot=git://parabolagnulinux.org/parabolaweb.git
+_gitbranch=master
+
+. /usr/bin/libremessages
+
+download() {
+ msg "Connecting to GIT server...."
+ cd "$_install_dir"
+ if [[ -d ${_gitname} ]]; then
+ msg2 "Updating existing tree"
+ cd ${_gitname} && git pull ${_gitroot}
+ else
+ msg2 "Cloning tree"
+ git clone ${_gitroot} ${_gitname}
+ cd ${_gitname}
+ fi
+ git checkout ${_gitbranch}
+ msg "GIT checkout done or server timeout"
+}
+
+clean() {
+ msg "Purging old .pyc files...."
+ cd "$_install_dir/$_gitname"
+ find . -name '*.pyc' -delete
+}
+
+configure() {
+ msg "Checking configuration...."
+ cd "$_install_dir/$_gitname"
+ if [[ ! -f local_settings.py ]]; then
+ msg2 "Configuration file missing, opening editor..."
+ cp local_settings.py.example local_settings.tmp.$$.py
+ if "$EDITOR" local_settings.tmp.$$.py; then
+ mv local_settings.tmp.$$.py local_settings.py
+ else
+ rm local_settings.tmp.$$.py
+ msg "Failed to configure, exiting"
+ exit 1
+ fi
+ msg2 "Creating database...."
+ ./manage.py syncdb
+ else
+ msg2 "Current configuration checks out"
+ fi
+}
+
+migrate() {
+ msg "Updating database...."
+ msg2 "Running migrations...."
+ ./manage.py migrate
+ msg2 "Loading fixtures...."
+ ./manage.py loaddata */fixtures/*.json
+}
+
+main() {
+ if [[ -z "$EDITOR" ]]; then
+ error 'Please set the $EDITOR variable'
+ exit 1
+ fi
+
+ [[ ! -d "$_install_dir" ]] && mkdir "$_install_dir"
+
+ download
+ clean
+ configure
+ clean
+ migrate
+
+ msg "Checking media/admin_media symlink...."
+ if [ ! -e media/admin-media ]; then
+ rm media/admin_media
+ ln -s /usr/lib/python2.7/site-packages/django/contrib/admin/media media/admin_media
+ fi
+}
+
+main "$@"