Skip to content

Commit

Permalink
virt/incus: Fix buildimage and run scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
theCalcaholic committed Sep 21, 2024
1 parent 8015523 commit d37e6c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion configs/virt/incus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ delete it, and it will be recreated:
```sh
# You can find the right storage pool with:
# incus storage list -c n -f csv | head -n 1
$ incus volume delete "${STORAGE_POOL}" skiff-persist
$ incus storage volume delete "${STORAGE_POOL}" skiff-persist
```
14 changes: 3 additions & 11 deletions configs/virt/incus/scripts/buildimage.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
#!/bin/bash
set -ex
set -eu

IMAGE_NAME=skiffos/testing
CONTAINER=skiff
OUTPUT_PATH="$BUILDROOT_DIR/output"
IMAGES_PATH="$BUILDROOT_DIR/images"
WORKING_PATH="${BUILDROOT_DIR}/nspawn-run"
PERSIST_PATH="${WORKING_PATH}/nspawn-persist"
INCUS_IMAGE_PATH="${IMAGE_PATH}/incus.tar.gz"
INCUS_IMAGE_PATH="${IMAGES_PATH}/incus.tar.gz"
roottar="${IMAGES_PATH}/rootfs.tar"

if ! command -v incus >/dev/null 2>&1; then
echo "Failed to find the incus command. Is incus installed on your host system?"
exit 1
fi

mkdir -p "${PERSIST_PATH}"
TMPDIR="${WORKING_PATH}/incus-tmp"
TMPDIR="${BUILDROOT_DIR}/incus-tmp"
trap 'rm -rf "$TMPDIR";' EXIT
rm -rf "$TMPDIR"
mkdir -p "${TMPDIR}/rootfs"
Expand Down
6 changes: 3 additions & 3 deletions configs/virt/incus/scripts/run.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
set -e
set -eu

IMAGE_NAME=skiffos/testing
CONTAINER=skiff
IMAGES_PATH="$BUILDROOT_DIR/images"
INCUS_IMAGE_PATH="${IMAGE_PATH}/incus.tar.gz"
INCUS_IMAGE_PATH="${IMAGES_PATH}/incus.tar.gz"

if ! command -v incus >/dev/null 2>&1; then
echo "Failed to find the incus command. Is incus installed on your host system?"
Expand All @@ -27,7 +27,7 @@ if ! incus storage volume show "$storage_pool" skiff-persist >/dev/null 2>&1; th
incus storage volume create "$storage_pool" "skiff-persist"
fi

if incus show "${CONTAINER}"; then
if incus info "${CONTAINER}" > /dev/null 2>&1; then
incus stop "${CONTAINER}" || :
incus rm -f "${CONTAINER}" || :
fi
Expand Down

0 comments on commit d37e6c8

Please sign in to comment.