initial commit
Some checks failed
Alpine / abuild (push) Failing after 31s

This commit is contained in:
Dominic 2024-01-22 15:41:38 +01:00
commit ab8dc94111
Signed by: msrd0
GPG key ID: DCC8C247452E98F9
7 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,51 @@
#!/bin/busybox ash
set -exuo pipefail
# initialize abuild
apk update
apk add --no-cache alpine-sdk sudo util-linux
adduser -D user -h /home/user
addgroup user abuild
echo "root ALL=(ALL) ALL" >/etc/sudoers
echo "%abuild ALL=(ALL) NOPASSWD: ALL" >>/etc/sudoers
mkdir -p /var/cache/distfiles
chgrp abuild /var/cache/distfiles
chmod 775 /var/cache/distfiles
mkdir -p "/home/user/.abuild"
echo "/home/user/.abuild/user.rsa" | abuild-keygen -i -b 4096
mkdir /home/user/packages
echo 'REPODEST="/home/user/packages-arm"' >.abuild/abuild.conf
echo 'PACKAGER_PRIVKEY="/home/user/.abuild/user.rsa\"' >>.abuild/abuild.conf
chown -R "user:user" /home/user/
# make sure we own the relevant directory
sudo chown -R user:user alpine packages
# build the package
sudo -u user -- APKBUILD=alpine/APKBUILD abuild -r
# upload new package
cd packages/forgejo-2174/x86_64/
for file in $(find . -name '*.apk' -type f | sed -e 's,./,,'); do
# remove old package
curl \
--fail \
-H "Authorization: token ${{secrets.PACKAGE_TOKEN}}" \
-X DELETE \
"https://msrd0.dev/api/packages/msrd0/alpine/3.19/forgejo-2174/$file" \
|| true
# upload new package
curl \
--fail \
-H "Authorization: token ${{secrets.PACKAGE_TOKEN}}" \
-T "$file" \
"https://msrd0.dev/api/packages/msrd0/alpine/3.19/forgejo-2174"
done
# ensure that the install-if condition works as expected
apk add openrc
echo "https://msrd0.dev/api/packages/msrd0/alpine/3.19/forgejo-2174" >>/etc/apk/repositories
apk add forgejo_2174
[ -e /usr/bin/forgejo_2174 ] # from the installed package
[ -e /etc/init.d/forgejo_2174 ] # from the -openrc package installed because of the install-if condition

View file

@ -0,0 +1,14 @@
name: Alpine
on: [push]
jobs:
abuild:
runs-on: ubuntu-latest
name: abuild
steps:
- uses: actions/checkout@v4
- name: Build Alpine package
uses: docker://alpine
with:
entrypoint: ash
args: -c ./.gitea/workflows/alpine.sh

21
alpine/APKBUILD Normal file
View file

@ -0,0 +1,21 @@
# -*- mode: Shell-script; eval: (setq indent-tabs-mode 't); eval: (setq tab-width 4) -*-
# Maintainer: Dominic Meiser <git@msrd0.de>
pkgname=forgejo-2174
pkgver=1.0
pkgrel=0
pkgdesc="MateKiosk NFC Backend"
url="https://msrd0.dev/msrd0/$pkgname"
arch="x86_64"
license="custom"
# using x86_64 instead of noarch as a workaround of
# https://codeberg.org/forgejo/forgejo/issues/2173
subpackages="$pkgname-openrc::x86_64"
source="forgejo_2174 forgejo_2174.init"
builddir="$srcdir"
package() {
install -D -m755 "$srcdir/forgejo_2174 "$pkgdir"/usr/bin
install -D -m755 "$srcdir/forgejo_2174.init" "$pkgdir"/etc/init.d/forgejo_2174
}

3
alpine/forgejo_2174 Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
echo "Hello World"

7
alpine/forgejo_2174.init Executable file
View file

@ -0,0 +1,7 @@
#!/sbin/openrc-run
command="/usr/bin/forgejo_2174"
depend() {
need net
}

1
alpine/src/forgejo-2174 Symbolic link
View file

@ -0,0 +1 @@
/home/msrd0/git/forgejo-2174/alpine/forgejo-2174

View file

@ -0,0 +1 @@
/home/msrd0/git/forgejo-2174/alpine/forgejo-2174.init