From 55653e348feb1c8e55d8937db5e7af9745f3b808 Mon Sep 17 00:00:00 2001 From: Micke Nordin Date: Fri, 18 Dec 2020 11:41:21 +0100 Subject: [PATCH] Improve packaging scripts --- packaging_scripts/alien.sh | 19 ++++++++++++------- packaging_scripts/reprepro.sh | 12 +++++++----- rpm/wireguide-TEMPLATE.spec | 2 +- 3 files changed, 20 insertions(+), 13 deletions(-) diff --git a/packaging_scripts/alien.sh b/packaging_scripts/alien.sh index 28f6b69..1e0bef1 100755 --- a/packaging_scripts/alien.sh +++ b/packaging_scripts/alien.sh @@ -1,18 +1,23 @@ #!/usr/bin/env bash -# Verision of wireguide -VERSION=$(awk -F '"' '/self.version =/ {print $2}' ~/sources/wireguide/src/wireguide) +# This is where I keep my sources +BASEDIR=~/sources +# Version of wireguide +VERSION=$(awk -F '"' '/self.version =/ {print $2}' ${BASEDIR}/wireguide/src/wireguide) + +cd ~/sources # Convert deb to rpm -sudo alien -g -r ~/sources/wireguide_${VERSION}_all.deb +sudo alien -g -r ${BASEDIR}/wireguide_${VERSION}_all.deb # Remove generated specfile -sudo rm ~/sources/wireguide-${VERSION}/wireguide-*.spec +sudo rm ${BASEDIR}/wireguide-${VERSION}/wireguide-*.spec # Replace with our own -sed "s/##VERSION##/${VERSION}/" ~/sources/wireguide/rpm/wireguide-TEMPLATE.spec > ~/sources/wireguide-${VERSION}/wireguide-${VERSION}.spec +sed "s/##VERSION##/${VERSION}/" ${BASEDIR}/wireguide/rpm/wireguide-TEMPLATE.spec | sudo tee ${BASEDIR}/wireguide-${VERSION}/wireguide-${VERSION}.spec # Change to build dir -cd ~/sources/wireguide-${VERSION} +cd wireguide-${VERSION} # Build rpm -sudo rpmbuild --buildroot=~/sources/wireguide-${VERSION} -bb wireguide-${VERSION}.spec +sudo rpmbuild --buildroot=$(pwd) -bb wireguide-${VERSION}.spec +sudo chown ${USER}:${USER} ${BASEDIR}/wireguide-${VERSION}.noarch.rpm diff --git a/packaging_scripts/reprepro.sh b/packaging_scripts/reprepro.sh index 147f97e..b2dc4d9 100755 --- a/packaging_scripts/reprepro.sh +++ b/packaging_scripts/reprepro.sh @@ -1,13 +1,15 @@ #!/usr/bin/env bash +# Where I keep the sources +BASEDIR=~/sources # Version of wireguide -VERSION=$(awk -F '"' '/self.version =/ {print $2}' ~/sources/wireguide/src/wireguide) +VERSION=$(awk -F '"' '/self.version =/ {print $2}' ${BASEDIR}/wireguide/src/wireguide) -# Where i keep the sources -cd ~/sources +# Change to source dir +cd ${BASEDIR}/wireguide # Build deb dpkg-buildpackage -us -uc # Add binary and source to repo -reprepro --basedir ~/sources/debian includedeb unstable ~/sources/wireguide_${VERSION}_all.deb -reprepro --basedir ~/sources/debian -S net --priority optional includedsc unstable ~/sources/wireguide_${VERSION}.dsc +reprepro --basedir ${BASEDIR}/debian includedeb unstable ${BASEDIR}/wireguide_${VERSION}_all.deb +reprepro --basedir ${BASEDIR}/debian -S net --priority optional includedsc unstable ${BASEDIR}/wireguide_${VERSION}.dsc diff --git a/rpm/wireguide-TEMPLATE.spec b/rpm/wireguide-TEMPLATE.spec index 1905b1e..f54d9b9 100644 --- a/rpm/wireguide-TEMPLATE.spec +++ b/rpm/wireguide-TEMPLATE.spec @@ -9,7 +9,7 @@ Distribution: Fedora Group: Converted/net %define _rpmdir ../ -%define _rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm +%define _rpmfilename %%{NAME}-%%{VERSION}.noarch.rpm %define _unpackaged_files_terminate_build 0 %description