From 2f928dd64356c1bd3d48262b0ff339cbd3989b0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20H=C3=B6rsken?= Date: Mon, 5 Feb 2024 19:48:48 +0000 Subject: [PATCH] Publish for systemd-sysupdate --- .github/workflows/sysext.yml | 71 ++++++++++++++++++++++++++---------- README.md | 13 +++++++ 2 files changed, 64 insertions(+), 20 deletions(-) create mode 100644 README.md diff --git a/.github/workflows/sysext.yml b/.github/workflows/sysext.yml index 59e55f5..0d4d91b 100644 --- a/.github/workflows/sysext.yml +++ b/.github/workflows/sysext.yml @@ -9,11 +9,11 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: make - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v4 with: name: 'sysext' path: 'sysext.raw' @@ -24,25 +24,56 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: 'sysext' - - id: release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref_name }} - release_name: Release ${{ github.ref_name }} - draft: false - prerelease: false - - - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: | + repository="${{ github.repository }}" + repository_name="${repository#*/}" + component="${repository_name#*-}" + + mv sysext.raw "${component}-${{ github.ref_name }}-x86-64.raw" + sha256sum *.raw > SHA256SUMS + + cat << EOF > "sysupdate-noop.conf" + [Source] + Type=regular-file + Path=/ + MatchPattern=invalid@v.raw + [Target] + Type=regular-file + Path=/ + EOF + + cat << EOF > "sysupdate-${component}.conf" + [Transfer] + Verify=false + [Source] + Type=url-file + Path=https://github.com/${{ github.repository }}/releases/latest/download/ + MatchPattern=${component}-@v-%a.raw + [Target] + InstancesMax=3 + Type=regular-file + Path=/opt/extensions/${component} + CurrentSymlink=/etc/extensions/${component}.raw + EOF + + cat << EOF > "systemd-${component}.conf" + [Service] + ExecStartPre=/usr/lib/systemd/systemd-sysupdate -C ${component} update + EOF + + cat << EOF > "systemd-sysext.conf" + [Service] + ExecStartPost=/usr/bin/systemctl restart systemd-sysext + EOF + + - uses: softprops/action-gh-release@v1 with: - upload_url: ${{ steps.release.outputs.upload_url }} - asset_name: 'pypy3-${{ github.ref_name }}.raw' - asset_path: 'sysext.raw' - asset_content_type: application/octet-stream + name: Release ${{ github.ref_name }} + files: | + SHA256SUMS + *.raw + *.conf diff --git a/README.md b/README.md new file mode 100644 index 0000000..2c91ff1 --- /dev/null +++ b/README.md @@ -0,0 +1,13 @@ +# Setup + +Steps to install and ensure automatic updates using systemd-sysupdate: + +``` +curl -L https://github.com/mback2k/sysext-pypy3/releases/latest/download/sysupdate-noop.conf --create-dirs -o /etc/sysupdate.d/noop.conf +curl -L https://github.com/mback2k/sysext-pypy3/releases/latest/download/sysupdate-pypy3.conf --create-dirs -o /etc/sysupdate.pypy3.d/pypy3.conf +curl -L https://github.com/mback2k/sysext-pypy3/releases/latest/download/systemd-pypy3.conf --create-dirs -o /etc/systemd/system/systemd-sysupdate.service.d/pypy3.conf +curl -L https://github.com/mback2k/sysext-pypy3/releases/latest/download/systemd-sysext.conf --create-dirs -o /etc/systemd/system/systemd-sysupdate.service.d/sysext.conf +systemctl daemon-reload +systemctl enable systemd-sysupdate.timer +systemctl start systemd-sysupdate.service +```