From b16d84911bb5b9d740af3b6a39b63b8bcd83faa4 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 9 Jun 2017 10:38:20 -0400 Subject: [PATCH] merge fixes from storageareas --- utils/do_debian_package.sh | 89 +++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 31 deletions(-) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index 554dd9c38..a825d0b62 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -63,6 +63,8 @@ DATE=`date -R` if [ "$TYPE" == "" ]; then echo "Defaulting to source build" TYPE="source"; +else + echo "Doing $TYPE build" fi; if [ "$DISTRO" == "" ]; then @@ -81,6 +83,8 @@ if [ "$RELEASE" != "" ]; then if [ "$GITHUB_FORK" != "" ] && [ "$GITHUB_FORK" != "ZoneMinder" ]; then echo "Releases cannot have a fork ($GITHUB_FORK).... exiting." exit 0; + else + GITHUB_FORK="ZoneMinder"; fi BRANCH="release-$RELEASE" else @@ -118,10 +122,10 @@ if [ ! -d "${GITHUB_FORK}_zoneminder_release" ]; then git pull cd ../ echo "git clone ${GITHUB_FORK}_ZoneMinder.git ${GITHUB_FORK}_zoneminder_release" - 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" + git clone "https://github.com/$GITHUB_FORK/ZoneMinder.git" "${GITHUB_FORK}_zoneminder_release" fi else echo "release dir already exists. Please remove it." @@ -129,17 +133,13 @@ else fi; cd "${GITHUB_FORK}_zoneminder_release" -if [ $RELEASE ]; then - git checkout $RELEASE -else git checkout $BRANCH -fi; cd ../ VERSION=`cat ${GITHUB_FORK}_zoneminder_release/version` if [ $VERSION == "" ]; then - exit 1; + exit 1; fi; if [ "$SNAPSHOT" != "stable" ] && [ "$SNAPSHOT" != "" ]; then VERSION="$VERSION~$SNAPSHOT"; @@ -148,12 +148,17 @@ fi; DIRECTORY="zoneminder_$VERSION"; echo "Doing $TYPE release $DIRECTORY"; mv "${GITHUB_FORK}_zoneminder_release" "$DIRECTORY.orig"; +if [ $? -ne 0 ]; then + echo "Error status code is: $?" + echo "Setting up build dir failed."; + exit $?; +fi; cd "$DIRECTORY.orig"; git submodule init git submodule update --init --recursive if [ "$DISTRO" == "trusty" ] || [ "$DISTRO" == "precise" ]; then - mv distros/ubuntu1204 debian + mv distros/ubuntu1204 debian else if [ "$DISTRO" == "wheezy" ]; then mv distros/debian debian @@ -185,6 +190,13 @@ zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY -- $AUTHOR $DATE EOF +cat < debian/NEWS +zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY + + * Release $VERSION + + -- $AUTHOR $DATE +EOF else cat < debian/changelog zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY @@ -192,7 +204,13 @@ zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY * -- $AUTHOR $DATE +EOF +cat < debian/changelog +zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY + * + + -- $AUTHOR $DATE EOF fi; @@ -207,7 +225,7 @@ if [ $TYPE == "binary" ]; then sudo apt-get install devscripts equivs sudo mk-build-deps -ir ./debian/control echo "Status: $?" - DEBUILD=debuild + DEBUILD=debuild else if [ $TYPE == "local" ]; then # Auto-install all ZoneMinder's depedencies using the Debian control file @@ -216,6 +234,7 @@ else echo "Status: $?" DEBUILD="debuild -i -us -uc -b" else + # Source build, don't need build depends. DEBUILD="debuild -S -sa" fi; fi; @@ -232,48 +251,56 @@ fi; cd ../ 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"; } + [[ $REPLY == [yY] ]] && { mv "$DIRECTORY.orig" zoneminder_release; echo "The checked out copy is preserved in zoneminder_release"; } || { rm -fr "$DIRECTORY.orig"; echo "The checked out copy has been deleted"; } echo "Done!" else - rm -fr $DIRECTORY; echo "The checked out copy has been deleted"; + rm -fr "$DIRECTORY.orig"; echo "The checked out copy has been deleted"; fi if [ $TYPE == "binary" ]; then 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 + read -p "Not doing dput since it's a binary release. Do you want to install it? (Y/N)" + if [[ $REPLY == [yY] ]]; then sudo dpkg -i $DIRECTORY*.deb + else + echo $REPLY; 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/" + read -p "Do you want to upload this binary to zmrepo? (y/N)" + if [[ $REPLY == [yY] ]]; then + if [ "$RELEASE" != "" ]; then + scp "zoneminder_${VERSION}-${DISTRO}*" "zmrepo@zmrepo.connortechnology.com:debian/stable/mini-dinstall/incoming/" + else + if [ "$BRANCH" == "" ]; then + scp "zoneminder_${VERSION}-${DISTRO}*" "zmrepo@zmrepo.connortechnology.com:debian/master/mini-dinstall/incoming/" + else + scp "$DIRECTORY-${DISTRO}*" "zmrepo@zmrepo.connortechnology.com:debian/${BRANCH}/mini-dinstall/incoming/" + fi; fi; + fi; fi; fi; else SC="zoneminder_${VERSION}-${DISTRO}${PACKAGE_VERSION}_source.changes"; - PPA=""; - if [ "$RELEASE" != "" ]; then - PPA="ppa:iconnor/zoneminder"; - else - if [ "$BRANCH" == "" ]; then - PPA="ppa:iconnor/zoneminder-master"; - else - PPA="ppa:iconnor/zoneminder-$BRANCH"; - fi; - fi; + PPA=""; + if [ "$RELEASE" != "" ]; then + PPA="ppa:iconnor/zoneminder"; + else + if [ "$BRANCH" == "" ]; then + PPA="ppa:iconnor/zoneminder-master"; + else + PPA="ppa:iconnor/zoneminder-$BRANCH"; + fi; + fi; 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; + if [ "$dput" == [Yy] ]; then + dput $PPA $SC + fi; fi;