From 96f66ea4be5f9d4754fbe0d201ed1f7b72444254 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 3 Mar 2018 19:49:21 +0100 Subject: [PATCH 1/4] Missing dependency cpio when running on stretch --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 834bb66..d2b74d9 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ Installation ``` git clone git://github.com/YunoHost/cd_build.git cd cd_build -sudo apt-get install -f simple-cdd genisoimage qemu-kvm xorriso syslinux-utils +sudo apt-get install -f simple-cdd genisoimage qemu-kvm xorriso syslinux-utils cpio ``` Build an image From cdf3dcd781499e9a687cfa9164b732d998fa4a53 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 3 Mar 2018 19:51:01 +0100 Subject: [PATCH 2/4] On stretch, build-simple-cdd output is not ISO 9660 --- add-firmware-to | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/add-firmware-to b/add-firmware-to index 2ba33be..a528a83 100755 --- a/add-firmware-to +++ b/add-firmware-to @@ -29,7 +29,7 @@ set -x is_iso() { - file "$1" | grep -q "ISO 9660" + file "$1" | grep -q "ISO 9660\|DOS/MBR boot sector" } is_initrd() { From 7a36ea2e0ed3a44b624671d4010faec54a3e6c6b Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 3 Mar 2018 19:51:54 +0100 Subject: [PATCH 3/4] Cosmetics / adjusment / fixes when running on stretch... --- build-yunohost | 48 +++++++++++++++++++++++++++++++++++++----------- common.sh | 21 +++++++++++++++------ 2 files changed, 52 insertions(+), 17 deletions(-) diff --git a/build-yunohost b/build-yunohost index 0b03d0e..5dd5a94 100755 --- a/build-yunohost +++ b/build-yunohost @@ -28,23 +28,41 @@ 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 a simple/regular debian CD image ? build-simple-cdd --dist $DEB_DIST --conf ./simple-cdd-$ARCH.conf # Find the release version of debian local 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 + info "Finding out current YunoHost's stable vesion number" + wget -q ${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 -f 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 -f images/debian-$DEBNUM-$ARCH-CD-1.iso - rm -f images/debian-$DEBNUM-$ARCH-CD-1.list.gz - success "The image should now be available in images/yunohost-$DEB_DIST-$YNH_VERSION-$ARCH-$DIST.iso" + local CD_STUFF="images/debian-$DEBNUM-$ARCH-CD" + # build-simple-cdd is stupid and doesn't name its output correctly -.- ... + mv images/debian-*-$ARCH-CD-1.iso $CD_STUFF.iso + mv images/debian-*-$ARCH-CD-1.list.gz $CD_STUFF.list.gz + + local OUTPUT="images/yunohost-$DEB_DIST-$YNH_VERSION-$ARCH-$DIST.iso" + + [ -e "$CD_STUFF.iso" ] \ + || critical "Expected to find $CD_STUFF.iso but it's not here ?" + + rm -f $OUTPUT + + $(pwd)/add-firmware-to $CD_STUFF.iso $OUTPUT $DEB_DIST + + rm -f $CD_STUFF.iso + rm -f $CD_STUFF.list.gz + + [ -e $OUTPUT ] \ + && success "The image should now be available in $OUTPUT" \ + || critical "Something wrong happened when build the image :|" } # Sign the new iso @@ -53,24 +71,32 @@ function sign { local ARCH="$1" local NAME="images/yunohost-$DEB_DIST-$YNH_VERSION-$ARCH-$DIST.iso" - + info "Signing image $NAME ..." - - gpg --output $NAME.sig --detach-sig $NAME + + sudo gpg --output $NAME.sig --detach-sig $NAME sha256sum $NAME > $NAME.sum } function build_and_sign { local ARCH="$1" - - rm -r $(pwd)/tmp + + rm -rf $(pwd)/tmp + rm -rf $(pwd)/images/debian* build $ARCH sign $ARCH } +function assert_not_root +{ + [[ $EUID -ne 0 ]] || critical "You should not run this script as root !" +} + function main { + assert_not_root + if [ -z "$ARCH_CHOICE" ] then info "No arch chosen, will build both i396 and amd64" diff --git a/common.sh b/common.sh index 39895dd..0e40d87 100644 --- a/common.sh +++ b/common.sh @@ -29,15 +29,24 @@ function info() function warn() { local msg=${1} - echo " " - echo "[${BOLD}${ORANGE}WARN${NORMAL}] ${msg}" - echo " " + echo " " 2>&1 + echo "[${BOLD}${ORANGE}WARN${NORMAL}] ${msg}" 2>&1 + echo " " 2>&1 } function error() { local msg=${1} - echo " " - echo "[${BOLD}${RED}FAIL${NORMAL}] ${msg}" - echo " " + echo " " 2>&1 + echo "[${BOLD}${RED}FAIL${NORMAL}] ${msg}" 2>&1 + echo " " 2>&1 +} + +function critical() +{ + local msg=${1} + echo " " 2>&1 + echo "[${BOLD}${RED}CRIT${NORMAL}] ${msg}" 2>&1 + echo " " 2>&1 + exit 1 } From 1e2556d028db5eb98a0d3a5efad858ec5f841a93 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 28 Apr 2018 21:45:36 +0000 Subject: [PATCH 4/4] Misc fixes from Aleks and Maniack ? --- auto_build.sh | 8 ++++---- build-yunohost | 11 ++++------- 2 files changed, 8 insertions(+), 11 deletions(-) mode change 100644 => 100755 auto_build.sh diff --git a/auto_build.sh b/auto_build.sh old mode 100644 new mode 100755 index 20c66ae..e74ffe0 --- a/auto_build.sh +++ b/auto_build.sh @@ -7,7 +7,7 @@ repo_url="http://repo.yunohost.org/debian/" build_yunohost_org_dir="/var/www/build" -iso_directory="$script_dir" +iso_directory="/var/www/build" old_iso_directory="$iso_directory/releases_archive" mkdir -p "$old_iso_directory" @@ -21,10 +21,10 @@ get_ynh_release () { build_new_version () { local arch="$1" - echo -e "\n$(date)" >> "$script_dir/ynh_build.log" - echo ">>> Build a new iso for YunoHost $dist on $deb_dist $arch" | tee -a "$script_dir/ynh_build.log" + echo -e "\n$(date)" >> "/var/log/build_yunohost/ynh_build.log" + echo ">>> Build a new iso for YunoHost $dist on $deb_dist $arch" | tee -a "/var/log/build_yunohost/ynh_build.log" (cd "$script_dir" - ./build-yunohost $arch $dist $deb_dist 2>&1 | tee -a "$script_dir/ynh_build.log" + ./build-yunohost $arch $dist $deb_dist 2>&1 | tee -a "/var/log/build_yunohost/ynh_build.log" ) # Move the old iso in another directory diff --git a/build-yunohost b/build-yunohost index 5dd5a94..39e1273 100755 --- a/build-yunohost +++ b/build-yunohost @@ -30,7 +30,7 @@ function build fi # Build a simple/regular debian CD image ? - build-simple-cdd --dist $DEB_DIST --conf ./simple-cdd-$ARCH.conf + sudo -u yunohost build-simple-cdd --dist $DEB_DIST --conf ./simple-cdd-$ARCH.conf # Find the release version of debian local DEBNUM="$(grep "Version:" tmp/${DEB_DIST}_Release | awk '{print $2;}')" @@ -74,6 +74,9 @@ function sign info "Signing image $NAME ..." + # Remove previous signature to prevent gpg to ask about overwriting + rm -f $NAME.sig + sudo gpg --output $NAME.sig --detach-sig $NAME sha256sum $NAME > $NAME.sum } @@ -88,14 +91,8 @@ function build_and_sign sign $ARCH } -function assert_not_root -{ - [[ $EUID -ne 0 ]] || critical "You should not run this script as root !" -} - function main { - assert_not_root if [ -z "$ARCH_CHOICE" ] then