Commit 4f812b88 authored by Martin Peres's avatar Martin Peres
Browse files

initscript: remove old containers and images before stopping

parent 1b29e33c
......@@ -198,4 +198,3 @@ in your `.config`:
* Allow downloading/mounting a tarball containing firmwares
* Remove the dependency in bbin (will save a couple of MB)
* Add a swap file
* Remove old images after executing the containers
......@@ -334,6 +334,17 @@ function start_post_containers {
return 0
}
function container_cleanup {
# Stop and delete all the containers that may still be running.
# This should be a noop, but I would rather be safe than sorry :)
podman container stop -a -f
podman umount -a -f
podman container prune -f
# Remove all the images older than 2 weeks old
podman image prune -a -f --filter "until=336h"
}
# Do not print all the early commands
set +x
......@@ -364,6 +375,7 @@ mount_cache_partition
setup_container_runtime
start_containers "$ARG_CONTAINER"
start_post_containers "$ARG_POST_CONTAINER"
container_cleanup
# Shutdown command
sync
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment