From e3f073b275e4e60e5fd8e6e55cf3d0a1950925aa Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 14 Jan 2017 09:58:36 -0500 Subject: [PATCH 01/10] update to add binary options, dput to ppa and use alternate fork. Also support newer distros and wheezy. --- utils/do_debian_package.sh | 139 ++++++++++++++++++++++++++++--------- 1 file changed, 105 insertions(+), 34 deletions(-) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index 49c91acfc..3a47704ec 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -12,44 +12,78 @@ fi DATE=`date -R` DISTRO=$1 SNAPSHOT=$2 -if [ "$SNAPSHOT" == "stable" ]; then -SNAPSHOT=""; -fi; - TYPE=$3 if [ "$TYPE" == "" ]; then -TYPE="source"; + echo "Defaulting to source build" + TYPE="source"; fi; BRANCH=$4 - - -if [ ! -d 'zoneminder_release' ]; then - git clone https://github.com/ZoneMinder/ZoneMinder.git zoneminder_release +GITHUB_FORK=$5 +if [ "$GITHUB_FORK" == "" ]; then + echo "Defaulting to ZoneMinder upstream git" + GITHUB_FORK="ZoneMinder" fi; -if [ "$BRANCH" != "" ]; then - cd zoneminder_release - if [ "$BRANCH" == "stable" ]; then - BRANCH=$(git describe --tags $(git rev-list --tags --max-count=1)); - echo "Latest stable branch is $BRANCH"; - - fi - git checkout $BRANCH - cd ../ + +if [ "$SNAPSHOT" == "stable" ]; then + if [ "$BRANCH" == "" ]; then + BRANCH=$(git describe --tags $(git rev-list --tags --max-count=1)); + echo "Latest stable branch is $BRANCH"; + fi; +else + if [ "$BRANCH" == "" ]; then + echo "Defaulting to master branch"; + BRANCH="master"; + fi; fi; -VERSION=`cat zoneminder_release/version` + +# Instead of cloning from github each time, if we have a fork lying around, update it and pull from there instead. +if [ ! -d "${GITHUB_FORK}_zoneminder_release" ]; then + if [ -d "${GITHUB_FORK}_ZoneMinder.git" ]; then + echo "Using local clone ${GITHUB_FORK}_ZoneMinder.git to pull from." + cd "${GITHUB_FORK}_ZoneMinder.git" + echo "git checkout $BRANCH" + git checkout $BRANCH + echo "git pull..." + git pull + cd ../ + echo "git clone ${GITHUB_FORK}_ZoneMinder.git ${GITHUB_FORK}_zoneminder_release" + git clone "${GITHUB_FORK}_ZoneMinder.git" "${GITHUB_FORK}_zoneminder_release" + else + echo "git clone https://github.com/$GITHUB_FORK/ZoneMinder.git ${GITHUB_FORK}_zoneminder_release" + git clone "https://github.com/$GITHUB_FORK/ZoneMinder.git" "${GITHUB_FORK}_zoneminder_release" + fi +else + echo "release dir already exists. Please remove it." + exit 0; +fi; + +cd "${GITHUB_FORK}_zoneminder_release" +git checkout $BRANCH +cd ../ + +VERSION=`cat ${GITHUB_FORK}_zoneminder_release/version` if [ $VERSION == "" ]; then exit 1; fi; -echo "Doing $TYPE release zoneminder_$VERSION-$DISTRO-$SNAPSHOT"; -mv zoneminder_release zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig -cd zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig +DIRECTORY="zoneminder_$VERSION-$DISTRO"; +if [ "$SNAPSHOT" != "stable" ] && [ "$SNAPSHOT" != "" ]; then + DIRECTORY="$DIRECTORY-$SNAPSHOT"; +fi; +echo "Doing $TYPE release $DIRECTORY"; +mv "${GITHUB_FORK}_zoneminder_release" "$DIRECTORY.orig"; +cd "$DIRECTORY.orig"; + git submodule init git submodule update --init --recursive -if [ $DISTRO == "trusty" ]; then -ln -sf distros/ubuntu1204 debian -else -ln -sf distros/ubuntu1604 debian +if [ $DISTRO == "trusty" ] || [ $DISTRO == "precise" ]; then + ln -sf distros/ubuntu1204 debian +else + if [ $DISTRO == "wheezy" ]; then + ln -sf distros/debian debian + else + ln -sf distros/ubuntu1604 debian + fi; fi; # Auto-install all ZoneMinder's depedencies using the Debian control file @@ -62,14 +96,25 @@ else AUTHOR="`getent passwd $USER | cut -d ':' -f 5 | cut -d ',' -f 1` <`whoami`@`hostname`>" fi +if [ "$SNAPSHOT" == "stable" ]; then +cat < debian/changelog +zoneminder ($VERSION-$DISTRO) $DISTRO; urgency=medium + + * Release $VERSION + + -- $AUTHOR $DATE + +EOF +else cat < debian/changelog zoneminder ($VERSION-$DISTRO-$SNAPSHOT) $DISTRO; urgency=medium * - -- $AUTHOR $DATE + -- $AUTHOR $DATE EOF +fi; #rm -rf .git #rm .gitignore #cd ../ @@ -78,18 +123,44 @@ EOF if [ $TYPE == "binary" ]; then debuild else - if [ $TYPE == "local" ]; then - debuild -i -us -uc -b - else - debuild -S -sa - fi; + if [ $TYPE == "local" ]; then + debuild -i -us -uc -b + else + debuild -S -sa + fi; fi; cd ../ - read -p "Do you want to keep the checked out version of Zoneminder (incase you want to modify it later) [y/N]" -[[ $REPLY == [yY] ]] && { mv zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig zoneminder_release; echo "The checked out copy is preserved in zoneminder_release"; } || { rm -fr zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig; echo "The checked out copy has been deleted"; } +[[ $REPLY == [yY] ]] && { mv $DIRECTORY zoneminder_release; echo "The checked out copy is preserved in zoneminder_release"; } || { rm -fr $DIRECTORY; echo "The checked out copy has been deleted"; } echo "Done!" +if [ $TYPE == "binary" ]; then + echo "Not doing dput since it's a binary release. Do you want to install it? (Y/N)" + read install + if [ "$install" == "Y" ]; then + sudo dpkg -i $DIRECTORY*.deb + fi; +else + SC=""; + PPA=""; + if [ "$SNAPSHOT" == "stable" ]; then + PPA="ppa:iconnor/zoneminder"; + SC="zoneminder_${VERSION}-${DISTRO}_source.changes"; + else + SC="zoneminder_${VERSION}-${DISTRO}-${SNAPSHOT}_source.changes"; + if [ "$BRANCH" == "" ]; then + PPA="ppa:iconnor/zoneminder-master"; + else + PPA="ppa:iconnor/zoneminder-$BRANCH"; + fi; + fi; + + echo "Ready to dput $SC to $PPA ? Y/N..."; + read dput + if [ "$dput" == "Y" -o "$dput" == "y" ]; then + dput $PPA $SC + fi; +fi; From b8dcebadd5f6faa53e118f3f88ce4cad4f89c0af Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 14 Jan 2017 10:01:55 -0500 Subject: [PATCH 02/10] remove iconnor references --- utils/do_debian_package.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index 3a47704ec..5eba828c6 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -102,7 +102,7 @@ zoneminder ($VERSION-$DISTRO) $DISTRO; urgency=medium * Release $VERSION - -- $AUTHOR $DATE + -- $AUTHOR $DATE EOF else @@ -111,7 +111,7 @@ zoneminder ($VERSION-$DISTRO-$SNAPSHOT) $DISTRO; urgency=medium * - -- $AUTHOR $DATE + -- $AUTHOR $DATE EOF fi; From d7f81393a8ad07f0c146d8e63a82914e17348a0c Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 14 Jan 2017 10:53:05 -0500 Subject: [PATCH 03/10] fixes to detect and use environment variables for AUTHOR and debsign keys --- utils/do_debian_package.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index 5eba828c6..ae2fff45f 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -90,10 +90,14 @@ fi; sudo apt-get install devscripts equivs sudo mk-build-deps -ir ./debian/control -if [ -z `hostname -d` ] ; then - AUTHOR="`getent passwd $USER | cut -d ':' -f 5 | cut -d ',' -f 1` <`whoami`@`hostname`.local>" +if [ "$DEBEMAIL" != "" ] && [ "$DEBFULLNAME" != "" ]; then + AUTHOR="$DEBFULLNAME <$DEBEMAIL>" else - AUTHOR="`getent passwd $USER | cut -d ':' -f 5 | cut -d ',' -f 1` <`whoami`@`hostname`>" + if [ -z `hostname -d` ] ; then + AUTHOR="`getent passwd $USER | cut -d ':' -f 5 | cut -d ',' -f 1` <`whoami`@`hostname`.local>" + else + AUTHOR="`getent passwd $USER | cut -d ':' -f 5 | cut -d ',' -f 1` <`whoami`@`hostname`>" + fi fi if [ "$SNAPSHOT" == "stable" ]; then @@ -121,14 +125,18 @@ fi; #tar zcf zoneminder_$VERSION-$DISTRO.orig.tar.gz zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig #cd zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig if [ $TYPE == "binary" ]; then - debuild + DEBUILD=debuild else if [ $TYPE == "local" ]; then - debuild -i -us -uc -b + DEBUILD="debuild -i -us -uc -b" else - debuild -S -sa + DEBUILD="debuild -S -sa" fi; fi; +if [ "$DEBSIGN_KEYID" != "" ]; then + DEBUILD="$DEBUILD -k$DEBSIGN_KEYID" +fi +$DEBUILD cd ../ read -p "Do you want to keep the checked out version of Zoneminder (incase you want to modify it later) [y/N]" From a30af05bcf17ce4d0fd95b72588b2c73725ffd2a Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 15 Jan 2017 12:18:51 -0500 Subject: [PATCH 04/10] change parameters to use -o= or --option= and add interactive flag --- utils/do_debian_package.sh | 69 +++++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 15 deletions(-) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index ae2fff45f..46436d2a2 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -8,18 +8,48 @@ exit; fi +for i in "$@" +do +case $i in + -b=*|--branch=*) + BRANCH="${i#*=}" + shift # past argument=value + ;; + -d=*|--distro=*) + DISTRO="${i#*=}" + shift # past argument=value + ;; + -i=*|--interactive=*) + INTERACTIVE="${i#*=}" + shift # past argument=value + ;; + -s=*|--snapshot=*) + SNAPSHOT="${i#*=}" + shift # past argument=value + ;; + -t=*|--type=*) + TYPE="${i#*=}" + shift # past argument=value + ;; + -f=*|--fork=*) + GITHUB_FORK="${i#*=}" + shift # past argument=value + ;; + --default) + DEFAULT=YES + shift # past argument with no value + ;; + *) + # unknown option + ;; +esac +done DATE=`date -R` -DISTRO=$1 -SNAPSHOT=$2 - -TYPE=$3 if [ "$TYPE" == "" ]; then echo "Defaulting to source build" TYPE="source"; fi; -BRANCH=$4 -GITHUB_FORK=$5 if [ "$GITHUB_FORK" == "" ]; then echo "Defaulting to ZoneMinder upstream git" GITHUB_FORK="ZoneMinder" @@ -139,15 +169,21 @@ fi $DEBUILD cd ../ -read -p "Do you want to keep the checked out version of Zoneminder (incase you want to modify it later) [y/N]" -[[ $REPLY == [yY] ]] && { mv $DIRECTORY zoneminder_release; echo "The checked out copy is preserved in zoneminder_release"; } || { rm -fr $DIRECTORY; echo "The checked out copy has been deleted"; } -echo "Done!" +if [ "$INTERACTIVE" != "no" ]; then + read -p "Do you want to keep the checked out version of Zoneminder (incase you want to modify it later) [y/N]" + [[ $REPLY == [yY] ]] && { mv $DIRECTORY zoneminder_release; echo "The checked out copy is preserved in zoneminder_release"; } || { rm -fr $DIRECTORY; echo "The checked out copy has been deleted"; } + echo "Done!" +else + rm -fr $DIRECTORY; echo "The checked out copy has been deleted"; +fi if [ $TYPE == "binary" ]; then - echo "Not doing dput since it's a binary release. Do you want to install it? (Y/N)" - read install - if [ "$install" == "Y" ]; then - sudo dpkg -i $DIRECTORY*.deb + if [ "$INTERACTIVE" != "no" ]; then + echo "Not doing dput since it's a binary release. Do you want to install it? (Y/N)" + read install + if [ "$install" == "Y" ]; then + sudo dpkg -i $DIRECTORY*.deb + fi; fi; else SC=""; @@ -164,8 +200,11 @@ else fi; fi; - echo "Ready to dput $SC to $PPA ? Y/N..."; - read dput + dput="Y"; + if [ "$INTERACTIVE" != "no" ]; then + echo "Ready to dput $SC to $PPA ? Y/N..."; + read dput + fi if [ "$dput" == "Y" -o "$dput" == "y" ]; then dput $PPA $SC fi; From 0e8d1baebbc016a50cc583672942eb6f7e771218 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 16 Jan 2017 21:13:56 -0500 Subject: [PATCH 05/10] add an urgency flag --- utils/do_debian_package.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index 46436d2a2..bc836788f 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -31,6 +31,10 @@ case $i in TYPE="${i#*=}" shift # past argument=value ;; + -u=*|--urgency=*) + URGENCY="${i#*=}" + shift # past argument=value + ;; -f=*|--fork=*) GITHUB_FORK="${i#*=}" shift # past argument=value @@ -66,6 +70,10 @@ else BRANCH="master"; fi; fi; +if [ "$URGENCY" = "" ]; then + URGENCY="medium" +fi; + # Instead of cloning from github each time, if we have a fork lying around, update it and pull from there instead. if [ ! -d "${GITHUB_FORK}_zoneminder_release" ]; then @@ -132,7 +140,7 @@ fi if [ "$SNAPSHOT" == "stable" ]; then cat < debian/changelog -zoneminder ($VERSION-$DISTRO) $DISTRO; urgency=medium +zoneminder ($VERSION-$DISTRO) $DISTRO; urgency=$URGENCY * Release $VERSION @@ -141,7 +149,7 @@ zoneminder ($VERSION-$DISTRO) $DISTRO; urgency=medium EOF else cat < debian/changelog -zoneminder ($VERSION-$DISTRO-$SNAPSHOT) $DISTRO; urgency=medium +zoneminder ($VERSION-$DISTRO-$SNAPSHOT) $DISTRO; urgency=$URGENCY * From c5d2652d1b76011116445acaef2c591bd4842b16 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 24 Apr 2017 16:50:33 -0400 Subject: [PATCH 06/10] add code to specifically handle a release, and package versions --- utils/do_debian_package.sh | 103 ++++++++++++++++++++++++++----------- 1 file changed, 72 insertions(+), 31 deletions(-) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index bc836788f..194499af2 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -23,6 +23,10 @@ case $i in INTERACTIVE="${i#*=}" shift # past argument=value ;; + -r=*|--release=*) + RELEASE="${i#*=}" + shift + ;; -s=*|--snapshot=*) SNAPSHOT="${i#*=}" shift # past argument=value @@ -39,6 +43,10 @@ case $i in GITHUB_FORK="${i#*=}" shift # past argument=value ;; + -v=*|--version=*) + PACKAGE_VERSION="${i#*=}" + shift + ;; --default) DEFAULT=YES shift # past argument with no value @@ -54,25 +62,38 @@ if [ "$TYPE" == "" ]; then echo "Defaulting to source build" TYPE="source"; fi; -if [ "$GITHUB_FORK" == "" ]; then - echo "Defaulting to ZoneMinder upstream git" - GITHUB_FORK="ZoneMinder" -fi; -if [ "$SNAPSHOT" == "stable" ]; then - if [ "$BRANCH" == "" ]; then - BRANCH=$(git describe --tags $(git rev-list --tags --max-count=1)); - echo "Latest stable branch is $BRANCH"; - fi; +# Release is a special mode... it uploads to the release ppa and cannot have a snapshot +if [ "$RELEASE" != "" ]; then + if [ "$SNAPSHOT" != "" ]; then + echo "Releases cannot have a snapshot.... exiting." + exit 0; + fi + if [ "$GITHUB_FORK" != "" ] && [ "$GITHUB_FORK" != "ZoneMinder" ]; then + echo "Releases cannot have a fork ($GITHUB_FORK).... exiting." + exit 0; + fi + BRANCH="release-$RELEASE" else - if [ "$BRANCH" == "" ]; then - echo "Defaulting to master branch"; - BRANCH="master"; + if [ "$GITHUB_FORK" == "" ]; then + echo "Defaulting to ZoneMinder upstream git" + GITHUB_FORK="ZoneMinder" fi; -fi; -if [ "$URGENCY" = "" ]; then - URGENCY="medium" -fi; + if [ "$SNAPSHOT" == "stable" ]; then + if [ "$BRANCH" == "" ]; then + BRANCH=$(git describe --tags $(git rev-list --tags --max-count=1)); + echo "Latest stable branch is $BRANCH"; + fi; + else + if [ "$BRANCH" == "" ]; then + echo "Defaulting to master branch"; + BRANCH="master"; + fi; + if [ "$SNAPSHOT" == "NOW" ]; then + SNAPSHOT=`date +%Y%m%d%H%M%S`; + fi; + fi; +fi # Instead of cloning from github each time, if we have a fork lying around, update it and pull from there instead. @@ -80,6 +101,8 @@ if [ ! -d "${GITHUB_FORK}_zoneminder_release" ]; then if [ -d "${GITHUB_FORK}_ZoneMinder.git" ]; then echo "Using local clone ${GITHUB_FORK}_ZoneMinder.git to pull from." cd "${GITHUB_FORK}_ZoneMinder.git" + echo "git pull..." + git pull echo "git checkout $BRANCH" git checkout $BRANCH echo "git pull..." @@ -97,37 +120,39 @@ else fi; cd "${GITHUB_FORK}_zoneminder_release" -git checkout $BRANCH +if [ $RELEASE ]; then + git checkout $RELEASE +else + git checkout $BRANCH +fi; cd ../ VERSION=`cat ${GITHUB_FORK}_zoneminder_release/version` + if [ $VERSION == "" ]; then exit 1; fi; -DIRECTORY="zoneminder_$VERSION-$DISTRO"; if [ "$SNAPSHOT" != "stable" ] && [ "$SNAPSHOT" != "" ]; then - DIRECTORY="$DIRECTORY-$SNAPSHOT"; + VERSION="$VERSION~$SNAPSHOT"; fi; + +DIRECTORY="zoneminder_$VERSION-$DISTRO${PACKAGE_VERSION}"; echo "Doing $TYPE release $DIRECTORY"; mv "${GITHUB_FORK}_zoneminder_release" "$DIRECTORY.orig"; cd "$DIRECTORY.orig"; git submodule init git submodule update --init --recursive -if [ $DISTRO == "trusty" ] || [ $DISTRO == "precise" ]; then +if [ "$DISTRO" == "trusty" ] || [ "$DISTRO" == "precise" ]; then ln -sf distros/ubuntu1204 debian else - if [ $DISTRO == "wheezy" ]; then + if [ "$DISTRO" == "wheezy" ]; then ln -sf distros/debian debian else ln -sf distros/ubuntu1604 debian fi; fi; -# Auto-install all ZoneMinder's depedencies using the Debian control file -sudo apt-get install devscripts equivs -sudo mk-build-deps -ir ./debian/control - if [ "$DEBEMAIL" != "" ] && [ "$DEBFULLNAME" != "" ]; then AUTHOR="$DEBFULLNAME <$DEBEMAIL>" else @@ -138,9 +163,13 @@ else fi fi +if [ "$URGENCY" = "" ]; then + URGENCY="medium" +fi; + if [ "$SNAPSHOT" == "stable" ]; then cat < debian/changelog -zoneminder ($VERSION-$DISTRO) $DISTRO; urgency=$URGENCY +zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY * Release $VERSION @@ -149,7 +178,7 @@ zoneminder ($VERSION-$DISTRO) $DISTRO; urgency=$URGENCY EOF else cat < debian/changelog -zoneminder ($VERSION-$DISTRO-$SNAPSHOT) $DISTRO; urgency=$URGENCY +zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY * @@ -157,6 +186,12 @@ zoneminder ($VERSION-$DISTRO-$SNAPSHOT) $DISTRO; urgency=$URGENCY EOF fi; + +# Auto-install all ZoneMinder's depedencies using the Debian control file +sudo apt-get install devscripts equivs +sudo mk-build-deps -ir ./debian/control +echo "Status: $?" + #rm -rf .git #rm .gitignore #cd ../ @@ -175,6 +210,7 @@ if [ "$DEBSIGN_KEYID" != "" ]; then DEBUILD="$DEBUILD -k$DEBSIGN_KEYID" fi $DEBUILD +echo "Status: $?" cd ../ if [ "$INTERACTIVE" != "no" ]; then @@ -192,15 +228,20 @@ if [ $TYPE == "binary" ]; then if [ "$install" == "Y" ]; then sudo dpkg -i $DIRECTORY*.deb fi; + if [ "$DISTRO" == "jessie" ]; then + echo "Do you want to upload this binary to zmrepo? (y/N)" + read install + if [ "$install" == "Y" ]; then + scp "zoneminder_*-${VERSION}-${DISTRO}*" "zmrepo@zmrepo.connortechnology.com:debian/${BRANCH}/mini-dinstall/incoming/" + fi; + fi; fi; else - SC=""; + SC="zoneminder_${VERSION}-${DISTRO}${PACKAGE_VERSION}_source.changes"; PPA=""; - if [ "$SNAPSHOT" == "stable" ]; then + if [ "$RELEASE" != "" ]; then PPA="ppa:iconnor/zoneminder"; - SC="zoneminder_${VERSION}-${DISTRO}_source.changes"; else - SC="zoneminder_${VERSION}-${DISTRO}-${SNAPSHOT}_source.changes"; if [ "$BRANCH" == "" ]; then PPA="ppa:iconnor/zoneminder-master"; else From 4d851dc00f1f13fcde03db7c24e2ee4d87b5f5e0 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 24 Apr 2017 16:54:01 -0400 Subject: [PATCH 07/10] Add Distribution guessing --- utils/do_debian_package.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index 194499af2..bc862a48f 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -63,6 +63,11 @@ if [ "$TYPE" == "" ]; then TYPE="source"; fi; +if [ "$DISTRO" == "" ]; then + DISTRO=`lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'`; + echo "Guessed distro as $DISTRO"; +fi; + # Release is a special mode... it uploads to the release ppa and cannot have a snapshot if [ "$RELEASE" != "" ]; then if [ "$SNAPSHOT" != "" ]; then From 998aa2199b82d0e6c97c9d943764f4a655b094f9 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 24 Apr 2017 16:55:08 -0400 Subject: [PATCH 08/10] fix message for consistency --- utils/do_debian_package.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index bc862a48f..acc412550 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -65,7 +65,7 @@ fi; if [ "$DISTRO" == "" ]; then DISTRO=`lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'`; - echo "Guessed distro as $DISTRO"; + echo "Defaulting to $DISTRO for distribution"; fi; # Release is a special mode... it uploads to the release ppa and cannot have a snapshot From 3dff8a5da5e55361a9558e2b8272f3f03d3b6ad3 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 24 Apr 2017 17:01:24 -0400 Subject: [PATCH 09/10] update doc references to do_debian_package.sh --- docs/installationguide/ubuntu.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/installationguide/ubuntu.rst b/docs/installationguide/ubuntu.rst index 6e7ac45e4..903bf79d4 100644 --- a/docs/installationguide/ubuntu.rst +++ b/docs/installationguide/ubuntu.rst @@ -287,19 +287,19 @@ To build the latest master snapshot: :: - ./do_debian_package.sh `lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'` `date +%Y%m%d`01 local master + ./do_debian_package.sh --snapshot=NOW --branch=master --type=local To build the latest stable release: :: - ./do_debian_package.sh `lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'` `date +%Y%m%d`01 local stable + ./do_debian_package.sh --snapshot=stable --type=local -Note that the ``lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'`` -part simply extracts your distribution name - like "vivid", "trusty" etc. You -can always replace it by your distro name if you know it. As far as the script +Note that the distribution will be guessed using ``lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'`` +which simply extracts your distribution name - like "vivid", "trusty" etc. You +can always specify it using --distro=your distro name if you know it. As far as the script goes, it checks if your distro is "trusty" in which case it pulls in pre-systemd release configurations and if its not "trusty" it assumes its based on systemd and pulls in systemd related config files. @@ -378,4 +378,4 @@ change the $default array to reflect your new details. Example: 'database' => 'zm', 'prefix' => '', //'encoding' => 'utf8', - ); \ No newline at end of file + ); From 3215f2e702b6beaa2d225b9e281bcabf830fecf7 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 9 May 2017 16:57:28 -0400 Subject: [PATCH 10/10] merge latest updates --- utils/do_debian_package.sh | 42 ++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index acc412550..554dd9c38 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -52,7 +52,9 @@ case $i in shift # past argument with no value ;; *) - # unknown option + # unknown option + read -p "Unknown option $i, continue? (Y|n)" + [[ $REPLY == [yY] ]] && { echo "continuing..."; } || exit 1; ;; esac done @@ -66,6 +68,8 @@ fi; if [ "$DISTRO" == "" ]; then DISTRO=`lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'`; echo "Defaulting to $DISTRO for distribution"; +else + echo "Building for $DISTRO"; fi; # Release is a special mode... it uploads to the release ppa and cannot have a snapshot @@ -141,7 +145,7 @@ if [ "$SNAPSHOT" != "stable" ] && [ "$SNAPSHOT" != "" ]; then VERSION="$VERSION~$SNAPSHOT"; fi; -DIRECTORY="zoneminder_$VERSION-$DISTRO${PACKAGE_VERSION}"; +DIRECTORY="zoneminder_$VERSION"; echo "Doing $TYPE release $DIRECTORY"; mv "${GITHUB_FORK}_zoneminder_release" "$DIRECTORY.orig"; cd "$DIRECTORY.orig"; @@ -149,12 +153,12 @@ cd "$DIRECTORY.orig"; git submodule init git submodule update --init --recursive if [ "$DISTRO" == "trusty" ] || [ "$DISTRO" == "precise" ]; then - ln -sf distros/ubuntu1204 debian + mv distros/ubuntu1204 debian else if [ "$DISTRO" == "wheezy" ]; then - ln -sf distros/debian debian + mv distros/debian debian else - ln -sf distros/ubuntu1604 debian + mv distros/ubuntu1604 debian fi; fi; @@ -192,20 +196,24 @@ zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY EOF fi; -# Auto-install all ZoneMinder's depedencies using the Debian control file -sudo apt-get install devscripts equivs -sudo mk-build-deps -ir ./debian/control -echo "Status: $?" +rm -rf .git +rm .gitignore +cd ../ +tar zcf $DIRECTORY.orig.tar.gz $DIRECTORY.orig +cd $DIRECTORY.orig -#rm -rf .git -#rm .gitignore -#cd ../ -#tar zcf zoneminder_$VERSION-$DISTRO.orig.tar.gz zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig -#cd zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig if [ $TYPE == "binary" ]; then + # Auto-install all ZoneMinder's depedencies using the Debian control file + sudo apt-get install devscripts equivs + sudo mk-build-deps -ir ./debian/control + echo "Status: $?" DEBUILD=debuild else if [ $TYPE == "local" ]; then + # Auto-install all ZoneMinder's depedencies using the Debian control file + sudo apt-get install devscripts equivs + sudo mk-build-deps -ir ./debian/control + echo "Status: $?" DEBUILD="debuild -i -us -uc -b" else DEBUILD="debuild -S -sa" @@ -215,7 +223,11 @@ if [ "$DEBSIGN_KEYID" != "" ]; then DEBUILD="$DEBUILD -k$DEBSIGN_KEYID" fi $DEBUILD -echo "Status: $?" +if [ $? -ne 0 ]; then +echo "Error status code is: $?" + echo "Build failed."; + exit $?; +fi; cd ../ if [ "$INTERACTIVE" != "no" ]; then