Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
DaanDeMeyer committed Nov 22, 2022
1 parent ff13c8b commit b7e47ee
Show file tree
Hide file tree
Showing 18 changed files with 410 additions and 3,526 deletions.
63 changes: 19 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,7 @@ jobs:
- directory
- tar
- cpio
- gpt_ext4
- plain_squashfs
- disk

steps:
- uses: actions/checkout@v2
Expand All @@ -130,7 +129,7 @@ jobs:
run: sudo apt-get update && sudo apt-get install --no-install-recommends python3-pexpect python3-pytest

- name: Install Gentoo dependencies (portage)
if: ${{ matrix.distro == 'gentoo' }}
if: matrix.distro == 'gentoo'
run: |
sudo tee /usr/lib/sysusers.d/acct-user-portage.conf > /dev/null <<- EOF
# /usr/lib/sysusers.d/portage.conf
Expand Down Expand Up @@ -163,7 +162,7 @@ jobs:
- name: Install
run: sudo python3 -m pip install .

- name: Build/Boot ${{ matrix.distro }}/${{ matrix.format }}
- name: Configure ${{ matrix.distro }}/${{ matrix.format }}
run: |
mkdir -p mkosi.conf.d
Expand All @@ -173,6 +172,11 @@ jobs:
[Output]
Format=${{ matrix.format }}
Bootable=yes
KernelCommandLine=systemd.unit=mkosi-check-and-shutdown.service
!quiet
systemd.log_target=console
systemd.default_standard_output=journal+console
EOF
mkdir -p mkosi.skeleton/etc/portage
Expand All @@ -182,46 +186,17 @@ jobs:
sync-uri = https://raw.githubusercontent.com/257/binpkgs/main
EOF
sudo MKOSI_TEST_DEFAULT_VERB=boot python3 -m pytest --exitfirst -m integration -sv tests
- name: Build ${{ matrix.distro }}/${{ matrix.format }}
run: sudo python3 -m mkosi build

- name: Build ${{ matrix.distro }}/${{ matrix.format }} UsrOnly
run: |
tee mkosi.conf <<- EOF
[Output]
UsrOnly=True
EOF
sudo mkosi --force build
- name: Build/Boot ${{ matrix.distro }}/${{ matrix.format }} UEFI UKI
run: |
tee mkosi.conf <<- EOF
[Host]
QemuBoot=uefi
EOF
sudo MKOSI_TEST_DEFAULT_VERB=qemu python3 -m pytest --exitfirst -m integration -sv tests
- name: Build/Boot ${{ matrix.distro }}/${{ matrix.format }} UEFI
run: |
tee mkosi.conf <<- EOF
[Output]
WithUnifiedKernelImages=no
[Host]
QemuBoot=uefi
EOF
sudo MKOSI_TEST_DEFAULT_VERB=qemu python3 -m pytest --exitfirst -m integration -sv tests
- name: Boot ${{ matrix.distro }}/${{ matrix.format }} systemd-nspawn
if: matrix.format == 'disk' || matrix.format == 'directory'
run: sudo python3 -m mkosi boot

- name: Build/Boot ${{ matrix.distro }}/${{ matrix.format}} QEMU Linux Boot
run: |
tee mkosi.conf <<- EOF
[Output]
WithUnifiedKernelImages=no
[Host]
QemuBoot=linux
EOF
- name: Boot ${{ matrix.distro }}/${{ matrix.format }} UEFI
if: matrix.format == 'disk'
run: sudo python3 -m mkosi --qemu-boot=uefi qemu

sudo MKOSI_TEST_DEFAULT_VERB=qemu python3 -m pytest --exitfirst -m integration -sv tests
- name: Boot ${{ matrix.distro }}/${{ matrix.format}} QEMU Linux Boot
if: matrix.format == 'disk'
run: sudo python3 -m mkosi --qemu-boot=linux qemu
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
/dist
/mkosi.build
/mkosi.egg-info
/mkosi.extra
/mkosi.nspawn
/mkosi.rootpw
/mkosi.conf
Expand Down
17 changes: 10 additions & 7 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,23 @@ runs:
sudo pacman-key --init
sudo pacman-key --populate archlinux
# Try to eliminate "Failed to dissect image: Connection timed out" errors from nspawn by compiling
# systemd-nspawn from v251 from source.
- name: Update systemd-nspawn
- name: Update systemd
shell: bash
working-directory: ${{ github.action_path }}
run: |
echo "deb-src http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs) main restricted universe multiverse" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get build-dep systemd
git clone https://github.com/systemd/systemd-stable --branch v251.2 --depth=1
meson systemd-stable/build systemd-stable
ninja -C systemd-stable/build systemd-nspawn
sudo ln -svf $PWD/systemd-stable/build/systemd-nspawn $(which systemd-nspawn)
sudo apt-get install libfdisk-dev
git clone https://github.com/systemd/systemd --depth=1
meson systemd/build systemd -Drepart=true -Defi=true
ninja -C systemd/build
sudo ln -svf $PWD/systemd/build/systemd-nspawn /usr/bin/systemd-nspawn
sudo ln -svf $PWD/systemd/build/systemd-repart /usr/bin/systemd-repart
sudo ln -svf $PWD/systemd/build/bootctl /usr/bin/bootctl
systemd-nspawn --version
systemd-repart --version
bootctl --version
- name: Install
shell: bash
Expand Down
9 changes: 9 additions & 0 deletions mkosi.extra/usr/lib/systemd/mkosi-check-and-shutdown.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash -eux
# SPDX-License-Identifier: LGPL-2.1-or-later

systemctl --failed --no-legend | tee /failed-services

# Exit with non-zero EC if the /failed-services file is not empty (we have -e set)
[[ ! -s /failed-services ]]

: >/testok
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Unit]
Description=Check if any service failed and then shutdown the machine
After=multi-user.target network-online.target
Requires=multi-user.target
Wants=systemd-resolved.service systemd-networkd.service network-online.target
OnFailure=poweroff.target
OnFailureJobMode=replace-irreversibly

[Service]
Type=oneshot
ExecStartPre=-rm -f /failed-services
ExecStart=/usr/lib/systemd/mkosi-check-and-shutdown.sh
ExecStartPost=systemctl poweroff --no-block
Loading

0 comments on commit b7e47ee

Please sign in to comment.