Skip to content

Restoring snapshots

Ettore Di Giacinto edited this page Oct 11, 2022 · 1 revision

Here are listed some notes on repositories maintenance.

Restoring snapshots

  1. Identify the snapshot image, e.g. 20211214180315-repository.yaml in a image repository, e.g. https://quay.io/repository/kairos/packages?tab=tags.
  2. Run the script below, note it depends on luet installed locally, and docker daemon working as well. For instance, to create an image repository from a snapshot run: ./script.sh $IMAGE $TAG where $IMAGE is the repository image ( example, quay.io/kairos/packages ) and $TAG the corresponding snapshot tag (example, 20211214180315-repository.yaml)
#!/bin/bash
REPO=$1
TAG=$2

if [ -z "$REPO" ]; then
	echo "Missing repo. Usage $0 <repo> <snapshot_tag>"
	exit 1
fi

if [ -z "$TAG" ]; then
	echo "Missing snapshot tag. Usage $0 <repo> <snapshot_tag>"
	exit 1
fi

rm -rf repopack src.tar
luet util unpack $REPO:$TAG repopack
mkdir newindex
mv repopack/*.yaml newindex/repository.yaml
tar -cvf src.tar -C newindex/ .
luet util pack $REPO:repository.yaml src.tar output.tar
docker load -i output.tar
echo "Now you can push $REPO:repository.yaml"
Clone this wiki locally