From 285e04bbf8ac3938e28a58c166d0aaac2baf19a6 Mon Sep 17 00:00:00 2001 From: Andy Bauer Date: Sat, 4 Mar 2017 10:30:36 -0600 Subject: [PATCH] move code into subroutines, retire installzm.sh --- .travis.yml | 1 - utils/packpack/installzm.sh | 1 + utils/packpack/startpackpack.sh | 60 ++++++++++++++++++++------------- 3 files changed, 37 insertions(+), 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2dff68f61..a06ceabfe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,7 +35,6 @@ services: - docker script: - utils/packpack/startpackpack.sh -- utils/packpack/installzm.sh before_deploy: - openssl aes-256-cbc -K $encrypted_92a2ad18ba0b_key -iv $encrypted_92a2ad18ba0b_iv diff --git a/utils/packpack/installzm.sh b/utils/packpack/installzm.sh index c029bf571..31e54866f 100755 --- a/utils/packpack/installzm.sh +++ b/utils/packpack/installzm.sh @@ -1,4 +1,5 @@ #!/bin/bash +# No longer needed. This was incorporated into startpackpack.sh # Required, so that Travis marks the build as failed if any of the steps below fail set -ev diff --git a/utils/packpack/startpackpack.sh b/utils/packpack/startpackpack.sh index aba40d5bb..4ecd57c27 100755 --- a/utils/packpack/startpackpack.sh +++ b/utils/packpack/startpackpack.sh @@ -24,7 +24,7 @@ checksanity () { done # Verify OS & DIST environment variables have been set before calling this script - if [ -z "${OS}" ] || [ -z "${DIST}" ]; then + if [ -z "${OS}" ] || [ -z ""${DIST}"" ]; then echo "ERROR: both OS and DIST environment variables must be set" exit 1 fi @@ -56,6 +56,29 @@ commonprep () { fi } +# Uncompress the Crud tarball and move it into place +movecrud () { + if [ -e "web/api/app/Plugin/Crud/LICENSE.txt" ]; then + echo "Crud plugin already installed..." + else + echo "Unpacking Crud plugin..." + tar -xzf build/crud-${CRUDVER}.tar.gz + rmdir web/api/app/Plugin/Crud + mv -f crud-${CRUDVER} web/api/app/Plugin/Crud + fi +} + +# previsouly part of installzm.sh +# install the trusty deb and test zoneminder +installtrusty () { + # Install and test the zoneminder package (only) for Ubuntu Trusty + sudo gdebi --non-interactive build/zoneminder_*amd64.deb + sudo chmod 644 /etc/zm/zm.conf + mysql -uzmuser -pzmpass zm < db/test.monitor.sql + sudo /usr/bin/zmpkg.pl start + sudo /usr/bin/zmfilter.pl -f purgewhenfull +} + ################ # MAIN PROGRAM # ################ @@ -93,7 +116,7 @@ if [ "${TRAVIS_EVENT_TYPE}" == "cron" ]; then fi # Let repoquery determine the full url and filename of the zmrepo rpm we are interested in - result=`repoquery --repofrompath=zmpackpack,https://zmrepo.zoneminder.com/${zmrepodistro}/${DIST}/x86_64/ --repoid=zmpackpack --qf="%{location}" zmrepo 2> /dev/null` + result=`repoquery --repofrompath=zmpackpack,https://zmrepo.zoneminder.com/${zmrepodistro}/"${DIST}"/x86_64/ --repoid=zmpackpack --qf="%{location}" zmrepo 2> /dev/null` if [ -n "$result" ] && [ $? -eq 0 ]; then echo "Retrieving ZMREPO rpm..." @@ -117,19 +140,11 @@ if [ "${TRAVIS_EVENT_TYPE}" == "cron" ]; then # patch -p1 < utils/packpack/deb.mk.patch #fi - # Uncompress the Crud tarball and move it into place - if [ -e "web/api/app/Plugin/Crud/LICENSE.txt" ]; then - echo "Crud plugin already installed..." - else - echo "Unpacking Crud plugin..." - tar -xzf build/crud-${CRUDVER}.tar.gz - rmdir web/api/app/Plugin/Crud - mv -f crud-${CRUDVER} web/api/app/Plugin/Crud - fi + movecrud - if [ ${DIST} == "trusty" ] || [ ${DIST} == "precise" ]; then + if [ "${DIST}" == "trusty" ] || [ "${DIST}" == "precise" ]; then ln -sf distros/ubuntu1204 debian - elif [ ${DIST} == "wheezy" ]; then + elif [ "${DIST}" == "wheezy" ]; then ln -sf distros/debian debian else ln -sf distros/ubuntu1604 debian @@ -137,25 +152,22 @@ if [ "${TRAVIS_EVENT_TYPE}" == "cron" ]; then echo "Starting packpack..." packpack/packpack + + if [ "${OS}" == "ubuntu" ] && [ "${DIST}" == "trusty" ]; then + installtrusty + fi fi # We were not triggered via cron so just build and test trusty -elif [ "${OS}" == "debian" ] && [ ${DIST} == "trusty" ]; then +elif [ "${OS}" == "ubuntu" ] && [ "${DIST}" == "trusty" ]; then commonprep - - # Uncompress the Crud tarball and move it into place - if [ -e "web/api/app/Plugin/Crud/LICENSE.txt" ]; then - echo "Crud plugin already installed..." - else - echo "Unpacking Crud plugin..." - tar -xzf build/crud-${CRUDVER}.tar.gz - rmdir web/api/app/Plugin/Crud - mv -f crud-${CRUDVER} web/api/app/Plugin/Crud - fi + movecrud ln -sf distros/ubuntu1204 debian echo "Starting packpack..." packpack/packpack + + installtrusty fi