WIP
This commit is contained in:
commit
a109d236c1
4 changed files with 103 additions and 0 deletions
44
Containerfile
Normal file
44
Containerfile
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
FROM ghcr.io/cgwalters/c9s-oscore AS oscore
|
||||||
|
|
||||||
|
FROM docker.io/archlinux:latest AS builder
|
||||||
|
|
||||||
|
RUN pacman --noconfirm -Sy arch-install-scripts ostree
|
||||||
|
RUN sed -i -e 's|^NoExtract.*||g' /etc/pacman.conf
|
||||||
|
|
||||||
|
RUN mkdir /newroot
|
||||||
|
RUN pacstrap -K /newroot base linux-zen linux-firmware ostree gptfdisk cryptsetup dosfstools xfsprogs
|
||||||
|
|
||||||
|
RUN mv /newroot/home /newroot/var/
|
||||||
|
RUN ln -s var/home /newroot/home
|
||||||
|
|
||||||
|
RUN mv /newroot/mnt /newroot/var/
|
||||||
|
RUN ln -s var/mnt /newroot/mnt
|
||||||
|
|
||||||
|
RUN rmdir /newroot/var/opt
|
||||||
|
RUN mv /newroot/opt /newroot/var/
|
||||||
|
RUN ln -s var/opt /newroot/opt
|
||||||
|
|
||||||
|
RUN mv /newroot/root /newroot/var/roothome
|
||||||
|
RUN ln -s var/roothome /newroot/root
|
||||||
|
|
||||||
|
RUN mv /newroot/srv /newroot/var/srv
|
||||||
|
RUN ln -s var/srv /newroot/srv
|
||||||
|
|
||||||
|
COPY ostree-0-integration.conf /newroot/usr/lib/tmpfiles.d/
|
||||||
|
|
||||||
|
COPY --from=oscore /usr/bin/bootc /newroot/usr/bin/
|
||||||
|
COPY --from=oscore /usr/lib/bootc /newroot/usr/lib/bootc
|
||||||
|
|
||||||
|
RUN mkdir -p /newroot/sysroot/ostree
|
||||||
|
RUN ln -s sysroot/ostree /newroot/ostree
|
||||||
|
RUN ostree --repo=/repo init --mode=bare
|
||||||
|
RUN ostree --repo=/repo commit --orphan --tree=dir=/newroot --no-xattrs
|
||||||
|
|
||||||
|
# WORKAROUND: ERROR Creating ostree deployment: Performing deployment: Importing: Unencapsulating base: Importing commit: Invalid path (no parent) .lock
|
||||||
|
RUN rm /repo/.lock
|
||||||
|
|
||||||
|
RUN mv /repo /newroot/sysroot/ostree/
|
||||||
|
|
||||||
|
FROM scratch
|
||||||
|
COPY --from=builder /newroot /
|
||||||
|
LABEL ostree.bootable="true"
|
27
README.md
Normal file
27
README.md
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Arch Linux bootc container builder
|
||||||
|
|
||||||
|
As root:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./build
|
||||||
|
````
|
||||||
|
|
||||||
|
Current state:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# podman run --privileged --pid=host --net=none --security-opt label=type:unconfined_t bootc-arch bootc install --target-no-signature-verification /dev/sdb
|
||||||
|
Mounting devtmpfs
|
||||||
|
Initializing partitions
|
||||||
|
Creating filesystem
|
||||||
|
mke2fs 1.47.0 (5-Feb-2023)
|
||||||
|
Creating filesystem
|
||||||
|
Mounting /run/bootc/mounts/rootfs
|
||||||
|
Mounting /run/bootc/mounts/rootfs/boot
|
||||||
|
Creating ESP filesystem
|
||||||
|
Mounting /run/bootc/mounts/rootfs/boot/efi
|
||||||
|
Initializing ostree layout
|
||||||
|
Initializing sysroot
|
||||||
|
ostree/deploy/default initialized as OSTree root
|
||||||
|
Creating initial deployment
|
||||||
|
ERROR Creating ostree deployment: Performing deployment: Importing: Unencapsulating base: Importing commit: Expected commit object, not File
|
||||||
|
```
|
15
build
Executable file
15
build
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
image="localhost/bootc-arch:latest"
|
||||||
|
|
||||||
|
podman build --net host --security-opt label=disable --cap-add all -f Containerfile --tag "$image" .
|
||||||
|
|
||||||
|
commit=$(podman run --rm "$image" ostree rev-parse --single)
|
||||||
|
diffid=$(podman inspect "$image" | jq -r '.[0].RootFS.Layers[-1]')
|
||||||
|
|
||||||
|
echo "FROM $image" | podman build \
|
||||||
|
--label ostree.commit="$commit" \
|
||||||
|
--label ostree.final-diffid="$diffid"\
|
||||||
|
--tag "$image" -
|
17
ostree-0-integration.conf
Normal file
17
ostree-0-integration.conf
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
d /var/log/journal 0755 root root -
|
||||||
|
L /var/home - - - - ../sysroot/home
|
||||||
|
d /var/opt 0755 root root -
|
||||||
|
d /var/srv 0755 root root -
|
||||||
|
d /var/roothome 0700 root root -
|
||||||
|
d /var/usrlocal 0755 root root -
|
||||||
|
d /var/usrlocal/bin 0755 root root -
|
||||||
|
d /var/usrlocal/etc 0755 root root -
|
||||||
|
d /var/usrlocal/games 0755 root root -
|
||||||
|
d /var/usrlocal/include 0755 root root -
|
||||||
|
d /var/usrlocal/lib 0755 root root -
|
||||||
|
d /var/usrlocal/man 0755 root root -
|
||||||
|
d /var/usrlocal/sbin 0755 root root -
|
||||||
|
d /var/usrlocal/share 0755 root root -
|
||||||
|
d /var/usrlocal/src 0755 root root -
|
||||||
|
d /var/mnt 0755 root root -
|
||||||
|
d /run/media 0755 root root -
|
Loading…
Reference in a new issue