mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
build: add migration image bundling to build pipeline
Bundle start9/compat, start9/utils, and tonistiigi/binfmt container images into the OS image so the v1→v2 s9pk migration can run without internet access.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -23,3 +23,4 @@ tmp
|
||||
web/.i18n-checked
|
||||
docs/USER.md
|
||||
*.s9pk
|
||||
/build/lib/migration-images
|
||||
|
||||
7
Makefile
7
Makefile
@@ -15,7 +15,7 @@ IMAGE_TYPE=$(shell if [ "$(PLATFORM)" = raspberrypi ]; then echo img; else echo
|
||||
WEB_UIS := web/dist/raw/ui/index.html web/dist/raw/setup-wizard/index.html
|
||||
COMPRESSED_WEB_UIS := web/dist/static/ui/index.html web/dist/static/setup-wizard/index.html
|
||||
FIRMWARE_ROMS := build/lib/firmware/$(PLATFORM) $(shell jq --raw-output '.[] | select(.platform[] | contains("$(PLATFORM)")) | "./build/lib/firmware/$(PLATFORM)/" + .id + ".rom.gz"' build/lib/firmware.json)
|
||||
BUILD_SRC := $(call ls-files, build/lib) build/lib/depends build/lib/conflicts $(FIRMWARE_ROMS)
|
||||
BUILD_SRC := $(call ls-files, build/lib) build/lib/depends build/lib/conflicts $(FIRMWARE_ROMS) build/lib/migration-images/.done
|
||||
IMAGE_RECIPE_SRC := $(call ls-files, build/image-recipe/)
|
||||
STARTD_SRC := core/startd.service $(BUILD_SRC)
|
||||
CORE_SRC := $(call ls-files, core) $(shell git ls-files --recurse-submodules patch-db) $(GIT_HASH_FILE)
|
||||
@@ -89,6 +89,7 @@ clean:
|
||||
rm -rf container-runtime/node_modules
|
||||
rm -f container-runtime/*.squashfs
|
||||
(cd sdk && make clean)
|
||||
rm -rf build/lib/migration-images
|
||||
rm -f env/*.txt
|
||||
|
||||
format:
|
||||
@@ -105,6 +106,10 @@ test-sdk: $(call ls-files, sdk) sdk/base/lib/osBindings/index.ts
|
||||
test-container-runtime: container-runtime/node_modules/.package-lock.json $(call ls-files, container-runtime/src) container-runtime/package.json container-runtime/tsconfig.json
|
||||
cd container-runtime && npm test
|
||||
|
||||
build/lib/migration-images/.done: build/save-migration-images.sh
|
||||
ARCH=$(ARCH) ./build/save-migration-images.sh build/lib/migration-images
|
||||
touch $@
|
||||
|
||||
install-cli: $(GIT_HASH_FILE)
|
||||
./core/build/build-cli.sh --install
|
||||
|
||||
|
||||
33
build/save-migration-images.sh
Executable file
33
build/save-migration-images.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# Save Docker images needed by the 0.3.6-alpha.0 migration as tarballs
|
||||
# so they can be bundled into the OS and loaded without internet access.
|
||||
set -e
|
||||
|
||||
ARCH="${ARCH:-x86_64}"
|
||||
DESTDIR="${1:-build/lib/migration-images}"
|
||||
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
DOCKER_PLATFORM="linux/amd64"
|
||||
elif [ "$ARCH" = "aarch64" ]; then
|
||||
DOCKER_PLATFORM="linux/arm64"
|
||||
else
|
||||
DOCKER_PLATFORM="linux/$ARCH"
|
||||
fi
|
||||
|
||||
IMAGES=("start9/compat:latest" "start9/utils:latest" "tonistiigi/binfmt:latest")
|
||||
|
||||
mkdir -p "$DESTDIR"
|
||||
|
||||
for IMAGE in "${IMAGES[@]}"; do
|
||||
FILENAME=$(echo "$IMAGE" | sed 's|/|_|g; s/:/_/g').tar
|
||||
if [ -f "$DESTDIR/$FILENAME" ]; then
|
||||
echo "Skipping $IMAGE (already saved)"
|
||||
continue
|
||||
fi
|
||||
echo "Pulling $IMAGE for $DOCKER_PLATFORM..."
|
||||
docker pull --platform "$DOCKER_PLATFORM" "$IMAGE"
|
||||
echo "Saving $IMAGE to $DESTDIR/$FILENAME..."
|
||||
docker save "$IMAGE" -o "$DESTDIR/$FILENAME"
|
||||
done
|
||||
|
||||
echo "Migration images saved to $DESTDIR"
|
||||
Reference in New Issue
Block a user