automate/build_deb_from_dsc.sh

39 lines
738 B
Bash
Executable File

#!/usr/bin/env bash
# http://deb.debian.org/debian/pool/main/s/shellcheck/shellcheck_0.7.0-2.dsc
# http://deb.debian.org/debian/pool/main/s/shellcheck/shellcheck_0.7.0-2~bpo10+1.dsc
if [ "$1" == "-h" ]; then
echo "Usage: `basename $0` Takes a build location and a dsc file
or a url to one and builds and installs the result."
exit 0
fi
BUILD_DIR=$1/build
mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}
gbp import-dsc -v --allow-unauthenticated $2
cd *
mk-build-deps debian/control
DEPS_DEB=$(ls *deb)
dpkg -i ${DEPS_DEB}
apt-get -f install
dpkg-buildpackage -us -uc -b
APT_REMOVE=${DEPS_DEB%%\_*}
apt-get -y remove --purge ${APT_REMOVE}
apt-get -y autoremove
INSTALL_DEB=${APT_REMOVE%%-*}
dpkg -i ../${INSTALL_DEB}_*deb