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#*=}"
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
@ -59,6 +67,16 @@ if [ "$GITHUB_FORK" == "" ]; then
GITHUB_FORK="ZoneMinder"
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."
fi
if [ "$GITHUB_FORK" != "" ]; then
echo "Releases cannot have a fork.... exiting."
fi
BRANCH=$RELEASE
else
if [ "$SNAPSHOT" == "stable" ]; then
if [ "$BRANCH" == "" ]; then
BRANCH=$(git describe --tags $(git rev-list --tags --max-count=1));
@ -70,11 +88,12 @@ else
BRANCH="master";
fi;
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
if [ -d "${GITHUB_FORK}_ZoneMinder.git" ]; then
@ -97,17 +116,23 @@ 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;
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";
@ -124,10 +149,6 @@ else
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
@ -140,7 +161,7 @@ fi
if [ "$SNAPSHOT" == "stable" ]; then
cat <<EOF > debian/changelog
zoneminder ($VERSION-$DISTRO) $DISTRO; urgency=$URGENCY
zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY
* Release $VERSION
@ -149,7 +170,7 @@ zoneminder ($VERSION-$DISTRO) $DISTRO; urgency=$URGENCY
EOF
else
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
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 .gitignore
#cd ../
@ -201,13 +227,11 @@ if [ $TYPE == "binary" ]; then
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