Misc changes / tweaks to adapt to the new image indexing system

This commit is contained in:
Alexandre Aubin 2018-06-18 17:26:36 +00:00
parent 7a6ec0b210
commit 140e17a946
2 changed files with 22 additions and 47 deletions

View file

@ -23,26 +23,25 @@ build_new_version () {
local arch="$1"
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"
(cd "$script_dir";
./build-yunohost $arch $dist $deb_dist 2>&1 | tee -a "/var/log/build_yunohost/ynh_build.log"
)
# Move the old iso in another directory
mv "$script_dir/images/yunohost-$deb_dist-$old_version-$arch-$dist".{iso,iso.sig,iso.sum} "$old_iso_directory"
# And put at its place the new iso
local image_name="yunohost-$deb_dist-$new_version-$arch-$dist"
mv "$script_dir/images/$image_name".{iso,iso.sig,iso.sum} "$iso_directory"
mv "$script_dir/images/$image_name.iso" "$iso_directory"
# Modify the links on build.yunohost.org
if [ "$dist" = "stable" ]
then # Stable
sed --in-place "s@\(<a href=\".*\)yunohost-.*iso\(\">Stable $arch</a> | <a href=\"\).*sig\(\">pgp</a> - <a href=\"\).*sum\(\">sha512</a><br>\)@ \
\1$image_name.iso\2$image_name.iso.sig\3$image_name.iso.sum\4@" \
"$build_yunohost_org_dir/index.html"
else # Testing
sed --in-place "s@\(<a href=\".*\)yunohost-.*iso\(\">Testing $arch</a> | <a href=\"\).*sig\(\">pgp</a> - <a href=\"\).*sum\(\">sha512</a><br>\)@ \
\1$image_name.iso\2$image_name.iso.sig\3$image_name.iso.sum\4@" \
"$build_yunohost_org_dir/index.html"
# Update the images.json (will also sign it, and move the old image in release_archives)
if [[ $dist == "stable" ]];
then
if [[ $arch == "i386" ]];
then
sudo /var/www/build/update-images.py regularcomputer32 $new_version $image_name.iso
sudo /var/www/build/update-images.py virtualbox32 $new_version $image_name.iso
else
sudo /var/www/build/update-images.py regularcomputer64 $new_version $image_name.iso
sudo /var/www/build/update-images.py virtualbox64 $new_version $image_name.iso
fi
fi
}
@ -63,5 +62,7 @@ deb_dist=stretch
dist=stable
compare_version "$(get_ynh_release)"
dist=testing
compare_version "$(get_ynh_release)"
# Disabling for now as it's causing some issues (not reverting the changes in .preseed)
# Not sure we really need those anyway :s
#dist=testing
#compare_version "$(get_ynh_release)"

View file

@ -27,6 +27,8 @@ function build
sed -i "s#$REPO_URL stretch stable testing#$REPO_URL $DEB_DIST stable#" profiles/*.preseed
fi
rm -rf ./tmp
# Build a simple/regular debian CD image ?
sudo -u yunohost build-simple-cdd --dist $DEB_DIST --conf ./simple-cdd-$ARCH.conf
@ -63,44 +65,16 @@ function build
|| critical "Something wrong happened when build the image :|"
}
# Sign the new iso
# Usage: sign ARCH
function sign
{
local ARCH="$1"
local NAME="images/yunohost-$DEB_DIST-$YNH_VERSION-$ARCH-$DIST.iso"
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
}
function build_and_sign
{
local ARCH="$1"
rm -rf $(pwd)/tmp
rm -rf $(pwd)/images/debian*
build $ARCH
sign $ARCH
}
function main
{
if [ -z "$ARCH_CHOICE" ]
then
info "No arch chosen, will build both i396 and amd64"
build_and_sign i386
build_and_sign amd64
build i386
build amd64
else
build_and_sign $ARCH_CHOICE
build $ARCH_CHOICE
fi
}