From 71bcae8bafbdecc0951e399c26c27cdea08467d3 Mon Sep 17 00:00:00 2001 From: Morris Zuss Date: May 19 2022 20:06:00 +0000 Subject: glibc-openrc --- diff --git a/nonsystemd/glibc-openrc/PKGBUILD b/nonsystemd/glibc-openrc/PKGBUILD new file mode 100644 index 0000000..b06d47d --- /dev/null +++ b/nonsystemd/glibc-openrc/PKGBUILD @@ -0,0 +1,17 @@ +# Maintainer: artoo + +pkgname=glibc-openrc +pkgver=20220519 +pkgrel=1 +pkgdesc="OpenRC nscd init script" +arch=('any') +url="https://gitea.artixlinux.org/artixlinux/packages-openrc" +license=('GPL2') +depends=('openrc' 'glibc') +conflicts=('systemd-sysvcompat') +source=("nscd.initd") +sha512sums=('be8cbf94f818121e522fb93a696674c9e0433d2f61764074c4d0a2dbaaa14dc4e7a21e288689cea8394183ae9410e34e92811ca3d48cd410ef427167c8e3f7a7') + +package() { + install -Dm755 "${srcdir}"/nscd.initd "${pkgdir}"/etc/init.d/nscd +} diff --git a/nonsystemd/glibc-openrc/nscd.initd b/nonsystemd/glibc-openrc/nscd.initd new file mode 100644 index 0000000..9e9ca18 --- /dev/null +++ b/nonsystemd/glibc-openrc/nscd.initd @@ -0,0 +1,85 @@ +#!/usr/bin/openrc-run +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +description="The 'Name Service Cache Daemon' is a daemon that provides a cache" +description="${description} for the most common name service requests" + +extra_started_commands="flush_all flush_hosts flush_group flush_passwd flush_netgroup flush_services" + +description_flush_all="Will invalidate hosts, group, passwd, netgroup and services cache" +description_flush_hosts="Will invalidate hosts cache" +description_flush_group="Will invalidate group cache" +description_flush_passwd="Will invalidate passwd cache" +description_flush_netgroup="Will invalidate netgroup cache" +description_flush_services="Will invalidate services cache" + +pidfile="/run/nscd/nscd.pid" +command="/usr/bin/nscd" + +depend() { + use dns ldap net slapd logger +} + +checkconfig() { + if [ ! -d /run/nscd ] ; then + checkpath -d -m 755 /run/nscd + fi + + if [ -z "${NSCD_PERMS_OK}" ] && [ "$(stat -c %a /run/nscd)" != "755" ] ; then + ewarn "nscd run dir is not readable, you should reset the perms:" + ewarn "chmod 755 /run/nscd" + ewarn "chmod a+rw /run/nscd/socket" + ewarn "To disable this warning, set 'NSCD_PERMS_OK' in /etc/conf.d/nscd" + fi + + if grep -qs '^[[:space:]]*persistent\>' /etc/nscd.conf ; then + checkpath -d -m 700 /var/db/nscd + fi +} + +_flush() { + local table=$1 + + ebegin "Flushing ${table} table" + ${command} --invalidate ${table} + eend $? +} + +flush_all() { + local has_errors=0 + + ebegin "Flushing all caches" + + local table= + for table in passwd group hosts netgroup services; do + ${command} --invalidate ${table} + [ $? -ne 0 ] && has_errors=1 + done + + eend ${has_errors} +} + +flush_hosts() { + _flush hosts +} + +flush_group() { + _flush group +} + +flush_passwd() { + _flush passwd +} + +flush_netgroup() { + _flush netgroup +} + +flush_services() { + _flush services +} + +start_pre() { + checkconfig +}