From 7f55c27283e201061876025136a8536a08c64618 Mon Sep 17 00:00:00 2001 From: Kayou Date: Sat, 1 Aug 2020 21:17:14 +0200 Subject: [PATCH] Buster is now the supported version --- auto_upgrade_container.sh | 2 +- rebuild_all.sh | 49 +++++++++++++++++---------------------- utils.sh | 12 ++-------- variables.sh | 8 +++---- 4 files changed, 28 insertions(+), 43 deletions(-) diff --git a/auto_upgrade_container.sh b/auto_upgrade_container.sh index ed58bd6..0224aa0 100755 --- a/auto_upgrade_container.sh +++ b/auto_upgrade_container.sh @@ -3,7 +3,7 @@ current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" source $current_dir/utils.sh # Get utils functions. -for debian_version in "stretch" "buster" +for debian_version in "buster" do for ynh_version in "stable" "testing" "unstable" do diff --git a/rebuild_all.sh b/rebuild_all.sh index 45b3ab4..cdb1489 100755 --- a/rebuild_all.sh +++ b/rebuild_all.sh @@ -3,41 +3,34 @@ current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" source $current_dir/utils.sh # Get utils functions. -for debian_version in "stretch" "buster" +for debian_version in "buster" do + rebuild_base_containers $debian_version "stable" "amd64" - # There is no stable and testing version for Buster at this time. - if [[ "$debian_version" == "buster" ]] - then - rebuild_base_containers $debian_version "unstable" "amd64" - else - rebuild_base_containers $debian_version "stable" "amd64" - - for ynh_version in "testing" "unstable" + for ynh_version in "testing" "unstable" + do + for snapshot in "before-install" "after-install" do - for snapshot in "before-install" "after-install" - do - lxc launch "yunohost-$debian_version-stable-$snapshot" "yunohost-$debian_version-$ynh_version-$snapshot-tmp" + lxc launch "yunohost-$debian_version-stable-$snapshot" "yunohost-$debian_version-$ynh_version-$snapshot-tmp" - if [[ "$ynh_version" == "testing" ]] - then - repo_version="testing" - elif [[ "$DISTRIB" == "unstable" ]] - then - repo_version="testing unstable" - fi + if [[ "$ynh_version" == "testing" ]] + then + repo_version="testing" + elif [[ "$DISTRIB" == "unstable" ]] + then + repo_version="testing unstable" + fi - lxc exec "yunohost-$debian_version-$ynh_version-$snapshot-tmp" -- /bin/bash -c "for FILE in \`ls /etc/apt/sources.list /etc/apt/sources.list.d/*\`; - do - sed -i 's@^deb http://forge.yunohost.org.*@& $repo_version@' \$FILE - done" + lxc exec "yunohost-$debian_version-$ynh_version-$snapshot-tmp" -- /bin/bash -c "for FILE in \`ls /etc/apt/sources.list /etc/apt/sources.list.d/*\`; + do + sed -i 's@^deb http://forge.yunohost.org.*@& $repo_version@' \$FILE + done" - rotate_image "yunohost-$debian_version-$ynh_version-$snapshot-tmp" "yunohost-$debian_version-$ynh_version-$snapshot" + rotate_image "yunohost-$debian_version-$ynh_version-$snapshot-tmp" "yunohost-$debian_version-$ynh_version-$snapshot" - lxc delete -f "yunohost-$debian_version-$ynh_version-$snapshot-tmp" + lxc delete -f "yunohost-$debian_version-$ynh_version-$snapshot-tmp" - update_image $debian_version $ynh_version $snapshot - done + update_image $debian_version $ynh_version $snapshot done - fi + done done \ No newline at end of file diff --git a/utils.sh b/utils.sh index 14a0242..22b5643 100755 --- a/utils.sh +++ b/utils.sh @@ -162,10 +162,7 @@ rebuild_base_containers() wait_container "$base_image_to_rebuild-tmp" - if [[ "$debian_version" == "buster" ]] - then - lxc config set "$base_image_to_rebuild-tmp" security.nesting true # Need this for buster because it is using apparmor - fi + lxc config set "$base_image_to_rebuild-tmp" security.nesting true # Need this for buster because it is using apparmor lxc exec "$base_image_to_rebuild-tmp" -- /bin/bash -c "apt-get update" lxc exec "$base_image_to_rebuild-tmp" -- /bin/bash -c "apt-get install --assume-yes wget curl" @@ -176,12 +173,7 @@ rebuild_base_containers() lxc exec "$base_image_to_rebuild-tmp" -- /bin/bash -c "curl -s https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | bash" lxc exec "$base_image_to_rebuild-tmp" -- /bin/bash -c "apt-get install --assume-yes gitlab-runner" - if [[ "$debian_version" == "buster" ]] - then - INSTALL_SCRIPT="https://raw.githubusercontent.com/YunoHost/install_script/buster-unstable/install_yunohost" - else - INSTALL_SCRIPT="https://install.yunohost.org" - fi + INSTALL_SCRIPT="https://install.yunohost.org" # Download the YunoHost install script lxc exec "$base_image_to_rebuild-tmp" -- /bin/bash -c "curl $INSTALL_SCRIPT > install.sh" diff --git a/variables.sh b/variables.sh index 57ae129..7d90192 100755 --- a/variables.sh +++ b/variables.sh @@ -8,12 +8,12 @@ source $current_dir/prints.sh # Get variables from variables. CONTAINER_ID="runner-$CUSTOM_ENV_CI_RUNNER_ID-project-$CUSTOM_ENV_CI_PROJECT_ID-concurrent-$CUSTOM_ENV_CI_CONCURRENT_PROJECT_ID-$CUSTOM_ENV_CI_JOB_ID" ARCH="$(echo $CUSTOM_ENV_CI_RUNNER_EXECUTABLE_ARCH | cut -d'/' -f2)" # linux/amd64 DEFAULT_BRANCH="$CUSTOM_ENV_CI_DEFAULT_BRANCH" -CURRENT_VERSION=$(echo $CUSTOM_ENV_CI_DEFAULT_BRANCH | cut -d'-' -f2) # stretch-unstable, stretch-testing, stretch-stable... +CURRENT_VERSION=$(echo $CUSTOM_ENV_CI_DEFAULT_BRANCH | cut -d'-' -f2) # buster-unstable, buster-testing, buster-stable... CURRENT_BRANCH="$CUSTOM_ENV_CI_COMMIT_REF_NAME" DEBIAN_VERSION=$(echo $CUSTOM_ENV_CI_COMMIT_REF_NAME | cut -d'-' -f1) # CUSTOM_ENV_CI_COMMIT_REF_NAME is the target branch of the MR: stretch-unstable, buster-unstable... -if [ -z "$DEBIAN_VERSION" ] || [ "$DEBIAN_VERSION" != "stretch" ] && [ "$DEBIAN_VERSION" != "buster" ] +if [ -z "$DEBIAN_VERSION" ] || [ "$DEBIAN_VERSION" != "buster" ] then - DEBIAN_VERSION="$(echo $CUSTOM_ENV_CI_DEFAULT_BRANCH | cut -d'-' -f1)" # stretch-unstable, buster-unstable... + DEBIAN_VERSION="$(echo $CUSTOM_ENV_CI_DEFAULT_BRANCH | cut -d'-' -f1)" # buster-unstable info "Use the default debian version: $DEBIAN_VERSION" fi SNAPSHOT_NAME="$CUSTOM_ENV_CI_JOB_IMAGE" @@ -24,5 +24,5 @@ fi PROJECT_DIR="$CUSTOM_ENV_CI_PROJECT_DIR" PROJECT_NAME="$CUSTOM_ENV_CI_PROJECT_NAME" -# For example yunohost-stretch-unstable +# For example yunohost-buster-unstable BASE_IMAGE="yunohost-$DEBIAN_VERSION-$CURRENT_VERSION"