feat: add container image support
This commit is contained in:
parent
cbdd6d822a
commit
b4c70c48c7
2 changed files with 74 additions and 3 deletions
69
container-image.yaml
Normal file
69
container-image.yaml
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
track: "base"
|
||||
|
||||
modules:
|
||||
- name: exec
|
||||
run: |
|
||||
for cmd in "$@"; do
|
||||
bash -s <<< "$cmd"
|
||||
done
|
||||
|
||||
stages:
|
||||
- module: exec
|
||||
inputs:
|
||||
- |
|
||||
git clone --revision 5ec321bcb0a1019d6e64ad66e3dc55b5f1248e50 --depth 1 https://git.ruds.io/rs2009/akshara /akshara
|
||||
cd /akshara
|
||||
cp -a usr/lib/akshara /usr/lib/akshara
|
||||
cp -a usr/lib/dracut/modules.d/10akshara /usr/lib/dracut/modules.d/10akshara
|
||||
cp usr/bin/akshara /usr/bin/akshara
|
||||
- rm -rf /akshara
|
||||
|
||||
override:
|
||||
- path: /var/cache/blendOS/
|
||||
keep: old
|
||||
|
||||
auto-update:
|
||||
enabled: true
|
||||
interval: 3600
|
||||
|
||||
distro-config:
|
||||
before-stages: |
|
||||
set -e
|
||||
|
||||
mkdir -p /var/cache/blendOS/container/blobs
|
||||
|
||||
if [[ -z "$IMAGE_NAME" ]]; then
|
||||
echo "E: no image name specified"
|
||||
echo "I: (define IMAGE_NAME in env section)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
skopeo copy "$IMAGE_NAME" --dest-shared-blob-dir=/var/cache/blendOS/blobs oci:image:main
|
||||
rm -rf image/blobs
|
||||
ln -s /var/cache/blendOS/blobs image/blobs
|
||||
umoci unpack --image image:main bundle
|
||||
rm image/blobs
|
||||
|
||||
cp -ax bundle/"$(jq '.root.path // "rootfs"' -Mcrj bundle/config.json)"/* .
|
||||
jq '.annotations."org.opencontainers.image.revision" // empty' -Mcrj bundle/config.json > ./usr/revision
|
||||
rm -rf bundle
|
||||
|
||||
mkdir -p ./var/cache/blendOS
|
||||
mount --bind /var/cache/blendOS ./var/cache/blendOS
|
||||
|
||||
ln -sfn usr/lib64 ./lib64
|
||||
ln -sfn usr/sbin ./sbin
|
||||
|
||||
cp /etc/locale.gen ./etc
|
||||
cp /etc/locale.conf ./etc
|
||||
|
||||
after-stages: |
|
||||
umount -l ./var/cache/blendOS &>/dev/null
|
||||
systemd-nspawn -D . locale-gen &>/dev/null
|
||||
systemd-nspawn -D . dracut --force --regenerate-all
|
||||
|
||||
should-update: |
|
||||
[[ "$(cat /usr/revision)" == "$(skopeo inspect "$IMAGE_NAME" | jq '.Labels."org.opencontainers.image.revision" // "none"' -Mcrj)" ]]
|
||||
|
||||
env:
|
||||
IMAGE_NAME: ""
|
||||
Loading…
Add table
Add a link
Reference in a new issue