Skip to content

Artox/alpine-python-systemd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Alpine python-systemd Package

This is an experimental build of systemd python bindings for Alpine Linux. ONLY bindings has been packaged, and proper functioning of systemd is untested.

Use this package to satisfy build-time dependencies for other software projects, when you don't care if the systemd part works right!

Compile Package

Full compile instructions are provided on the "Creating an Alpine package" page on the alpine wiki, the tldr is as follows:

On a system running The target Alpine release, install build tools:

apk add alpine-sdk git
adduser -G abuild abuild
mkdir -p /var/cache/distfiles
chown abuild:abuild /var/cache/distfiles
su - abuild
abuild-keygen -a -i

Clone the package sources:

git clone https://github.com/Artox/alpine-python-systemd.git
cd alpine-python-systemd

Execute alpine package builder

abuild -r

Find binary packages in ~/packages//:

find ~/packages -type f
/home/user/packages/user/aarch64/py3-systemd-234-r0.apk
/home/user/packages/user/aarch64/APKINDEX.tar.gz

Compile for all Architectures

On a system where qemu user-mode emulation has been set up, download rootfs's:

export basedir=~

for arch in aarch64 armhf armv7 ppc64le s390x x86 x86_64; do
	wget https://dl-cdn.alpinelinux.org/alpine/v3.14/releases/$arch/alpine-minirootfs-3.14.2-$arch.tar.gz
	sudo mkdir -p $basedir/build-$arch
	sudo tar -C $basedir/build-$arch -xf alpine-minirootfs-3.14.2-$arch.tar.gz
	sudo cp -L /etc/resolv.conf $basedir/build-$arch/etc/resolv.conf
done

Copy QEMU binaries to each rootfs:

sudo cp /usr/bin/qemu-aarch64{,-binfmt} $basedir/build-aarch64/usr/bin/
sudo cp /usr/bin/qemu-arm{,-binfmt} $basedir/build-armhf/usr/bin/
sudo cp /usr/bin/qemu-arm{,-binfmt} $basedir/build-armv7/usr/bin/
sudo cp /usr/bin/qemu-ppc64le{,-binfmt} $basedir/build-ppc64le/usr/bin/
sudo cp /usr/bin/qemu-s390x{,-binfmt} $basedir/build-s390x/usr/bin/
sudo cp /usr/bin/qemu-i386{,-binfmt} $basedir/build-x86/usr/bin/
sudo cp /usr/bin/qemu-x86_64{,-binfmt} $basedir/build-x86_64/usr/bin/

Install alpine build tools:

for arch in aarch64 armhf armv7 ppc64le s390x x86 x86_64; do
	sudo chroot $basedir/build-$arch /sbin/apk add alpine-sdk
done

Execute Builds:

for arch in aarch64 armhf armv7 ppc64le s390x x86 x86_64; do
	sudo mount --bind /dev $basedir/build-$arch/dev
	sudo mount -t proc proc $basedir/build-$arch/proc
done

for arch in aarch64 armhf armv7 ppc64le s390x x86 x86_64; do
	sudo rm -rf $basedir/build-$arch/root/.abuild $basedir/build-$arch/root/source
	sudo cp -R $basedir/alpine-python-systemd $basedir/build-$arch/root/source
	sudo cp -R $basedir/.abuild $basedir/build-$arch/root/
	sudo chroot $basedir/build-$arch /bin/sh -c 'arch=$(cat /etc/apk/arch); wget https://github.com/Artox/alpine-systemd/releases/download/1/libsystemd-249-r0.$arch.apk; wget https://github.com/Artox/alpine-systemd/releases/download/1/libsystemd-dev-249-r0.$arch.apk; apk --allow-untrusted add libcap *.apk; rm -f *.apk'
	sudo chroot $basedir/build-$arch /bin/sh -c 'cd ~/source; abuild -F -r'
	sudo chroot $basedir/build-$arch /bin/sh -c 'apk del libsystemd-dev libsystemd libcap'
done

for arch in aarch64 armhf armv7 ppc64le s390x x86 x86_64; do
	sudo umount $basedir/build-$arch/dev
	sudo umount $basedir/build-$arch/proc
done

Collect Results:

mkdir -p packages
for arch in aarch64 armhf armv7 ppc64le s390x x86 x86_64; do
	sudo cp -R $basedir/build-$arch/root/packages/root/$arch ./packages/
done
sudo chown -R $(id -u):$(id -g) packages

for arch in aarch64 armhf armv7 ppc64le s390x x86 x86_64; do
	cp -v packages/$arch/py3-systemd-234-r0.apk py3-systemd-234-r0.$arch.apk
done