From 49c35d57333b880b812a00c29056cc86f90fa183 Mon Sep 17 00:00:00 2001 From: Andy Bauer Date: Sun, 15 Jan 2017 15:48:57 -0600 Subject: [PATCH] packpack - f24,f25,el7 confirmed working --- utils/packpack/fedora25_package.mk | 8 --- utils/packpack/redhat_package.mk | 8 +++ utils/packpack/startpackpack.sh | 78 ++++++++++++++++++++++++++---- 3 files changed, 77 insertions(+), 17 deletions(-) delete mode 100644 utils/packpack/fedora25_package.mk create mode 100644 utils/packpack/redhat_package.mk diff --git a/utils/packpack/fedora25_package.mk b/utils/packpack/fedora25_package.mk deleted file mode 100644 index f8a5ef029..000000000 --- a/utils/packpack/fedora25_package.mk +++ /dev/null @@ -1,8 +0,0 @@ -.PHONY: fedora25_package -.NOTPARALLEL: fedora25_package - -fedora25_package: fedora25_bootstrap package - -fedora25_bootstrap: - sudo dnf install -y --nogpgcheck build/zmrepo-25-1.fc25.noarch.rpm - diff --git a/utils/packpack/redhat_package.mk b/utils/packpack/redhat_package.mk new file mode 100644 index 000000000..c15e03528 --- /dev/null +++ b/utils/packpack/redhat_package.mk @@ -0,0 +1,8 @@ +.PHONY: redhat_package +.NOTPARALLEL: redhat_package + +redhat_package: redhat_bootstrap package + +redhat_bootstrap: + sudo yum install -y --nogpgcheck build/zmrepo.noarch.rpm + diff --git a/utils/packpack/startpackpack.sh b/utils/packpack/startpackpack.sh index 7b8fdaf19..42fb173ac 100755 --- a/utils/packpack/startpackpack.sh +++ b/utils/packpack/startpackpack.sh @@ -1,15 +1,75 @@ #!/bin/sh -# packpack setup file for ZoneMinder project +# packpack setup file for the ZoneMinder project # Written by Andrew Bauer -# This script is jsut a first start. It will change siginificantly as support -# for more distros is added. +# Check to see if this script has access to all the commands it needs +for CMD in set echo curl repoquery git ln mkdir patch; do + type $CMD &> /dev/null -ln -s distros/redhat rpm + if [ $? -ne 0 ]; then + echo + echo "ERROR: The script cannot find the required command \"${CMD}\"." + echo + exit -1 + fi +done + +# Verify OS & DIST environment variables have been set before calling this script +if [ -z "${OS}" ] || [ -z "${DIST}" ]; then + echo "ERROR: both OS and DIST environment variables must be set" + exit -1 +fi + +# Steps common to all builds mkdir -p build -curl https://zmrepo.zoneminder.com/f/25/i386/zmrepo-25-1.fc25.noarch.rpm > build/zmrepo-25-1.fc25.noarch.rpm -curl -L https://github.com/FriendsOfCake/crud/archive/v3.0.10.tar.gz > build/crud-3.0.10.tar.gz -git clone https://github.com/packpack/packpack.git packpack -patch -p1 < utils/packpack/autosetup.patch -packpack/packpack -f utils/packpack/fedora25_package.mk fedora25_package +if [ -e "packpack/Makefile" ]; then + echo "Checking packpack github repo for changes..." + git -C packpack pull origin master +else + echo "Cloning pakcpack github repo..." + git clone https://github.com/packpack/packpack.git packpack +fi + +# Steps common to Redhat distros +if [ "${OS}" == "el" ] || [ "${OS}" == "fedora" ]; then + CRUDVER="3.0.10" + echo "Retrieving Crud submodule..." + curl -L https://github.com/FriendsOfCake/crud/archive/v${CRUDVER}.tar.gz > build/crud-${CRUDVER}.tar.gz + + if [ $? -ne 0 ]; then + echo "ERROR: Crud tarball retreival failed..." + exit -1 + fi + + # %autosetup support has been merged upstream. No need to patch + #patch -p1 < utils/packpack/autosetup.patch + ln -sf distros/redhat rpm + + if [ "${OS}" == "el" ]; then + zmrepodistro=${OS} + else + zmrepodistro="f" + 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` + + if [ -n "$result" ] && [ $? -eq 0 ]; then + echo "Retrieving ZMREPO rpm..." + curl $result > build/zmrepo.noarch.rpm + else + echo "ERROR: Failed to retrieve zmrepo rpm..." + echo -1 + fi + + echo "Starting packpack..." + packpack/packpack -f utils/packpack/redhat_package.mk redhat_package + +# Steps common the Debian based distros +elif [ "${OS}" == "debian" ] || [ "${OS}" == "ubuntu" ]; then + + echo Do some stuff here + +fi +