fix update container

This commit is contained in:
Kay0u 2023-05-16 17:31:19 +02:00
parent 777149191b
commit 9c23d090fb
No known key found for this signature in database
GPG key ID: AAFEEB16CFA2AE2D
4 changed files with 7 additions and 7 deletions

View file

@ -9,7 +9,7 @@ do
do do
for snapshot in "before-install" "after-install" for snapshot in "before-install" "after-install"
do do
update_image $debian_version $ynh_version $snapshot update_container $debian_version $ynh_version $snapshot
done done
done done
done done
@ -20,7 +20,7 @@ do
do do
for snapshot in "before-install" "after-install" for snapshot in "before-install" "after-install"
do do
update_image $debian_version $ynh_version $snapshot update_container $debian_version $ynh_version $snapshot
done done
done done
done done

View file

@ -12,7 +12,7 @@ trap "exit $SYSTEM_FAILURE_EXIT_CODE" ERR
start_container () { start_container () {
if ! lxc info "$CONTAINER_IMAGE" >/dev/null 2>/dev/null ; then if ! lxc info "$CONTAINER_IMAGE" >/dev/null 2>/dev/null ; then
warn 'Container not found, copying it from the prebuilt image' warn 'Container not found, copying it from the prebuilt image'
if ! lxc image info "$BASE_IMAGE" &>/dev/null if ! lxc info "$BASE_IMAGE" &>/dev/null || ! lxc info "$BASE_IMAGE" | grep -q "$SNAPSHOT_NAME"
then then
error "$BASE_IMAGE not found, please rebuild with rebuild_all.sh" error "$BASE_IMAGE not found, please rebuild with rebuild_all.sh"
# Inform GitLab Runner that this is a system failure, so it # Inform GitLab Runner that this is a system failure, so it

View file

@ -30,7 +30,7 @@ do
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 update_container $debian_version $ynh_version $snapshot
done done
done done
done done

View file

@ -190,20 +190,20 @@ rebuild_base_containers()
lxc stop "$base_image_to_rebuild" lxc stop "$base_image_to_rebuild"
} }
update_image() { update_container() {
local debian_version=$1 local debian_version=$1
local ynh_version=$2 local ynh_version=$2
local snapshot=$3 local snapshot=$3
local image_to_update="yunohost-$debian_version-$ynh_version-$snapshot" local image_to_update="yunohost-$debian_version-$ynh_version-$snapshot"
if ! lxc image info "$image_to_update" &>/dev/null if ! lxc info "$image_to_update" &>/dev/null
then then
error "Unable to upgrade image $image_to_update" error "Unable to upgrade image $image_to_update"
return return
fi fi
# Start and run upgrade # Start and run upgrade
lxc launch "$image_to_update" "$image_to_update" -c security.nesting=true lxc restore "$image_to_update" "$snapshot"
wait_container "$image_to_update" wait_container "$image_to_update"