update with option release

This commit is contained in:
Isaac Connor 2017-02-12 15:12:36 -05:00
parent e3edbf40cf
commit b2657409a1
1 changed files with 47 additions and 23 deletions

View File

@ -23,6 +23,10 @@ case $i in
INTERACTIVE="${i#*=}" INTERACTIVE="${i#*=}"
shift # past argument=value shift # past argument=value
;; ;;
-r=*|--release=*)
RELEASE="${i#*=}"
shift
;;
-s=*|--snapshot=*) -s=*|--snapshot=*)
SNAPSHOT="${i#*=}" SNAPSHOT="${i#*=}"
shift # past argument=value shift # past argument=value
@ -39,6 +43,10 @@ case $i in
GITHUB_FORK="${i#*=}" GITHUB_FORK="${i#*=}"
shift # past argument=value shift # past argument=value
;; ;;
-v=*|--version=*)
PACKAGE_VERSION="${i#*=}"
shift
;;
--default) --default)
DEFAULT=YES DEFAULT=YES
shift # past argument with no value shift # past argument with no value
@ -59,22 +67,33 @@ if [ "$GITHUB_FORK" == "" ]; then
GITHUB_FORK="ZoneMinder" GITHUB_FORK="ZoneMinder"
fi; fi;
if [ "$SNAPSHOT" == "stable" ]; then # 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."
fi
if [ "$GITHUB_FORK" != "" ]; then
echo "Releases cannot have a fork.... exiting."
fi
BRANCH=$RELEASE
else
if [ "$SNAPSHOT" == "stable" ]; then
if [ "$BRANCH" == "" ]; then if [ "$BRANCH" == "" ]; then
BRANCH=$(git describe --tags $(git rev-list --tags --max-count=1)); BRANCH=$(git describe --tags $(git rev-list --tags --max-count=1));
echo "Latest stable branch is $BRANCH"; echo "Latest stable branch is $BRANCH";
fi; fi;
else else
if [ "$BRANCH" == "" ]; then if [ "$BRANCH" == "" ]; then
echo "Defaulting to master branch"; echo "Defaulting to master branch";
BRANCH="master"; BRANCH="master";
fi; fi;
fi; fi;
fi
if [ "$URGENCY" = "" ]; then if [ "$URGENCY" = "" ]; then
URGENCY="medium" URGENCY="medium"
fi; fi;
# Instead of cloning from github each time, if we have a fork lying around, update it and pull from there instead. # 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_release" ]; then
if [ -d "${GITHUB_FORK}_ZoneMinder.git" ]; then if [ -d "${GITHUB_FORK}_ZoneMinder.git" ]; then
@ -97,17 +116,23 @@ else
fi; fi;
cd "${GITHUB_FORK}_zoneminder_release" cd "${GITHUB_FORK}_zoneminder_release"
git checkout $BRANCH if [ $RELEASE ]; then
git checkout $RELEASE
else
git checkout $BRANCH
fi;
cd ../ cd ../
VERSION=`cat ${GITHUB_FORK}_zoneminder_release/version` VERSION=`cat ${GITHUB_FORK}_zoneminder_release/version`
if [ $VERSION == "" ]; then if [ $VERSION == "" ]; then
exit 1; exit 1;
fi; fi;
DIRECTORY="zoneminder_$VERSION-$DISTRO";
if [ "$SNAPSHOT" != "stable" ] && [ "$SNAPSHOT" != "" ]; then if [ "$SNAPSHOT" != "stable" ] && [ "$SNAPSHOT" != "" ]; then
DIRECTORY="$DIRECTORY-$SNAPSHOT"; VERSION="$VERSION~$SNAPSHOT";
fi; fi;
DIRECTORY="zoneminder_$VERSION-$DISTRO${PACKAGE_VERSION}";
echo "Doing $TYPE release $DIRECTORY"; echo "Doing $TYPE release $DIRECTORY";
mv "${GITHUB_FORK}_zoneminder_release" "$DIRECTORY.orig"; mv "${GITHUB_FORK}_zoneminder_release" "$DIRECTORY.orig";
cd "$DIRECTORY.orig"; cd "$DIRECTORY.orig";
@ -124,10 +149,6 @@ else
fi; fi;
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 if [ "$DEBEMAIL" != "" ] && [ "$DEBFULLNAME" != "" ]; then
AUTHOR="$DEBFULLNAME <$DEBEMAIL>" AUTHOR="$DEBFULLNAME <$DEBEMAIL>"
else else
@ -140,7 +161,7 @@ fi
if [ "$SNAPSHOT" == "stable" ]; then if [ "$SNAPSHOT" == "stable" ]; then
cat <<EOF > debian/changelog cat <<EOF > debian/changelog
zoneminder ($VERSION-$DISTRO) $DISTRO; urgency=$URGENCY zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY
* Release $VERSION * Release $VERSION
@ -149,7 +170,7 @@ zoneminder ($VERSION-$DISTRO) $DISTRO; urgency=$URGENCY
EOF EOF
else else
cat <<EOF > debian/changelog cat <<EOF > debian/changelog
zoneminder ($VERSION-$DISTRO-$SNAPSHOT) $DISTRO; urgency=$URGENCY zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY
* *
@ -157,6 +178,11 @@ zoneminder ($VERSION-$DISTRO-$SNAPSHOT) $DISTRO; urgency=$URGENCY
EOF EOF
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
#rm -rf .git #rm -rf .git
#rm .gitignore #rm .gitignore
#cd ../ #cd ../
@ -201,13 +227,11 @@ if [ $TYPE == "binary" ]; then
fi; fi;
fi; fi;
else else
SC=""; SC="zoneminder_${VERSION}-${DISTRO}${PACKAGE_VERSION}_source.changes";
PPA=""; PPA="";
if [ "$SNAPSHOT" == "stable" ]; then if [ "$RELEASE" != "" ]; then
PPA="ppa:iconnor/zoneminder"; PPA="ppa:iconnor/zoneminder";
SC="zoneminder_${VERSION}-${DISTRO}_source.changes";
else else
SC="zoneminder_${VERSION}-${DISTRO}-${SNAPSHOT}_source.changes";
if [ "$BRANCH" == "" ]; then if [ "$BRANCH" == "" ]; then
PPA="ppa:iconnor/zoneminder-master"; PPA="ppa:iconnor/zoneminder-master";
else else