From e9605c97fe56bb79a43800453c81c8e409a5c604 Mon Sep 17 00:00:00 2001 From: Maniack Crudelis Date: Thu, 1 Mar 2018 14:30:48 +0100 Subject: [PATCH] Prepare the way for an automatic usage (#2) * Prepare the way for an automatic usage * Remove tmp before each build --- build-yunohost | 56 ++++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/build-yunohost b/build-yunohost index 4fd24cf..ae2c725 100755 --- a/build-yunohost +++ b/build-yunohost @@ -4,15 +4,13 @@ # DIST stable|testing # DEB_DIST jessie|stretch -DATE=$(date +%m%d%y%H%M) -DEBNUM='8.9' - - +DEFAULT_DEB_DIST="jessie" # Build Yunohost iso for amd64 or i386 arch # Usage: build ARCH function build { + local ARCH="$1" REPO_URL="http://repo.yunohost.org/debian/" if [ "$DIST" = "testing" ] ; then sed -i "s#$REPO_URL jessie stable#$REPO_URL $DEB_DIST stable testing#" profiles/*.preseed @@ -21,41 +19,49 @@ function build sed -i "s#$REPO_URL jessie stable testing#$REPO_URL $DEB_DIST stable#" profiles/*.preseed sed -i "s#$REPO_URL stretch stable testing#$REPO_URL $DEB_DIST stable#" profiles/*.preseed fi - build-simple-cdd --dist $DEB_DIST --conf ./simple-cdd-$1.conf - $(pwd)/add-firmware-to images/debian-$DEBNUM-$1-CD-1.iso images/yunohost-$DEB_DIST-$DATE-$1-$DIST.iso $DEB_DIST - rm images/debian-$DEBNUM-$1-CD-1.iso - rm images/debian-$DEBNUM-$1-CD-1.list.gz + build-simple-cdd --dist $DEB_DIST --conf ./simple-cdd-$ARCH.conf + + # Find the release version of debian + DEBNUM="$(grep "Version:" tmp/${DEB_DIST}_Release | awk '{print $2;}')" + + # Find the release version of YunoHost + wget ${REPO_URL}dists/${DEB_DIST}/${DIST}/binary-i386/Packages.gz + gunzip Packages.gz + YNH_VERSION=$(grep "^Package: yunohost$" --after-context=1 Packages | grep "Version" | awk '{print $2;}') + rm Packages + + rm -f images/yunohost-$DEB_DIST-$YNH_VERSION-$ARCH-$DIST.iso + $(pwd)/add-firmware-to images/debian-$DEBNUM-$ARCH-CD-1.iso images/yunohost-$DEB_DIST-$YNH_VERSION-$ARCH-$DIST.iso $DEB_DIST + rm images/debian-$DEBNUM-$ARCH-CD-1.iso + rm images/debian-$DEBNUM-$ARCH-CD-1.list.gz } # Sign the new iso # Usage: sign ARCH -function sign +function sign { - NAME="images/yunohost-$DEB_DIST-$DATE-$1-$DIST.iso" + local ARCH="$1" + NAME="images/yunohost-$DEB_DIST-$YNH_VERSION-$ARCH-$DIST.iso" gpg --output $NAME.sig --detach-sig $NAME - sha256sum $NAME > images/SHA256SUM + sha256sum $NAME > $NAME.sum } function build_and_sign { - build $1 - sign $1 + rm -r $(pwd)/tmp + + local ARCH="$1" + build $ARCH + sign $ARCH } -rm -r $(pwd)/tmp -DIST=$2 -if [[ "${2:-1}" = 1 ]]; then - DIST='stable' -fi -DEB_DIST=$3 -if [[ "${3:-1}" = 1 ]]; then - DEB_DIST='jessie' -fi +DIST="${2:-stable}" +DEB_DIST="${3:-$DEFAULT_DEB_DIST}" -if [[ "${1:-1}" = 1 ]] +if [ -z "$1" ] then - build_and_sign i386 - build_and_sign amd64 + build_and_sign i386 + build_and_sign amd64 else build_and_sign $1 fi