summaryrefslogtreecommitdiff
path: root/nonsystemd/openrc
diff options
context:
space:
mode:
authorDavid P <megver83@parabola.nu>2019-11-12 23:35:24 -0300
committerDavid P <megver83@parabola.nu>2019-11-12 23:35:24 -0300
commite77ff396b67564f497ee1868d5cddfc1eeeffd2e (patch)
tree1c1d7780148130ad773663503546afc5b5472ba7 /nonsystemd/openrc
parentc46585d255183aa1cfbfc077ae56d7a1eba12f4b (diff)
downloadabslibre-e77ff396b67564f497ee1868d5cddfc1eeeffd2e.tar.gz
abslibre-e77ff396b67564f497ee1868d5cddfc1eeeffd2e.tar.bz2
abslibre-e77ff396b67564f497ee1868d5cddfc1eeeffd2e.zip
addpkg: nonsystemd/openrc 0.42.1-1
Signed-off-by: David P <megver83@parabola.nu>
Diffstat (limited to 'nonsystemd/openrc')
-rw-r--r--nonsystemd/openrc/30-binfmt.hook11
-rw-r--r--nonsystemd/openrc/30-openrc-upgrade.hook9
-rw-r--r--nonsystemd/openrc/30-sysctl.hook12
-rw-r--r--nonsystemd/openrc/PKGBUILD223
-rw-r--r--nonsystemd/openrc/binfmt-sh.patch18
-rw-r--r--nonsystemd/openrc/kmod-static-nodes.initd19
-rw-r--r--nonsystemd/openrc/openrc-hook27
-rw-r--r--nonsystemd/openrc/openrc.install3
-rw-r--r--nonsystemd/openrc/openrc.logrotate7
-rw-r--r--nonsystemd/openrc/opensysusers.initd18
-rw-r--r--nonsystemd/openrc/opentmpfiles-dev.confd2
-rw-r--r--nonsystemd/openrc/opentmpfiles-dev.initd20
-rw-r--r--nonsystemd/openrc/opentmpfiles-setup.confd2
-rw-r--r--nonsystemd/openrc/opentmpfiles-setup.initd19
-rw-r--r--nonsystemd/openrc/sysctl.conf28
15 files changed, 418 insertions, 0 deletions
diff --git a/nonsystemd/openrc/30-binfmt.hook b/nonsystemd/openrc/30-binfmt.hook
new file mode 100644
index 000000000..459d38296
--- /dev/null
+++ b/nonsystemd/openrc/30-binfmt.hook
@@ -0,0 +1,11 @@
+[Trigger]
+Type = File
+Operation = Install
+Operation = Upgrade
+Target = usr/lib/binfmt.d/*.conf
+
+[Action]
+Description = Registering binary formats...
+When = PostTransaction
+Exec = /usr/share/libalpm/scripts/openrc-hook binfmt
+NeedsTargets
diff --git a/nonsystemd/openrc/30-openrc-upgrade.hook b/nonsystemd/openrc/30-openrc-upgrade.hook
new file mode 100644
index 000000000..10590e704
--- /dev/null
+++ b/nonsystemd/openrc/30-openrc-upgrade.hook
@@ -0,0 +1,9 @@
+[Trigger]
+Type = Package
+Operation = Upgrade
+Target = openrc
+
+[Action]
+Description = Reexecuting init ...
+When = PostTransaction
+Exec = /usr/share/libalpm/scripts/openrc-hook reexec
diff --git a/nonsystemd/openrc/30-sysctl.hook b/nonsystemd/openrc/30-sysctl.hook
new file mode 100644
index 000000000..922705101
--- /dev/null
+++ b/nonsystemd/openrc/30-sysctl.hook
@@ -0,0 +1,12 @@
+[Trigger]
+Type = File
+Operation = Install
+Operation = Upgrade
+Target = etc/sysctl.d/*.conf
+Target = usr/lib/sysctl.d/*.conf
+
+[Action]
+Description = Applying kernel sysctl settings...
+When = PostTransaction
+Exec = /usr/share/libalpm/scripts/openrc-hook sysctl
+NeedsTargets
diff --git a/nonsystemd/openrc/PKGBUILD b/nonsystemd/openrc/PKGBUILD
new file mode 100644
index 000000000..de26ef668
--- /dev/null
+++ b/nonsystemd/openrc/PKGBUILD
@@ -0,0 +1,223 @@
+# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
+# Maintainer: David P. <megver83@parabola.nu>
+# Contributor: Luke Shumaker <lukeshu@parabola.nu>
+
+# Maintainer (Artix): artoo <artoo@artixlinux.org>
+# Maintainer (Artix): Chris Cromer <cromer@artixlinux.org>
+# Contributor (Artix): williamh <williamh@gentoo.org>
+
+_url="https://github.com/OpenRC/openrc/archive"
+
+pkgbase=openrc
+pkgname=('openrc' 'openrc-bash-completions' 'openrc-zsh-completions'
+ 'openrc-init' 'openrc-sysvinit')
+pkgver=0.42.1
+pkgrel=1
+pkgdesc="Gentoo's universal init system"
+arch=('x86_64' 'i686' 'armv7h')
+url="http://www.gentoo.org/proj/en/base/openrc/"
+license=('BSD2')
+makedepends=('psmisc' 'pam' 'netifrc' 'opentmpfiles' 'zsh')
+source=("${pkgbase}-${pkgver}.tar.gz::${_url}/${pkgver}.tar.gz"
+ "${pkgbase}.logrotate"
+ 'openrc-hook'
+ '30-openrc-upgrade.hook'
+ '30-sysctl.hook'
+ 'sysctl.conf'
+ '30-binfmt.hook'
+ 'opentmpfiles-dev.initd'
+ 'opentmpfiles-setup.initd'
+ 'opentmpfiles-dev.confd'
+ 'opentmpfiles-setup.confd'
+ 'opensysusers.initd'
+ 'kmod-static-nodes.initd'
+ 'binfmt-sh.patch')
+sha256sums=('91a01ca6d930a0688fb91338209985de57cac7aa2d37feddacb78fd3d95308e2'
+ '0b44210db9770588bd491cd6c0ac9412d99124c6be4c9d3f7d31ec8746072f5c'
+ '6eaabc9dc1bdfa05677473aa5f0643c2079849be51bf0dee36e0906702cffebe'
+ '3ef8682540a038c239c4e07881cb084501d7996df2e0395b70a0a3953c7d00b2'
+ 'cb5bc649c2c9998300aff1e9862a9404b44e53178d153d68288603e99c5aaefe'
+ '4170bcf3655ff6fb32b35fc592a4294a64d25df98d2f0f09f467689ed1ad54ea'
+ '1f4cd15749ff89fd564e216ff0c1f9ff085e0200dba24d74e3de948f681bd80f'
+ 'c357e37ef59845954add9ccf89eff07beae0bd5274fdaa3ebf32da61c9d38436'
+ '68779b6f4d8f4bcc206ff0e7ddab2c4cbff029727404cffa94079c1bf06094c8'
+ '505b7fa013d90b1775439c06b6b0d420f877768cc59eaff5ffb1493a9e28b4ba'
+ '505b7fa013d90b1775439c06b6b0d420f877768cc59eaff5ffb1493a9e28b4ba'
+ '6476fd66ead2ad43129e3135656f4fde64addddabb6b7405665b3cf8db4aa6ad'
+ '3ecbe7761b92a123a5a3d395ec3d9e090b0dfba7910a5987b4a2298c20a7e571'
+ '3680546deb196de39a2ea4f7a3b30977773be011cc1f0285e64015f41c18e853')
+
+_args=(
+ SYSCONFDIR=/etc
+ PREFIX=/usr
+ SBINDIR=/usr/bin
+ LIBEXECDIR=/usr/lib/openrc
+ MKSELINUX=no
+ MKPAM=pam
+ MKTERMCAP=ncurses
+ MKNET=no
+ MKSYSVINIT=yes
+ MKBASHCOMP=yes
+ MKZSHCOMP=yes
+ MKPKGCONFIG=yes
+)
+
+if [ -f /usr/lib/os-release ]; then
+ . /usr/lib/os-release
+ _args+=(BRANDING="${NAME}")
+else
+ _args+=(BRANDING='Unknown Linux')
+fi
+
+prepare(){
+ cd "${srcdir}/${pkgbase}-${pkgver}"
+ sed -i 's:0444:0644:' mk/sys.mk
+ patch -Np 1 -i ../binfmt-sh.patch
+}
+
+check(){
+ cd "${srcdir}/${pkgbase}-${pkgver}"
+ make -k check
+}
+
+build(){
+ cd "${pkgbase}-${pkgver}"
+ make "${_args[@]}"
+}
+
+package_openrc() {
+ depends=('psmisc' 'pam' 'opentmpfiles' 'netifrc' 'openrc-pid1')
+ backup=('etc/rc.conf'
+ 'etc/conf.d/consolefont'
+ 'etc/conf.d/keymaps'
+ 'etc/conf.d/hostname'
+ 'etc/conf.d/modules'
+ 'etc/conf.d/hwclock'
+ 'etc/conf.d/opentmpfiles-dev'
+ 'etc/conf.d/opentmpfiles-setup')
+ provides=('kmod-openrc')
+ conflicts=('kmod-openrc' 'systemd-tools')
+ replaces=('kmod-openrc')
+
+ cd "${pkgbase}-${pkgver}"
+
+ make DESTDIR="${pkgdir}" "${_args[@]}" install
+
+ install -Dm644 "${srcdir}/${pkgbase}".logrotate "${pkgdir}"/etc/logrotate.d/"${pkgbase}"
+
+ sed -e 's/#unicode="NO"/unicode="YES"/' \
+ -e 's/#rc_logger="NO"/rc_logger="YES"/' \
+ -e 's/#rc_controller_cgroups="YES"/rc_controller_cgroups="YES"/' \
+ -e 's|#rc_shell=/bin/sh|rc_shell=/usr/bin/sulogin|' \
+ -i "${pkgdir}/etc/rc.conf"
+
+ install -d "${pkgdir}"/usr/lib/{openrc/cache,binfmt.d,sysctl.d}
+
+ # getty
+ sed -e 's|#baud=""|baud="38400"|' \
+ -e 's|#term_type="linux"|term_type="linux"|' \
+ -e 's|#agetty_options=""|agetty_options=""|' \
+ -i ${pkgdir}/etc/conf.d/agetty
+
+ # sysctl defaults
+ install -m755 "${srcdir}"/sysctl.conf "${pkgdir}"/usr/lib/sysctl.d/50-default.conf
+
+ # pacman hooks
+ install -Dm755 "${srcdir}"/openrc-hook "${pkgdir}"/usr/share/libalpm/scripts/openrc-hook
+ install -Dm644 -t "${pkgdir}"/usr/share/libalpm/hooks "${srcdir}"/*.hook
+
+ # license
+ install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/"${pkgbase}"/LICENSE
+
+ # split bash completions
+ install -d "${srcdir}"/_bash-completion/usr/share/bash-completion/completions
+ mv -v "${pkgdir}"/usr/share/bash-completion/completions/* "${srcdir}"/_bash-completion/usr/share/bash-completion/completions
+
+ # split zsh completions
+ install -d "${srcdir}"/_zsh/usr/share/zsh/site-functions
+ mv -v "${pkgdir}"/usr/share/zsh/site-functions/* "${srcdir}"/_zsh/usr/share/zsh/site-functions
+
+ # split init
+ for file in \
+ etc/init.d/agetty.tty{1..6} \
+ etc/runlevels/default/agetty.tty{1..6} \
+ {usr,usr/lib/openrc}/bin/shutdown \
+ {usr,usr/lib/openrc}/bin/reboot \
+ {usr,usr/lib/openrc}/bin/halt \
+ {usr,usr/lib/openrc}/bin/poweroff \
+ usr/bin/openrc-{init,shutdown} \
+ usr/bin/init \
+ usr/share/man/man8/openrc-{init,shutdown}.8
+ do
+ install -d "${srcdir}"/_init/"${file%/*}"
+ mv -v "${pkgdir}"/"${file}" "${srcdir}"/_init/"${file}"
+ done
+
+ install -d "${srcdir}"/_init/etc/conf.d
+ cp -v "${pkgdir}"/etc/conf.d/agetty "${srcdir}"/_init/etc/conf.d/agetty
+
+ # sysusers & tmpfiles
+ install -m755 "${srcdir}"/opentmpfiles-dev.confd "${pkgdir}"/etc/conf.d/opentmpfiles-dev
+ install -m755 "${srcdir}"/opentmpfiles-dev.initd "${pkgdir}"/etc/init.d/opentmpfiles-dev
+
+ install -m755 "${srcdir}"/opentmpfiles-setup.confd "${pkgdir}"/etc/conf.d/opentmpfiles-setup
+ install -m755 "${srcdir}"/opentmpfiles-setup.initd "${pkgdir}"/etc/init.d/opentmpfiles-setup
+
+ install -m755 "${srcdir}"/opensysusers.initd "${pkgdir}"/etc/init.d/opensysusers
+
+ ln -snf /etc/init.d/opensysusers "${pkgdir}"/etc/runlevels/boot/opensysusers
+ ln -snf /etc/init.d/opentmpfiles-dev "${pkgdir}"/etc/runlevels/sysinit/opentmpfiles-dev
+ ln -snf /etc/init.d/opentmpfiles-setup "${pkgdir}"/etc/runlevels/boot/opentmpfiles-setup
+
+ # kmod staticc nodes
+ install -m755 "${srcdir}"/kmod-static-nodes.initd "${pkgdir}"/etc/init.d/kmod-static-nodes
+ ln -snf /etc/init.d/kmod-static-nodes "${pkgdir}"/etc/runlevels/sysinit/kmod-static-nodes
+}
+
+package_openrc-bash-completions() {
+ depends=('openrc' 'bash')
+ pkgdesc="OpenRC completions for Bash"
+
+ mv -v "${srcdir}"/_bash-completion/* "${pkgdir}"
+}
+
+package_openrc-zsh-completions() {
+ depends=('openrc' 'zsh')
+ pkgdesc="OpenRC completions for ZSH"
+
+ mv -v "${srcdir}"/_zsh/* "${pkgdir}"
+}
+
+package_openrc-init() {
+ pkgdesc="OpenRC alternative to sysvinit"
+ depends=('openrc')
+ provides=('openrc-pid1' 'init')
+ conflicts=('openrc-pid1' 'systemd-sysvcompat')
+ backup=(etc/conf.d/agetty.tty{1..6})
+
+ cd "${pkgbase}-${pkgver}"
+
+ mv -v "${srcdir}"/_init/* "${pkgdir}"
+
+ # license
+ install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
+
+ for num in {1..6};do
+ cp -v ${pkgdir}/etc/conf.d/agetty ${pkgdir}/etc/conf.d/agetty.tty$num
+ done
+ rm ${pkgdir}/etc/conf.d/agetty
+}
+
+package_openrc-sysvinit() {
+ pkgdesc="OpenRC support for using sysvinit as PID 1"
+ depends=('openrc' 'sysvinit')
+ backup=('etc/inittab')
+
+ cd "${pkgbase}-${pkgver}"
+
+ # license
+ install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/"${pkgname}"/LICENSE
+
+ # sample sysvinit inittab
+ install -Dm644 support/sysvinit/inittab "${pkgdir}"/etc/inittab
+}
diff --git a/nonsystemd/openrc/binfmt-sh.patch b/nonsystemd/openrc/binfmt-sh.patch
new file mode 100644
index 000000000..dc12824d3
--- /dev/null
+++ b/nonsystemd/openrc/binfmt-sh.patch
@@ -0,0 +1,18 @@
+0a6df09c5bb82bf964177dd3e1c03cb9cf7a8c42
+ sh/binfmt.sh.in | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/sh/binfmt.sh.in b/sh/binfmt.sh.in
+index ca4a8833..34d6d5e3 100644
+--- a/sh/binfmt.sh.in
++++ b/sh/binfmt.sh.in
+@@ -29,6 +29,9 @@ apply_file() {
+ \;*) continue ;;
+ esac
+
++ local reg=${line#*:}
++ [ -e /proc/sys/fs/binfmt_misc/${reg%%:*} ] && echo -1 > /proc/sys/fs/binfmt_misc/${reg%%:*}
++
+ echo "${line}" > /proc/sys/fs/binfmt_misc/register
+ rc=$?
+ if [ $rc -ne 0 ]; then
diff --git a/nonsystemd/openrc/kmod-static-nodes.initd b/nonsystemd/openrc/kmod-static-nodes.initd
new file mode 100644
index 000000000..7a3f529dc
--- /dev/null
+++ b/nonsystemd/openrc/kmod-static-nodes.initd
@@ -0,0 +1,19 @@
+#!/usr/bin/openrc-run
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+description="Create list of required static device nodes for the current kernel"
+
+depend() {
+ after dev-mount
+ before tmpfiles.dev dev
+ keyword -lxc -systemd-nspawn
+}
+
+start() {
+ ebegin "Creating list of required static device nodes for the current kernel"
+ checkpath -q -d /run/tmpfiles.d
+ kmod static-nodes --format=tmpfiles --output=/run/tmpfiles.d/kmod.conf
+ eend $?
+}
diff --git a/nonsystemd/openrc/openrc-hook b/nonsystemd/openrc/openrc-hook
new file mode 100644
index 000000000..d7777e1ae
--- /dev/null
+++ b/nonsystemd/openrc/openrc-hook
@@ -0,0 +1,27 @@
+#!/bin/sh -e
+
+openrc_live() {
+ if [ ! -f /run/openrc/softlevel ]; then
+ echo >&2 " Skipped: Current root is not booted."
+ exit 0
+ fi
+}
+
+each_conf() {
+ while read -r f; do
+ "$@" "/$f"
+ done
+}
+
+op="$1"; shift
+
+case $op in
+ sysctl) openrc_live; each_conf /usr/bin/sysctl -q -p ;;
+ binfmt) openrc_live; each_conf /usr/lib/openrc/sh/binfmt.sh ;;
+ reexec) openrc_live; /usr/bin/openrc-shutdown -R ;;
+ # For use by other packages
+ reload) openrc_live; /usr/bin/rc-service "$@" reload ;;
+ *) echo >&2 " Invalid operation '$op'"; exit 1 ;;
+esac
+
+exit 0
diff --git a/nonsystemd/openrc/openrc.install b/nonsystemd/openrc/openrc.install
new file mode 100644
index 000000000..91edc9e2e
--- /dev/null
+++ b/nonsystemd/openrc/openrc.install
@@ -0,0 +1,3 @@
+post_install() {
+ echo " ==> Install one of the optional depends for network support!"
+}
diff --git a/nonsystemd/openrc/openrc.logrotate b/nonsystemd/openrc/openrc.logrotate
new file mode 100644
index 000000000..a168f2361
--- /dev/null
+++ b/nonsystemd/openrc/openrc.logrotate
@@ -0,0 +1,7 @@
+/var/log/rc.log {
+ compress
+ rotate 4
+ weekly
+ missingok
+ notifempty
+}
diff --git a/nonsystemd/openrc/opensysusers.initd b/nonsystemd/openrc/opensysusers.initd
new file mode 100644
index 000000000..6aa2d61fd
--- /dev/null
+++ b/nonsystemd/openrc/opensysusers.initd
@@ -0,0 +1,18 @@
+#!/usr/bin/openrc-run
+# Copyright (c) 2017 - 2018 Chris Cromer
+# Released under the 2-clause BSD license.
+
+description="Set up sysusers.d entries"
+
+depend()
+{
+ need localmount
+}
+
+start()
+{
+ ebegin "Setting up sysusers.d entries"
+ /usr/bin/sysusers
+ eend $?
+}
+
diff --git a/nonsystemd/openrc/opentmpfiles-dev.confd b/nonsystemd/openrc/opentmpfiles-dev.confd
new file mode 100644
index 000000000..86558d435
--- /dev/null
+++ b/nonsystemd/openrc/opentmpfiles-dev.confd
@@ -0,0 +1,2 @@
+# Extra options to pass to tmpfiles
+#tmpfiles_opts=""
diff --git a/nonsystemd/openrc/opentmpfiles-dev.initd b/nonsystemd/openrc/opentmpfiles-dev.initd
new file mode 100644
index 000000000..587d0e9ea
--- /dev/null
+++ b/nonsystemd/openrc/opentmpfiles-dev.initd
@@ -0,0 +1,20 @@
+#!/usr/bin/openrc-run
+# Copyright 1999-2012 Gentoo Foundation
+# Released under the 2-clause BSD license.
+
+description="Set up tmpfiles.d entries for /dev"
+
+depend()
+{
+ provide tmpfiles-dev tmpfiles.dev
+ use dev-mount
+ before dev
+ keyword -prefix -vserver
+}
+
+start()
+{
+ ebegin "Setting up tmpfiles.d entries for /dev"
+ tmpfiles --prefix=/dev --create --boot ${tmpfiles_opts}
+ eend $?
+}
diff --git a/nonsystemd/openrc/opentmpfiles-setup.confd b/nonsystemd/openrc/opentmpfiles-setup.confd
new file mode 100644
index 000000000..86558d435
--- /dev/null
+++ b/nonsystemd/openrc/opentmpfiles-setup.confd
@@ -0,0 +1,2 @@
+# Extra options to pass to tmpfiles
+#tmpfiles_opts=""
diff --git a/nonsystemd/openrc/opentmpfiles-setup.initd b/nonsystemd/openrc/opentmpfiles-setup.initd
new file mode 100644
index 000000000..d36481f25
--- /dev/null
+++ b/nonsystemd/openrc/opentmpfiles-setup.initd
@@ -0,0 +1,19 @@
+#!/usr/bin/openrc-run
+# Copyright 1999-2012 Gentoo Foundation
+# Released under the 2-clause BSD license.
+
+description="Set up tmpfiles.d entries"
+
+depend()
+{
+ provide tmpfiles-setup tmpfiles.setup
+ need localmount
+}
+
+start()
+{
+ ebegin "Setting up tmpfiles.d entries"
+ tmpfiles --exclude-prefix=/dev --create --remove --boot \
+ ${tmpfiles_opts}
+ eend $?
+}
diff --git a/nonsystemd/openrc/sysctl.conf b/nonsystemd/openrc/sysctl.conf
new file mode 100644
index 000000000..de238b937
--- /dev/null
+++ b/nonsystemd/openrc/sysctl.conf
@@ -0,0 +1,28 @@
+# See sysctl.d(5) and core(5) for documentation.
+
+# To override settings in this file, create a local file in /etc
+# (e.g. /etc/sysctl.d/90-override.conf), and put any assignments
+# there.
+
+# System Request functionality of the kernel (SYNC)
+#
+# Use kernel.sysrq = 1 to allow all keys.
+# See https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html for a list
+# of values and keys.
+# kernel.sysrq = 16
+
+# Source route verification
+net.ipv4.conf.all.rp_filter = 1
+
+# Do not accept source routing
+net.ipv4.conf.all.accept_source_route = 0
+
+# Promote secondary addresses when the primary address is removed
+net.ipv4.conf.all.promote_secondaries = 1
+
+# Fair Queue CoDel packet scheduler to fight bufferbloat
+net.core.default_qdisc = fq_codel
+
+# Enable hard and soft link protection
+fs.protected_hardlinks = 1
+fs.protected_symlinks = 1