diff options
Diffstat (limited to 'libre/parabolaweb-utils/parabolaweb-update')
-rw-r--r-- | libre/parabolaweb-utils/parabolaweb-update | 62 |
1 files changed, 29 insertions, 33 deletions
diff --git a/libre/parabolaweb-utils/parabolaweb-update b/libre/parabolaweb-utils/parabolaweb-update index b8ac5bf5e..45e17c4f2 100644 --- a/libre/parabolaweb-utils/parabolaweb-update +++ b/libre/parabolaweb-utils/parabolaweb-update @@ -2,39 +2,30 @@ set -e . /etc/conf.d/parabolaweb - - -_install_dir=${WEBDIR%/*} -_gitname=${WEBDIR##*/} -_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" +find_makefiles() { + pushd "$WEBDIR" > /dev/null + echo ./sitestatic + find . -name static -type d | while read dir; do + if [[ -e "$WEBDIR/$dir/Makefile" ]]; then + printf '%s\n' "$dir" + fi + done } clean() { msg "Purging old .pyc files...." - cd "$_install_dir/$_gitname" + cd "$WEBDIR" find . -name '*.pyc' -delete + for dir in `find_makefiles`; do + make -C "$WEBDIR/$dir" clean + done } configure() { msg "Checking configuration...." - cd "$_install_dir/$_gitname" + cd "$WEBDIR" if [[ ! -f local_settings.py ]]; then msg2 "Configuration file missing, opening editor..." cp local_settings.py.example local_settings.tmp.$$.py @@ -52,33 +43,38 @@ configure() { fi } -migrate() { +update-database() { msg "Updating database...." + cd "$WEBDIR" msg2 "Running migrations...." ./manage.py migrate msg2 "Loading fixtures...." ./manage.py loaddata */fixtures/*.json } +update-filesystem() { + msg "Updating filesystem..." + for dir in `find_makefiles`; do + msg2 "Updating $dir with GNU Make..." + make -C "$WEBDIR/$dir" + done + cd "$WEBDIR" + msg2 "Collecting static files..." + echo yes | ./manage.py collectstatic -l +} + main() { if [[ -z "$EDITOR" ]]; then error 'Please set the $EDITOR variable' exit 1 fi - [[ ! -d "$_install_dir" ]] && mkdir "$_install_dir" - - download + parabolaweb-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 + update-database + update-filesystem } main "$@" |