Merge pull request #1755 from connortechnology/update_do_debian_release
Update do debian release
This commit is contained in:
commit
ed6a2f3636
|
@ -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:
|
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}'``
|
Note that the distribution will be guessed using ``lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'``
|
||||||
part simply extracts your distribution name - like "vivid", "trusty" etc. You
|
which 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
|
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
|
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
|
release configurations and if its not "trusty" it assumes its based on systemd
|
||||||
and pulls in systemd related config files.
|
and pulls in systemd related config files.
|
||||||
|
|
|
@ -8,88 +8,272 @@ exit;
|
||||||
|
|
||||||
fi
|
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
|
||||||
|
;;
|
||||||
|
-r=*|--release=*)
|
||||||
|
RELEASE="${i#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-s=*|--snapshot=*)
|
||||||
|
SNAPSHOT="${i#*=}"
|
||||||
|
shift # past argument=value
|
||||||
|
;;
|
||||||
|
-t=*|--type=*)
|
||||||
|
TYPE="${i#*=}"
|
||||||
|
shift # past argument=value
|
||||||
|
;;
|
||||||
|
-u=*|--urgency=*)
|
||||||
|
URGENCY="${i#*=}"
|
||||||
|
shift # past argument=value
|
||||||
|
;;
|
||||||
|
-f=*|--fork=*)
|
||||||
|
GITHUB_FORK="${i#*=}"
|
||||||
|
shift # past argument=value
|
||||||
|
;;
|
||||||
|
-v=*|--version=*)
|
||||||
|
PACKAGE_VERSION="${i#*=}"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--default)
|
||||||
|
DEFAULT=YES
|
||||||
|
shift # past argument with no value
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# unknown option
|
||||||
|
read -p "Unknown option $i, continue? (Y|n)"
|
||||||
|
[[ $REPLY == [yY] ]] && { echo "continuing..."; } || exit 1;
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
DATE=`date -R`
|
DATE=`date -R`
|
||||||
DISTRO=$1
|
|
||||||
SNAPSHOT=$2
|
|
||||||
if [ "$SNAPSHOT" == "stable" ]; then
|
|
||||||
SNAPSHOT="";
|
|
||||||
fi;
|
|
||||||
|
|
||||||
|
|
||||||
TYPE=$3
|
|
||||||
if [ "$TYPE" == "" ]; then
|
if [ "$TYPE" == "" ]; then
|
||||||
TYPE="source";
|
echo "Defaulting to source build"
|
||||||
|
TYPE="source";
|
||||||
fi;
|
fi;
|
||||||
BRANCH=$4
|
|
||||||
|
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
|
||||||
|
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 [ "$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;
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
if [ ! -d 'zoneminder_release' ]; then
|
# Instead of cloning from github each time, if we have a fork lying around, update it and pull from there instead.
|
||||||
git clone https://github.com/ZoneMinder/ZoneMinder.git zoneminder_release
|
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..."
|
||||||
|
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;
|
fi;
|
||||||
if [ "$BRANCH" != "" ]; then
|
|
||||||
cd zoneminder_release
|
cd "${GITHUB_FORK}_zoneminder_release"
|
||||||
if [ "$BRANCH" == "stable" ]; then
|
if [ $RELEASE ]; then
|
||||||
BRANCH=$(git describe --tags $(git rev-list --tags --max-count=1));
|
git checkout $RELEASE
|
||||||
echo "Latest stable branch is $BRANCH";
|
else
|
||||||
|
git checkout $BRANCH
|
||||||
fi
|
|
||||||
git checkout $BRANCH
|
|
||||||
cd ../
|
|
||||||
fi;
|
fi;
|
||||||
VERSION=`cat zoneminder_release/version`
|
cd ../
|
||||||
|
|
||||||
|
VERSION=`cat ${GITHUB_FORK}_zoneminder_release/version`
|
||||||
|
|
||||||
if [ $VERSION == "" ]; then
|
if [ $VERSION == "" ]; then
|
||||||
exit 1;
|
exit 1;
|
||||||
fi;
|
fi;
|
||||||
echo "Doing $TYPE release zoneminder_$VERSION-$DISTRO-$SNAPSHOT";
|
if [ "$SNAPSHOT" != "stable" ] && [ "$SNAPSHOT" != "" ]; then
|
||||||
mv zoneminder_release zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig
|
VERSION="$VERSION~$SNAPSHOT";
|
||||||
cd zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig
|
|
||||||
git submodule init
|
|
||||||
git submodule update --init --recursive
|
|
||||||
if [ $DISTRO == "trusty" ]; then
|
|
||||||
ln -sf distros/ubuntu1204 debian
|
|
||||||
else
|
|
||||||
ln -sf distros/ubuntu1604 debian
|
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
# Auto-install all ZoneMinder's depedencies using the Debian control file
|
DIRECTORY="zoneminder_$VERSION";
|
||||||
sudo apt-get install devscripts equivs
|
echo "Doing $TYPE release $DIRECTORY";
|
||||||
sudo mk-build-deps -ir ./debian/control
|
mv "${GITHUB_FORK}_zoneminder_release" "$DIRECTORY.orig";
|
||||||
|
cd "$DIRECTORY.orig";
|
||||||
|
|
||||||
if [ -z `hostname -d` ] ; then
|
git submodule init
|
||||||
AUTHOR="`getent passwd $USER | cut -d ':' -f 5 | cut -d ',' -f 1` <`whoami`@`hostname`.local>"
|
git submodule update --init --recursive
|
||||||
|
if [ "$DISTRO" == "trusty" ] || [ "$DISTRO" == "precise" ]; then
|
||||||
|
mv distros/ubuntu1204 debian
|
||||||
|
else
|
||||||
|
if [ "$DISTRO" == "wheezy" ]; then
|
||||||
|
mv distros/debian debian
|
||||||
|
else
|
||||||
|
mv distros/ubuntu1604 debian
|
||||||
|
fi;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
if [ "$DEBEMAIL" != "" ] && [ "$DEBFULLNAME" != "" ]; then
|
||||||
|
AUTHOR="$DEBFULLNAME <$DEBEMAIL>"
|
||||||
else
|
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
|
fi
|
||||||
|
|
||||||
|
if [ "$URGENCY" = "" ]; then
|
||||||
|
URGENCY="medium"
|
||||||
|
fi;
|
||||||
|
|
||||||
|
if [ "$SNAPSHOT" == "stable" ]; then
|
||||||
cat <<EOF > debian/changelog
|
cat <<EOF > debian/changelog
|
||||||
zoneminder ($VERSION-$DISTRO-$SNAPSHOT) $DISTRO; urgency=medium
|
zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY
|
||||||
|
|
||||||
|
* Release $VERSION
|
||||||
|
|
||||||
|
-- $AUTHOR $DATE
|
||||||
|
|
||||||
|
EOF
|
||||||
|
else
|
||||||
|
cat <<EOF > debian/changelog
|
||||||
|
zoneminder ($VERSION-$DISTRO${PACKAGE_VERSION}) $DISTRO; urgency=$URGENCY
|
||||||
|
|
||||||
*
|
*
|
||||||
|
|
||||||
-- $AUTHOR $DATE
|
-- $AUTHOR $DATE
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
#rm -rf .git
|
fi;
|
||||||
#rm .gitignore
|
|
||||||
#cd ../
|
rm -rf .git
|
||||||
#tar zcf zoneminder_$VERSION-$DISTRO.orig.tar.gz zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig
|
rm .gitignore
|
||||||
#cd zoneminder_$VERSION-$DISTRO-$SNAPSHOT.orig
|
cd ../
|
||||||
|
tar zcf $DIRECTORY.orig.tar.gz $DIRECTORY.orig
|
||||||
|
cd $DIRECTORY.orig
|
||||||
|
|
||||||
if [ $TYPE == "binary" ]; then
|
if [ $TYPE == "binary" ]; then
|
||||||
debuild
|
# 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
|
else
|
||||||
if [ $TYPE == "local" ]; then
|
if [ $TYPE == "local" ]; then
|
||||||
debuild -i -us -uc -b
|
# Auto-install all ZoneMinder's depedencies using the Debian control file
|
||||||
else
|
sudo apt-get install devscripts equivs
|
||||||
debuild -S -sa
|
sudo mk-build-deps -ir ./debian/control
|
||||||
fi;
|
echo "Status: $?"
|
||||||
|
DEBUILD="debuild -i -us -uc -b"
|
||||||
|
else
|
||||||
|
DEBUILD="debuild -S -sa"
|
||||||
|
fi;
|
||||||
|
fi;
|
||||||
|
if [ "$DEBSIGN_KEYID" != "" ]; then
|
||||||
|
DEBUILD="$DEBUILD -k$DEBSIGN_KEYID"
|
||||||
|
fi
|
||||||
|
$DEBUILD
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Error status code is: $?"
|
||||||
|
echo "Build failed.";
|
||||||
|
exit $?;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
cd ../
|
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"; }
|
||||||
|
echo "Done!"
|
||||||
|
else
|
||||||
|
rm -fr $DIRECTORY; echo "The checked out copy has been deleted";
|
||||||
|
fi
|
||||||
|
|
||||||
read -p "Do you want to keep the checked out version of Zoneminder (incase you want to modify it later) [y/N]"
|
if [ $TYPE == "binary" ]; then
|
||||||
[[ $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"; }
|
if [ "$INTERACTIVE" != "no" ]; then
|
||||||
echo "Done!"
|
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;
|
||||||
|
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="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;
|
||||||
|
|
||||||
|
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;
|
||||||
|
fi;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue