Files
binary-repo/sys/apps/openrc/ympbuild
T
2025-06-01 20:48:55 +00:00

93 lines
2.7 KiB
Bash

#!/usr/bin/env bash
name='openrc'
release='8'
version='0.62.2'
url='https://github.com/OpenRC/openrc'
description='The OpenRC init system'
email='aliriza.keskin@pardus.org.tr'
maintainer='aliriza'
license=('GPLv3')
source=("https://github.com/OpenRC/openrc/archive/refs/tags/$version.zip"
"openrc.sysconf"
"reboot"
"poweroff"
"extras/backlight-restore.initd"
"extras/disable-secondary-gpu.initd"
"extras/disable-secondary-gpu.sh")
depends=()
makedepends=()
sha256sums=('5006d632fefb4ea546f260509bf3717902c7651987824043b03ba693624c55d2'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP'
'SKIP')
group=(sys.apps)
uses=()
uses_extra=(pam)
pam_depends=(pam)
arch=('x86_64')
cd $name-$version
prepare(){
# hidepid=2 by default
sed -i "s/ proc \/proc/,hidepid=2,gid=31&/g" sh/init.sh.Linux.in
# remove user service
sed -i "/subdir('openrc-user')/d" src/meson.build
}
setup(){
meson setup build \
--sysconfdir=/etc \
--prefix=/usr \
-Ddefault_library=both \
-Dzsh-completions=true \
-Dbash-completions=true \
-Dpam=$(use_opt pam true false) \
-Dpkgconfig=true
}
build(){
ninja -C build
}
package(){
ninja -C build install
# disable all services
rm -f ${DESTDIR}/etc/runlevels/*/*
rm ${DESTDIR}/etc/init.d/functions.sh
ln -s ../../usr/libexec/rc/sh/functions.sh ${DESTDIR}/etc/init.d/functions.sh
# install sysconf script
mkdir -p ${DESTDIR}/etc/sysconf.d/
install ../openrc.sysconf ${DESTDIR}/etc/sysconf.d/openrc
mkdir -p ${DESTDIR}/etc/group.d
mkdir -p ${DESTDIR}/etc/passwd.d
# GID: uucp 14
# GID: proc 31
echo "uucp:x:14:" >> ${DESTDIR}/etc/group.d/openrc
echo "proc:x:31:" >> ${DESTDIR}/etc/group.d/openrc
echo "uucp:x:14:14:uucp:/var/spool/uucp:/bin/false" > ${DESTDIR}/etc/passwd.d/uucp
# move /share to /usr/share
mkdir -p ${DESTDIR}/usr ${DESTDIR}/sbin
# reboot and poweroff script
install ../reboot ${DESTDIR}/sbin/reboot
install ../poweroff ${DESTDIR}/sbin/poweroff
ln -s openrc-shutdown ${DESTDIR}/sbin/shutdown
# install extras
mkdir -p ${DESTDIR}/usr/libexec
install ../disable-secondary-gpu.sh ${DESTDIR}/usr/libexec/disable-secondary-gpu
install ../disable-secondary-gpu.initd ${DESTDIR}/etc/init.d/disable-secondary-gpu
install ../backlight-restore.initd ${DESTDIR}/etc/init.d/backlight-restore
# systemd /proc/1/comm hack
# move openrc-run as systemd path and symlink
mkdir -p $DESTDIR/lib/systemd/
mv $DESTDIR/sbin/openrc-init $DESTDIR/lib/systemd/systemd
ln -s ../lib/systemd/systemd $DESTDIR/sbin/openrc-init
# remove user service stuff
rm -f $DESTDIR/etc/init.d/user
rm -f $DESTDIR/libexec/rc/sh/openrc-user.sh
}