diff options
author | freaj <freaj@riseup.net> | 2015-03-30 10:36:00 +0200 |
---|---|---|
committer | freaj <freaj@riseup.net> | 2015-03-30 10:36:00 +0200 |
commit | 7385c6143c1b587bca68deade6e5989d11879767 (patch) | |
tree | 6ccef2617293e9afd03c80d5de22fd8f9c260c70 /pcr/openrc-net | |
parent | 41c9dc8729840f45f174a14a08703e04d1f5717e (diff) | |
download | abslibre-7385c6143c1b587bca68deade6e5989d11879767.tar.gz abslibre-7385c6143c1b587bca68deade6e5989d11879767.tar.bz2 abslibre-7385c6143c1b587bca68deade6e5989d11879767.zip |
openrc-net-20150330-1: updating version
Diffstat (limited to 'pcr/openrc-net')
61 files changed, 2408 insertions, 8 deletions
diff --git a/pcr/openrc-net/PKGBUILD b/pcr/openrc-net/PKGBUILD index a0f5bf1a5..ed3450d63 100644 --- a/pcr/openrc-net/PKGBUILD +++ b/pcr/openrc-net/PKGBUILD @@ -116,7 +116,7 @@ pkgname=('autofs-openrc' 'wicd-openrc' 'syncthing-openrc' 'nginx-openrc') -pkgver=20150119 +pkgver=20150330 pkgrel=1 pkgdesc="OpenRC init scripts" arch=('any') @@ -685,7 +685,7 @@ sha256sums=('8e093a18582c3a20283ed1c09de9acc6832a80b1d5a02962599db0535d38af19' 'e8a413e9102948b336f60041fc3cade33125faf56d8319ee65d9f3c63199a8e7' 'a157630c3bdc9565cca8240ee1e6539fc9cbc1e4642c40e0965e3609d1021bac' '099f668e1ad42ed9446b15675032a1186715d1fe9e4a1b24dfb787e68495d2b6' - '049a231908dc2c5f82446712d71d5e75d430bd043b53eead1529f2d81e1595ab' + 'b5811c6adf10d6210e5685b4e999f0449ac492379d055226eeb140f00d9b8702' '204aaf81d51dc119cee1d1ff3ae3dd50af666af2f8b2a363fd1bf442d4dcee00' '916f4b14095ee4ec8a510391c883e9f01868e18d79a3d5cbeb13a104a793d45d' 'b9701b9ea509638ee1ed74bec38a22e6bd7358763497ce53c146d2faf9e97a61' @@ -697,15 +697,15 @@ sha256sums=('8e093a18582c3a20283ed1c09de9acc6832a80b1d5a02962599db0535d38af19' 'c374ea05d7e9f15e10c8f9dbd0cad6548e0f92aef7de33e5dbc27222e9407e7b' 'bb6e6721f33e6582a91025f3500e159a599fb856d699e9394093e1018c7925e0' 'b1515472c32927039b38f6c3a797cbc54a5a300b5d6fa54df9550174afa2b7f8' - '22bba4ee5d58bae422650875c7c8a797a52fc121ddd02d48297c075b8a35401e' + 'c652a4fe8a43dc68a818345db2b3acc560663b5b6c969324d4f23afb0fb96a94' '1e77bc6fb2ceb266f724818898bd42bec47512a5a7ede6660e0565ea1c58d619' - 'a1ecfb9441052d374b6bc2b77554a3253a4e4c231c76114b3313d2cc68e561b8' - '426996fc12758565d4c827762df76634f40cc8915988ab89ba5e81aeb561cf46' + 'e8842fca856eae598fb8fe15ed8d3cef13e61851217be66b8cc4087af8cee8ad' + '122ade9931af8f64696375c9c66d00f64a90949616e00e9a00a7264c50c2e8a7' '3ce65326859c43983dad25ad2d4731488c488037796e39b6b5eda336e8bf81ef' 'ebee63e81fb952474c34b745913e8774b29c9cc65180d363a33d991e478aea2d' '00d9c29280a83e8458c33139d04a9b38c6fdba9d7cb9b420ca83bf6b10e6435d' 'f1c460d8b0e91e54a551397d755135d05a3728d81de596535bf8bda074455677' - '0c7bd35a14da6c0c2577f09ae82a41ddb693a88157eeaf80684616f79be6c304' + 'a5731b8f681111421277c6c1c43b3e1d303790d9f8aebd977a895b0ed7a73bc3' '5bca003ec3b67c7c78519aede1d82002579006ccfecce8f87b559df719f82e92' '1fc515a6816b8a750db513df0b3b9bf8dd8bd4c4e9051205521acadfdebeae0f' '7f228796e020c0779c52683f684197d50662ae890b1ae193ffa9acf157ccd143' @@ -729,7 +729,7 @@ sha256sums=('8e093a18582c3a20283ed1c09de9acc6832a80b1d5a02962599db0535d38af19' '069aa7382b40aecebf26ef53f3f4c49890314e0357925c84b3c15f1d0b913be0' '657b5305923b2a5de9eb96931aaaa28d6e997ace6c40793d905887798094258c' '2de7c7c1edfe3ae0480e22d988a564db3bb873050929ebb6e8361d7a1288ddda' - 'e6cf3df546aae57bb10e2b4282a9ccd79741473ef9dbdbd7628a16c84622da06' + '4297952eeeb02b5c4f2f750742614513fa6a0c8d291a9a0adcec1ec0098fcd78' 'e401e2cf7c0180a170d3dc3e91d7e98002bae7b013df72813b7bcf89b864fb3a' '6aeb4ec9b8ccc062b5ee8c609830c05cee3ed790fa90d7b2d8cf82a09e317c5c' '79f6c6ed4875f00fe702f69e9a6180a032d5a47f3e58e892e6ba0e2746b6fec8' @@ -746,7 +746,7 @@ sha256sums=('8e093a18582c3a20283ed1c09de9acc6832a80b1d5a02962599db0535d38af19' '91fb1497b3a6ef0bb3a3d5baefdff801d8ff1cba27aaf742303415550814a09b' 'fca7183a7676f0f471878925c8fbec20b7a0bff01551c0ad2b34d4d8a826c876' '41d780f291847e19f632428bbf27c3f289414afd237546d2974da1b75384c25c' - '49da1b5f267927023bc092adcf89d406ec294584039d6bca6b7aea0a9e7c4c4f' + '17cfda4d50a3d3fd74f36c79dec78b5f89fe6b45712729d8bbdbddd7e8ea9a10' '66b2b53b077ddc2d5eb1d81faa99fa0f4f0db01520900ba948001e539bfe02d8' 'eb4a4315916fe3f8688c1da5bb5c249a1f402e61617452288d5b0668078c955c' '63708b1a7b61ae791df64bb4cefa01dc12236f96bb67fe6d0b2c513e11c81f3e' diff --git a/pcr/openrc-net/autofs5.initd b/pcr/openrc-net/autofs5.initd new file mode 100644 index 000000000..939444e02 --- /dev/null +++ b/pcr/openrc-net/autofs5.initd @@ -0,0 +1,70 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/autofs/files/autofs5.initd,v 1.4 2013/11/10 15:53:29 tomwij Exp $ + +DAEMON=/usr/sbin/automount +PIDFILE=/var/run/autofs.pid +DEVICE=autofs + +depend() { + need localmount + use ypbind nfs slapd portmap net +} + +extra_started_commands="reload" + +start() { + ebegin "Starting automounter" + + # Ensure autofs support is loaded + grep -q autofs /proc/filesystems || modprobe -q autofs4 + if [ $? -ne 0 ]; then + eend 1 "No autofs support available in kernel" + return 1 + fi + + # Check misc device + if [ -n "${USE_MISC_DEVICE}" -a "${USE_MISC_DEVICE}" = "yes" ]; then + sleep 1 + if [ -e "/proc/misc" ]; then + MINOR=$(awk "/${DEVICE}/ {print \$1}" /proc/misc) + if [ -n "${MINOR}" -a ! -c "/dev/${DEVICE}" ]; then + mknod -m 0600 "/dev/${DEVICE}" c 10 ${MINOR} + if [ $? -ne 0 ]; then + eend 1 "Could not create '/dev/${DEVICE}'" + return 1 + fi + fi + fi + if [ -x /sbin/restorecon -a -c "/dev/${DEVICE}" ]; then + /sbin/restorecon "/dev/${DEVICE}" + if [ $? -ne 0 ]; then + eend 1 "Failed to execute '/sbin/restorecon \"/dev/${DEVICE}\"'" + return 1 + fi + fi + else + [ -c "/dev/${DEVICE}" ] && rm -rf "/dev/${DEVICE}" + fi + + start-stop-daemon --start --exec ${DAEMON} -- -p ${PIDFILE} ${OPTIONS} + + eend $? +} + +stop() { + ebegin "Stopping automounter" + start-stop-daemon --stop --quiet -R TERM/45 -p ${PIDFILE} + eend $? +} + +reload() { + ebegin "Reloading automounter" + if [ ! -r "${PIDFILE}" ]; then + eend 1 "automount not running" + else + kill -s HUP $(cat "${PIDFILE}") 2> /dev/null + eend $? + fi +} diff --git a/pcr/openrc-net/hostapd-init.d b/pcr/openrc-net/hostapd-init.d new file mode 100644 index 000000000..d09002b66 --- /dev/null +++ b/pcr/openrc-net/hostapd-init.d @@ -0,0 +1,39 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-wireless/hostapd/files/hostapd-init.d,v 1.4 2014/03/21 19:47:14 gurligebis Exp $ + +pidfile="/run/${SVCNAME}.pid" +command="/usr/sbin/hostapd" +command_args="-P ${pidfile} -B ${OPTIONS} ${CONFIGS}" + +extra_started_commands="reload" + +depend() { + local myneeds= + for iface in ${INTERFACES}; do + myneeds="${myneeds} net.${iface}" + done + + [ -n "${myneeds}" ] && need ${myneeds} + use logger +} + +start_pre() { + local file + + for file in ${CONFIGS}; do + if [ ! -r "${file}" ]; then + eerror "hostapd configuration file (${CONFIG}) not found" + return 1 + fi + done +} + +reload() { + start_pre || return 1 + + ebegin "Reloading ${SVCNAME} configuration" + kill -HUP $(cat ${pidfile}) > /dev/null 2>&1 + eend $? +} diff --git a/pcr/openrc-net/ip6tables-1.4.13.confd b/pcr/openrc-net/ip6tables-1.4.13.confd new file mode 100644 index 000000000..3bb36989d --- /dev/null +++ b/pcr/openrc-net/ip6tables-1.4.13.confd @@ -0,0 +1,19 @@ +# /etc/conf.d/ip6tables + +# Location in which iptables initscript will save set rules on +# service shutdown +IP6TABLES_SAVE="/var/lib/ip6tables/rules-save" + +# Options to pass to iptables-save and iptables-restore +SAVE_RESTORE_OPTIONS="-c" + +# Save state on stopping iptables +SAVE_ON_STOP="yes" + +# If you need to log iptables messages as soon as iptables starts, +# AND your logger does NOT depend on the network, then you may wish +# to uncomment the next line. +# If your logger depends on the network, and you uncomment this line +# you will create an unresolvable circular dependency during startup. +# After commenting or uncommenting this line, you must run 'rc-update -u'. +#rc_use="logger" diff --git a/pcr/openrc-net/iptables-1.4.13-r1.init b/pcr/openrc-net/iptables-1.4.13-r1.init new file mode 100644 index 000000000..a63d07688 --- /dev/null +++ b/pcr/openrc-net/iptables-1.4.13-r1.init @@ -0,0 +1,130 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-firewall/iptables/files/iptables-1.4.13-r1.init,v 1.3 2013/04/27 17:29:09 vapier Exp $ + +extra_commands="check save panic" +extra_started_commands="reload" + +iptables_name=${SVCNAME} +case ${iptables_name} in +iptables|ip6tables) ;; +*) iptables_name="iptables" ;; +esac + +iptables_bin="/sbin/${iptables_name}" +case ${iptables_name} in + iptables) iptables_proc="/proc/net/ip_tables_names" + iptables_save=${IPTABLES_SAVE};; + ip6tables) iptables_proc="/proc/net/ip6_tables_names" + iptables_save=${IP6TABLES_SAVE};; +esac + +depend() { + need localmount #434774 + before net +} + +set_table_policy() { + local chains table=$1 policy=$2 + case ${table} in + nat) chains="PREROUTING POSTROUTING OUTPUT";; + mangle) chains="PREROUTING INPUT FORWARD OUTPUT POSTROUTING";; + filter) chains="INPUT FORWARD OUTPUT";; + *) chains="";; + esac + local chain + for chain in ${chains} ; do + ${iptables_bin} -t ${table} -P ${chain} ${policy} + done +} + +checkkernel() { + if [ ! -e ${iptables_proc} ] ; then + eerror "Your kernel lacks ${iptables_name} support, please load" + eerror "appropriate modules and try again." + return 1 + fi + return 0 +} +checkconfig() { + if [ ! -f ${iptables_save} ] ; then + eerror "Not starting ${iptables_name}. First create some rules then run:" + eerror "/etc/init.d/${iptables_name} save" + return 1 + fi + return 0 +} + +start() { + checkconfig || return 1 + ebegin "Loading ${iptables_name} state and starting firewall" + ${iptables_bin}-restore ${SAVE_RESTORE_OPTIONS} < "${iptables_save}" + eend $? +} + +stop() { + if [ "${SAVE_ON_STOP}" = "yes" ] ; then + save || return 1 + fi + checkkernel || return 1 + ebegin "Stopping firewall" + local a + for a in $(cat ${iptables_proc}) ; do + set_table_policy $a ACCEPT + + ${iptables_bin} -F -t $a + ${iptables_bin} -X -t $a + done + eend $? +} + +reload() { + checkkernel || return 1 + checkrules || return 1 + ebegin "Flushing firewall" + local a + for a in $(cat ${iptables_proc}) ; do + ${iptables_bin} -F -t $a + ${iptables_bin} -X -t $a + done + eend $? + + start +} + +checkrules() { + ebegin "Checking rules" + ${iptables_bin}-restore --test ${SAVE_RESTORE_OPTIONS} < "${iptables_save}" + eend $? +} + +check() { + # Short name for users of init.d script. + checkrules +} + +save() { + ebegin "Saving ${iptables_name} state" + checkpath -q -d "$(dirname "${iptables_save}")" + checkpath -q -m 0600 -f "${iptables_save}" + ${iptables_bin}-save ${SAVE_RESTORE_OPTIONS} > "${iptables_save}" + eend $? +} + +panic() { + checkkernel || return 1 + if service_started ${iptables_name}; then + rc-service ${iptables_name} stop + fi + + local a + ebegin "Dropping all packets" + for a in $(cat ${iptables_proc}) ; do + ${iptables_bin} -F -t $a + ${iptables_bin} -X -t $a + + set_table_policy $a DROP + done + eend $? +} diff --git a/pcr/openrc-net/iptables-1.4.13.confd b/pcr/openrc-net/iptables-1.4.13.confd new file mode 100644 index 000000000..7225374c3 --- /dev/null +++ b/pcr/openrc-net/iptables-1.4.13.confd @@ -0,0 +1,19 @@ +# /etc/conf.d/iptables + +# Location in which iptables initscript will save set rules on +# service shutdown +IPTABLES_SAVE="/var/lib/iptables/rules-save" + +# Options to pass to iptables-save and iptables-restore +SAVE_RESTORE_OPTIONS="-c" + +# Save state on stopping iptables +SAVE_ON_STOP="yes" + +# If you need to log iptables messages as soon as iptables starts, +# AND your logger does NOT depend on the network, then you may wish +# to uncomment the next line. +# If your logger depends on the network, and you uncomment this line +# you will create an unresolvable circular dependency during startup. +# After commenting or uncommenting this line, you must run 'rc-update -u'. +#rc_use="logger" diff --git a/pcr/openrc-net/lighttpd.confd b/pcr/openrc-net/lighttpd.confd new file mode 100644 index 000000000..f3afb07a5 --- /dev/null +++ b/pcr/openrc-net/lighttpd.confd @@ -0,0 +1,12 @@ +# /etc/conf.d/lighttpd + +# Location of a shell used by the 'include_shell' directive +# in the lighttpd's configuration file +#export SHELL="/bin/bash" + +# Location of the lighttpd configuration file +LIGHTTPD_CONF="/etc/lighttpd/lighttpd.conf" + +# Location of the lighttpd pid file +LIGHTTPD_PID="$(/usr/bin/awk '/^server.pid-file/{s=$3};{sub("\"","",s)};END{print s}' ${LIGHTTPD_CONF})" + diff --git a/pcr/openrc-net/lighttpd.initd b/pcr/openrc-net/lighttpd.initd new file mode 100644 index 000000000..43626c026 --- /dev/null +++ b/pcr/openrc-net/lighttpd.initd @@ -0,0 +1,73 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/lighttpd.initd,v 1.22 2013/02/06 19:36:51 hwoarang Exp $ + +extra_started_commands="reload graceful" + +depend() { + need net + use mysql logger spawn-fcgi ldap slapd netmount dns + after famd + after sshd +} + +checkconfig() { + if [ ! -f "${LIGHTTPD_CONF}" ] ; then + ewarn "${LIGHTTPD_CONF} does not exist." + return 1 + fi + + if [ -z "${LIGHTTPD_PID}" ] ; then + ewarn "server.pid-file variable in ${LIGHTTPD_CONF}" + ewarn "is not set. Falling back to lighttpd.pid" + LIGHTTPD_PID="/run/lighttpd.pid" + fi + /usr/sbin/lighttpd -t -f ${LIGHTTPD_CONF} >/dev/null +} + +start() { + checkconfig || return 1 + checkpath -d -q -m 0750 -o lighttpd:lighttpd /run/lighttpd/ + + ebegin "Starting lighttpd" + start-stop-daemon --start --quiet --exec /usr/sbin/lighttpd \ + --pidfile "${LIGHTTPD_PID}" -- -f "${LIGHTTPD_CONF}" + eend $? +} + +stop() { + local rv=0 + ebegin "Stopping lighttpd" + start-stop-daemon --stop --quiet --pidfile "${LIGHTTPD_PID}" + eend $? +} + +reload() { + if ! service_started "${SVCNAME}" ; then + eerror "${SVCNAME} isn't running" + return 1 + fi + checkconfig || return 1 + + ebegin "Re-opening lighttpd log files" + start-stop-daemon --quiet --pidfile "${LIGHTTPD_PID}" \ + --signal HUP + eend $? +} + +graceful() { + if ! service_started "${SVCNAME}" ; then + eerror "${SVCNAME} isn't running" + return 1 + fi + checkconfig || return 1 + + ebegin "Gracefully stopping lighttpd" + start-stop-daemon --quiet --pidfile "${LIGHTTPD_PID}" \ + --signal INT + if eend $? ; then + rm -f "${LIGHTTPD_PID}" + start + fi +} diff --git a/pcr/openrc-net/mit-krb5kadmind.initd-r1 b/pcr/openrc-net/mit-krb5kadmind.initd-r1 new file mode 100644 index 000000000..7b28fb2ae --- /dev/null +++ b/pcr/openrc-net/mit-krb5kadmind.initd-r1 @@ -0,0 +1,25 @@ +#!/sbin/runscript + +#--------------------------------------------------------------------------- +# This script starts/stops the MIT Kerberos 5 Admin daemon +#--------------------------------------------------------------------------- + +daemon="MIT Kerberos 5 Admin daemon" +exec="/usr/sbin/kadmind" + +depend() { + need mit-krb5kdc + use net +} + +start() { + ebegin "Starting $daemon" + start-stop-daemon --start --quiet --exec ${exec} 1>&2 + eend $? "Error starting $daemon" +} + +stop() { + ebegin "Stopping $daemon" + start-stop-daemon --stop --quiet --exec ${exec} 1>&2 + eend $? "Error stopping $daemon" +} diff --git a/pcr/openrc-net/mit-krb5kdc.initd-r1 b/pcr/openrc-net/mit-krb5kdc.initd-r1 new file mode 100644 index 000000000..94f1f7937 --- /dev/null +++ b/pcr/openrc-net/mit-krb5kdc.initd-r1 @@ -0,0 +1,24 @@ +#!/sbin/runscript + +#--------------------------------------------------------------------------- +# This script starts/stops the MIT Kerberos 5 KDC +#--------------------------------------------------------------------------- + +daemon="MIT Kerberos 5 KDC" +exec="/usr/sbin/krb5kdc" + +depend() { + use net +} + +start() { + ebegin "Starting $daemon" + start-stop-daemon --start --quiet --exec ${exec} 1>&2 + eend $? "Error starting $daemon" +} + +stop() { + ebegin "Stopping $daemon" + start-stop-daemon --stop --quiet --exec ${exec} 1>&2 + eend $? "Error stopping $daemon" +} diff --git a/pcr/openrc-net/mit-krb5kpropd.initd-r1 b/pcr/openrc-net/mit-krb5kpropd.initd-r1 new file mode 100644 index 000000000..d800d666a --- /dev/null +++ b/pcr/openrc-net/mit-krb5kpropd.initd-r1 @@ -0,0 +1,24 @@ +#!/sbin/runscript + +#--------------------------------------------------------------------------- +# This script starts/stops the MIT Kerberos 5 kpropd +#--------------------------------------------------------------------------- + +daemon="MIT Kerberos 5 kpropd" +exec="/usr/sbin/kpropd" + +depend() { + use net mit-krb5kdc mit-krb5kadmind +} + +start() { + ebegin "Starting $daemon" + start-stop-daemon --start --quiet --exec ${exec} -- -S 1>&2 + eend $? "Error starting $daemon" +} + +stop() { + ebegin "Stopping $daemon" + start-stop-daemon --stop --quiet --exec ${exec} 1>&2 + eend $? "Error stopping $daemon" +} diff --git a/pcr/openrc-net/nfs.confd b/pcr/openrc-net/nfs.confd new file mode 100644 index 000000000..9dc14058c --- /dev/null +++ b/pcr/openrc-net/nfs.confd @@ -0,0 +1,38 @@ +# /etc/conf.d/nfs + +# If you wish to set the port numbers for lockd, +# please see /etc/sysctl.conf + +# Optional services to include in default `/etc/init.d/nfs start` +# For NFSv4 users, you'll want to add "rpc.idmapd" here. +NFS_NEEDED_SERVICES="" + +# Options to pass to rpc.nfsd +OPTS_RPC_NFSD="8" + +# Options to pass to rpc.mountd +# ex. OPTS_RPC_MOUNTD="-p 32767" +OPTS_RPC_MOUNTD="" + +# Options to pass to rpc.statd +# ex. OPTS_RPC_STATD="-p 32765 -o 32766" +OPTS_RPC_STATD="" + +# Options to pass to rpc.idmapd +OPTS_RPC_IDMAPD="" + +# Options to pass to rpc.gssd +OPTS_RPC_GSSD="" + +# Options to pass to rpc.svcgssd +OPTS_RPC_SVCGSSD="" + +# Options to pass to rpc.rquotad (requires sys-fs/quota) +OPTS_RPC_RQUOTAD="" + +# Timeout (in seconds) for exportfs +EXPORTFS_TIMEOUT=30 + +# Options to set in the nfsd filesystem (/proc/fs/nfsd/). +# Format is <option>=<value>. Multiple options are allowed. +#OPTS_NFSD="nfsv4leasetime=30 max_block_size=4096" diff --git a/pcr/openrc-net/nfs.initd b/pcr/openrc-net/nfs.initd new file mode 100644 index 000000000..e4239b70c --- /dev/null +++ b/pcr/openrc-net/nfs.initd @@ -0,0 +1,163 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/nfs.initd,v 1.28 2014/06/20 06:21:22 vapier Exp $ + +extra_started_commands="reload" + +# This variable is used for controlling whether or not to run exportfs -ua; +# see stop() for more information +restarting=no + +# The binary locations +exportfs=/usr/sbin/exportfs + mountd=/usr/sbin/rpc.mountd + nfsd=/usr/sbin/rpc.nfsd +smnotify=/usr/sbin/sm-notify + +depend() { + local myneed="" + # XXX: no way to detect NFSv4 is desired and so need rpc.idmapd + myneed="${myneed} $( + awk '!/^[[:space:]]*#/ { + # clear the path to avoid spurious matches + $1 = ""; + if ($0 ~ /[(][^)]*sec=(krb|spkm)[^)]*[)]/) { + print "rpc.svcgssd" + exit 0 + } + }' /etc/exports /etc/exports.d/*.exports 2>/dev/null + )" + config /etc/exports /etc/exports.d/*.exports + need portmap rpc.statd ${myneed} ${NFS_NEEDED_SERVICES} + use ypbind net dns rpc.rquotad rpc.idmapd rpc.svcgssd + after quota +} + +mkdir_nfsdirs() { + local d + for d in v4recovery v4root ; do + d="/var/lib/nfs/${d}" + [ ! -d "${d}" ] && mkdir -p "${d}" + done +} + +waitfor_exportfs() { + local pid=$1 + ( sleep ${EXPORTFS_TIMEOUT:-30}; kill -9 ${pid} 2>/dev/null ) & + wait $1 +} + +mount_nfsd() { + if [ -e /proc/modules ] ; then + # Make sure nfs support is loaded in the kernel #64709 + if ! grep -qs nfsd /proc/filesystems ; then + modprobe -q nfsd + fi + # Restart idmapd if needed #220747 + if grep -qs nfsd /proc/modules ; then + killall -q -HUP rpc.idmapd + fi + fi + + # This is the new "kernel 2.6 way" to handle the exports file + if grep -qs nfsd /proc/filesystems ; then + if ! mountinfo -q /proc/fs/nfsd ; then + ebegin "Mounting nfsd filesystem in /proc" + mount -t nfsd -o nodev,noexec,nosuid nfsd /proc/fs/nfsd + eend $? + fi + + local o + for o in ${OPTS_NFSD} ; do + echo "${o#*=}" > "/proc/fs/nfsd/${o%%=*}" + done + fi +} + +start_it() { + ebegin "Starting NFS $1" + shift + "$@" + eend $? + ret=$((ret + $?)) +} +start() { + mount_nfsd + mkdir_nfsdirs + + # Exportfs likes to hang if networking isn't working. + # If that's the case, then try to kill it so the + # bootup process can continue. + if grep -qs '^[[:space:]]*/' /etc/exports /etc/exports.d/*.exports ; then + ebegin "Exporting NFS directories" + ${exportfs} -r & + waitfor_exportfs $! + eend $? + fi + + local ret=0 + start_it mountd ${mountd} ${OPTS_RPC_MOUNTD} + start_it daemon ${nfsd} ${OPTS_RPC_NFSD} + [ -x "${smnotify}" ] && start_it smnotify ${smnotify} ${OPTS_SMNOTIFY} + return ${ret} +} + +stop() { + local ret=0 + + ebegin "Stopping NFS mountd" + start-stop-daemon --stop --exec ${mountd} + eend $? + ret=$((ret + $?)) + + # nfsd sets its process name to [nfsd] so don't look for $nfsd + ebegin "Stopping NFS daemon" + start-stop-daemon --stop --name nfsd --user root --signal 2 + eend $? + ret=$((ret + $?)) + # in case things don't work out ... #228127 + rpc.nfsd 0 + + # When restarting the NFS server, running "exportfs -ua" probably + # isn't what the user wants. Running it causes all entries listed + # in xtab to be removed from the kernel export tables, and the + # xtab file is cleared. This effectively shuts down all NFS + # activity, leaving all clients holding stale NFS filehandles, + # *even* when the NFS server has restarted. + # + # That's what you would want if you were shutting down the NFS + # server for good, or for a long period of time, but not when the + # NFS server will be running again in short order. In this case, + # then "exportfs -r" will reread the xtab, and all the current + # clients will be able to resume NFS activity, *without* needing + # to umount/(re)mount the filesystem. + if [ "${restarting}" = no -o "${RC_CMD}" = "restart" ] ; then + ebegin "Unexporting NFS directories" + # Exportfs likes to hang if networking isn't working. + # If that's the case, then try to kill it so the + # shutdown process can continue. + ${exportfs} -ua & + waitfor_exportfs $! + eend $? + fi + + return ${ret} +} + +reload() { + # Exportfs likes to hang if networking isn't working. + # If that's the case, then try to kill it so the + # bootup process can continue. + ebegin "Reloading /etc/exports" + ${exportfs} -r 1>&2 & + waitfor_exportfs $! + eend $? +} + +restart() { + # See long comment in stop() regarding "restarting" and exportfs -ua + restarting=yes + svc_stop + svc_start +} diff --git a/pcr/openrc-net/nfsclient.confd b/pcr/openrc-net/nfsclient.confd new file mode 100644 index 000000000..8a995571e --- /dev/null +++ b/pcr/openrc-net/nfsclient.confd @@ -0,0 +1,18 @@ +# You need to decide which nfs protocol version you want to use. +# If you are unsure, leave these alone. +# +# If you are using only nfsv4, uncomment this line: +# +#rc_need="!rpc.statd" +# +# If you are using only nfsv3, uncomment this line: +# +#rc_need="!rpc.idmapd" +# +# You will need to set the dependencies in the nfsclient script to match +# the network configuration tools you are using. This should be done in +# this file by following the examples below, and not by changing the +# service script itself. See /etc/conf.d/netmount for more examples. +# +# This is a safe default. +rc_after="net" diff --git a/pcr/openrc-net/nfsclient.initd b/pcr/openrc-net/nfsclient.initd new file mode 100644 index 000000000..72ba9a963 --- /dev/null +++ b/pcr/openrc-net/nfsclient.initd @@ -0,0 +1,34 @@ +#!/sbin/runscript +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/nfsclient.initd,v 1.5 2015/02/05 04:32:41 williamh Exp $ + +[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs + +depend() { + local opts myneed="" + if [ -e /etc/fstab ] ; then + for opts in $(fstabinfo -o -t nfs,nfs4) ; do + case $opts in + *sec=krb*|*sec=spkm*) myneed="$myneed rpc.gssd" ;; + esac + done + fi + config /etc/fstab + need portmap rpc.statd rpc.idmapd ${myneed} + use ypbind dns +} + +start() { + if [ -x /usr/sbin/sm-notify ] ; then + ebegin "Starting NFS sm-notify" + /usr/sbin/sm-notify ${OPTS_SMNOTIFY} + eend $? + fi + + # Make sure nfs support is loaded in the kernel #64709 + if [ -e /proc/modules ] && ! grep -qs 'nfs$' /proc/filesystems ; then + modprobe -q nfs + fi + return 0 +} diff --git a/pcr/openrc-net/nginx.initd-r2 b/pcr/openrc-net/nginx.initd-r2 new file mode 100644 index 000000000..903670955 --- /dev/null +++ b/pcr/openrc-net/nginx.initd-r2 @@ -0,0 +1,89 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/www-servers/nginx/files/nginx.initd-r2,v 1.1 2013/05/13 12:18:11 dev-zero Exp $ + +extra_commands="configtest" +extra_started_commands="upgrade reload" + +description="Robust, small and high performance http and reverse proxy server" +description_configtest="Run nginx' internal config check." +description_upgrade="Upgrade the nginx binary without losing connections." +description_reload="Reload the nginx configuration without losing connections." + +nginx_config=${nginx_config:-/etc/nginx/nginx.conf} + +command="/usr/sbin/nginx" +command_args="-c ${nginx_config}" +pidfile=${pidfile:-/run/nginx.pid} +user=${user:-nginx} +group=${group:-nginx} + +depend() { + need net + use dns logger netmount +} + +start_pre() { + if [ "${RC_CMD}" != "restart" ]; then + configtest || return 1 + fi +} + +stop_pre() { + if [ "${RC_CMD}" = "restart" ]; then + configtest || return 1 + fi +} + +stop_post() { + rm -f ${pidfile} +} + +reload() { + configtest || return 1 + ebegin "Refreshing nginx' configuration" + kill -HUP `cat ${pidfile}` &>/dev/null + eend $? "Failed to reload nginx" +} + +upgrade() { + configtest || return 1 + ebegin "Upgrading nginx" + + einfo "Sending USR2 to old binary" + kill -USR2 `cat ${pidfile}` &>/dev/null + + einfo "Sleeping 3 seconds before pid-files checking" + sleep 3 + + if [ ! -f ${pidfile}.oldbin ]; then + eerror "File with old pid not found" + return 1 + fi + + if [ ! -f ${pidfile} ]; then + eerror "New binary failed to start" + return 1 + fi + + einfo "Sleeping 3 seconds before WINCH" + sleep 3 ; kill -WINCH `cat ${pidfile}.oldbin` + + einfo "Sending QUIT to old binary" + kill -QUIT `cat ${pidfile}.oldbin` + + einfo "Upgrade completed" + eend $? "Upgrade failed" +} + +configtest() { + ebegin "Checking nginx' configuration" + ${command} -c ${nginx_config} -t -q + + if [ $? -ne 0 ]; then + ${command} -c ${nginx_config} -t + fi + + eend $? "failed, please correct errors above" +} diff --git a/pcr/openrc-net/openntpd.conf.d-20080406-r6 b/pcr/openrc-net/openntpd.conf.d-20080406-r6 new file mode 100644 index 000000000..ccd454596 --- /dev/null +++ b/pcr/openrc-net/openntpd.conf.d-20080406-r6 @@ -0,0 +1,7 @@ +# /etc/conf.d/ntpd: config file for openntpd's ntpd + +# See ntpd(8) man page ... some popular options: +# -s Set the time immediately at startup +# (Note: may cause up to a 15 second startup delay +# if ntp servers not reachable) +NTPD_OPTS="" diff --git a/pcr/openrc-net/openntpd.init.d-20080406-r6 b/pcr/openrc-net/openntpd.init.d-20080406-r6 new file mode 100644 index 000000000..2f452e0fd --- /dev/null +++ b/pcr/openrc-net/openntpd.init.d-20080406-r6 @@ -0,0 +1,15 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/openntpd/files/openntpd.init.d-20080406-r6,v 1.1 2013/12/02 13:32:12 ottxor Exp $ + +name="OpenNTPD" +command="/usr/sbin/ntpd" +pidfile="/run/ntpd.pid" +command_args="-p ${pidfile} ${NTPD_OPTS}" + +depend() { + need net + after ntp-client + use dns logger +} diff --git a/pcr/openrc-net/openvpn-2.1.conf b/pcr/openrc-net/openvpn-2.1.conf new file mode 100644 index 000000000..72510c34a --- /dev/null +++ b/pcr/openrc-net/openvpn-2.1.conf @@ -0,0 +1,18 @@ +# OpenVPN automatically creates an /etc/resolv.conf (or sends it to +# resolvconf) if given DNS information by the OpenVPN server. +# Set PEER_DNS="no" to stop this. +PEER_DNS="yes" + +# OpenVPN can run in many modes. Most people will want the init script +# to automatically detect the mode and try and apply a good default +# configuration and setup scripts. However, there are cases where the +# OpenVPN configuration looks like a client, but it's really a peer or +# something else. DETECT_CLIENT controls this behaviour. +DETECT_CLIENT="yes" + +# If DETECT_CLIENT is no and you have your own scripts to re-enter the openvpn +# init script (ie, it first becomes "inactive" and the script then starts the +# script again to make it "started") then you can state this below. +# In other words, unless you understand service dependencies and are a +# competent shell scripter, don't set this. +RE_ENTER="no" diff --git a/pcr/openrc-net/openvpn-2.1.init b/pcr/openrc-net/openvpn-2.1.init new file mode 100644 index 000000000..d65e6f8bd --- /dev/null +++ b/pcr/openrc-net/openvpn-2.1.init @@ -0,0 +1,133 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +VPNDIR=${VPNDIR:-/etc/openvpn} +VPN=${SVCNAME#*.} +if [ -n "${VPN}" ] && [ ${SVCNAME} != "openvpn" ]; then + VPNPID="/var/run/openvpn.${VPN}.pid" +else + VPNPID="/var/run/openvpn.pid" +fi +VPNCONF="${VPNDIR}/${VPN}.conf" + +depend() { + need localmount net + use dns + after bootmisc +} + +checkconfig() { + # Linux has good dynamic tun/tap creation + if [ $(uname -s) = "Linux" ] ; then + if [ ! -e /dev/net/tun ]; then + if ! modprobe tun ; then + eerror "TUN/TAP support is not available" \ + "in this kernel" + return 1 + fi + fi + if [ -h /dev/net/tun ] && [ -c /dev/misc/net/tun ]; then + ebegin "Detected broken /dev/net/tun symlink, fixing..." + rm -f /dev/net/tun + ln -s /dev/misc/net/tun /dev/net/tun + eend $? + fi + return 0 + fi + + # Other OS's don't, so we rely on a pre-configured interface + # per vpn instance + local ifname=$(sed -n -e 's/[[:space:]]*dev[[:space:]][[:space:]]*\([^[:space:]]*\).*/\1/p' "${VPNCONF}") + if [ -z ${ifname} ] ; then + eerror "You need to specify the interface that this openvpn" \ + "instance should use" \ + "by using the dev option in ${VPNCONF}" + return 1 + fi + + if ! ifconfig "${ifname}" >/dev/null 2>/dev/null ; then + # Try and create it + echo > /dev/"${ifname}" >/dev/null + fi + if ! ifconfig "${ifname}" >/dev/null 2>/dev/null ; then + eerror "${VPNCONF} requires interface ${ifname}" \ + "but that does not exist" + return 1 + fi +} + +start() { + # If we are re-called by the openvpn gentoo-up.sh script + # then we don't actually want to start openvpn + [ "${IN_BACKGROUND}" = "true" ] && return 0 + + ebegin "Starting ${SVCNAME}" + + checkconfig || return 1 + + local args="" reenter=${RE_ENTER:-no} + # If the config file does not specify the cd option, we do + # But if we specify it, we override the config option which we do not want + if ! grep -q "^[ ]*cd[ ].*" "${VPNCONF}" ; then + args="${args} --cd ${VPNDIR}" + fi + + # We mark the service as inactive and then start it. + # When we get an authenticated packet from the peer then we run our script + # which configures our DNS if any and marks us as up. + if [ "${DETECT_CLIENT:-yes}" = "yes" ] && \ + grep -q "^[ ]*remote[ ].*" "${VPNCONF}" ; then + reenter="yes" + args="${args} --up-delay --up-restart" + args="${args} --script-security 2" + args="${args} --up /etc/openvpn/up.sh" + args="${args} --down-pre --down /etc/openvpn/down.sh" + + # Warn about setting scripts as we override them + if grep -Eq "^[ ]*(up|down)[ ].*" "${VPNCONF}" ; then + ewarn "WARNING: You have defined your own up/down scripts" + ewarn "As you're running as a client, we now force Gentoo specific" + ewarn "scripts to be run for up and down events." + ewarn "These scripts will call /etc/openvpn/${SVCNAME}-{up,down}.sh" + ewarn "where you can put your own code." + fi + + # Warn about the inability to change ip/route/dns information when + # dropping privs + if grep -q "^[ ]*user[ ].*" "${VPNCONF}" ; then + ewarn "WARNING: You are dropping root privileges!" + ewarn "As such openvpn may not be able to change ip, routing" + ewarn "or DNS configuration." + fi + else + # So we're a server. Run as openvpn unless otherwise specified + grep -q "^[ ]*user[ ].*" "${VPNCONF}" || args="${args} --user openvpn" + grep -q "^[ ]*group[ ].*" "${VPNCONF}" || args="${args} --group openvpn" + fi + + # Ensure that our scripts get the PEER_DNS variable + [ -n "${PEER_DNS}" ] && args="${args} --setenv PEER_DNS ${PEER_DNS}" + + [ "${reenter}" = "yes" ] && mark_service_inactive "${SVCNAME}" + start-stop-daemon --start --exec /usr/sbin/openvpn --pidfile "${VPNPID}" \ + -- --config "${VPNCONF}" --writepid "${VPNPID}" --daemon \ + --setenv SVCNAME "${SVCNAME}" ${args} + eend $? "Check your logs to see why startup failed" +} + +stop() { + # If we are re-called by the openvpn gentoo-down.sh script + # then we don't actually want to stop openvpn + if [ "${IN_BACKGROUND}" = "true" ] ; then + mark_service_inactive "${SVCNAME}" + return 0 + fi + + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --quiet \ + --exec /usr/sbin/openvpn --pidfile "${VPNPID}" + eend $? +} + +# vim: set ts=4 : diff --git a/pcr/openrc-net/polipo.initd b/pcr/openrc-net/polipo.initd new file mode 100644 index 000000000..9074050c2 --- /dev/null +++ b/pcr/openrc-net/polipo.initd @@ -0,0 +1,54 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-proxy/polipo/files/Attic/polipo.initd,v 1.7 2015/01/12 16:16:12 bircoph dead $ + +depend() { + need net +} + +checkconfig() { + { polipo -v || return 1 ; } | { + local retvalue=0 + local name type value desc + while read name type value desc ; do + case ${name} in + configFile) + if [ "${value}" = "(none)" ] ; then + eerror "Unable to read configuration file /etc/polipo/config" + retvalue=1 + fi + ;; + daemonise) + if [ "${value}" != "false" ] ; then + eerror "Configuration option not supported by this init script: ${name}=${value}" + retvalue=1 + fi + ;; + pidFile) + if [ "${value}" != "(none)" ] ; then + eerror "Configuration option not supported by this init script: ${name}=${value}" + retvalue=1 + fi + ;; + esac + done + return ${retvalue} + } +} + +start() { + checkconfig || return 1 + + ebegin "Starting Polipo HTTP proxy" + start-stop-daemon --start --user polipo \ + --background --pidfile /var/run/polipo.pid --make-pidfile \ + --exec /usr/bin/polipo + eend $? +} + +stop() { + ebegin "Stopping Polipo HTTP proxy" + start-stop-daemon --stop --pidfile /var/run/polipo.pid + eend $? +} diff --git a/pcr/openrc-net/postfix.rc6.2.7 b/pcr/openrc-net/postfix.rc6.2.7 new file mode 100644 index 000000000..aecd8e71f --- /dev/null +++ b/pcr/openrc-net/postfix.rc6.2.7 @@ -0,0 +1,86 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/mail-mta/postfix/files/postfix.rc6.2.7,v 1.2 2012/03/07 10:27:37 eras Exp $ + +extra_started_commands="reload abort flush" + +description_reload="Re-read configuration files. Running processes terminate at their earliest convenience." +description_abort="Stop the Postfix mail system abruptly. Running processes are signaled to stop immediately." +description_flush="Force delivery: attempt to deliver every message in the deferred mail queue." + +# Please read http://www.postfix.org/MULTI_INSTANCE_README.html for multi instance support +CONF_DIR="/etc/postfix" +CONF_OPT="${SVCNAME##*.}" +if [ -n ${CONF_OPT} -a ${SVCNAME} != "postfix" ]; then + CONF_DIR="${CONF_DIR}.${CONF_OPT}" +fi +if [ "${CONF_DIR}" = "/etc/postfix" ]; then + CONF_PARAM="" + CONF_MESSAGE="" +else + CONF_PARAM="-c ${CONF_DIR}" + CONF_MESSAGE="(${CONF_DIR})" +fi + +depend() { + use logger dns ypbind amavisd antivirus postfix_greylist net saslauthd + if [ "${SVCNAME}" = "postfix" ]; then + provide mta + fi +} + +start() { + if [ ! -z "${CONF_PARAM}" ]; then + einfo "Please consider updating your config for postmulti support." + fi + ebegin "Starting postfix ${CONF_MESSAGE}" + if [ ! -d ${CONF_DIR} ]; then + eend 1 "${CONF_DIR} does not exist" + return 1 + fi + /usr/sbin/postfix ${CONF_PARAM} start >/dev/null 2>&1 + eend $? +} + +stop() { + ebegin "Stopping postfix ${CONF_MESSAGE}" + /usr/sbin/postfix ${CONF_PARAM} stop >/dev/null 2>&1 + eend +} + +status() { + local _retval + einfon "" + /usr/sbin/postfix ${CONF_PARAM} status + _retval=$? + if [ x${_retval} = 'x0' ]; then + mark_service_started "${SVCNAME}" + eend 0 + else + mark_service_stopped "${SVCNAME}" + eend 3 + fi +} + +reload() { + ebegin "Reloading postfix ${CONF_MESSAGE}" + /usr/sbin/postfix ${CONF_PARAM} reload >/dev/null 2>&1 + eend $? +} + +abort() { + ebegin "Aborting postfix ${CONF_MESSAGE}" + + if service_started "${SVCNAME}"; then + mark_service_stopped "${SVCNAME}" + fi + /usr/sbin/postfix ${CONF_PARAM} abort >/dev/null 2>&1 + eend $? +} + +flush() { + ebegin "Flushing postfix ${CONF_MESSAGE}" + /usr/sbin/postfix ${CONF_PARAM} flush >/dev/null 2>&1 + eend $? +} diff --git a/pcr/openrc-net/privoxy.initd b/pcr/openrc-net/privoxy.initd new file mode 100644 index 000000000..84d6186d9 --- /dev/null +++ b/pcr/openrc-net/privoxy.initd @@ -0,0 +1,29 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-proxy/privoxy/files/privoxy.initd,v 1.2 2007/11/14 05:14:56 mrness Exp $ + +CONFFILE=/etc/${SVCNAME}/config +PIDFILE=/var/run/${SVCNAME}.pid + +depend() { + need net +} + +start() { + if [ ! -f "${CONFFILE}" ]; then + eerror "Configuration file ${CONFFILE} not found!" + return 1 + fi + + ebegin "Starting privoxy" + start-stop-daemon --start --quiet --exec /usr/sbin/privoxy --pidfile "${PIDFILE}" \ + -- --pidfile "${PIDFILE}" --user privoxy.privoxy "${CONFFILE}" #2>/dev/null + eend $? +} + +stop() { + ebegin "Stopping privoxy" + start-stop-daemon --stop --quiet --pidfile "${PIDFILE}" + eend $? +} diff --git a/pcr/openrc-net/quota.confd b/pcr/openrc-net/quota.confd new file mode 100644 index 000000000..6e66c88dd --- /dev/null +++ b/pcr/openrc-net/quota.confd @@ -0,0 +1,20 @@ +# /etc/conf.d/quota: config file for /etc/init.d/quota + +# Note: if your console is hooked up to a serial terminal, +# you prob want to drop the '-v' from the OPTS vars below. + + +# Run quotacheck ? +RUN_QUOTACHECK="yes" + + +# Options for quotacheck +QUOTACHECK_OPTS="-avug" + + +# Options for quotaon +QUOTAON_OPTS="-avug" + + +# Options for quotaoff +QUOTAOFF_OPTS="-avug" diff --git a/pcr/openrc-net/quota.rc7 b/pcr/openrc-net/quota.rc7 new file mode 100644 index 000000000..23f8c1536 --- /dev/null +++ b/pcr/openrc-net/quota.rc7 @@ -0,0 +1,38 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/quota/files/quota.rc7,v 1.2 2012/12/08 19:50:27 vapier Exp $ + +extra_started_commands="check" +description_check="Running quotacheck with quota being offline" + +depend() { + need localmount + use portmap +} + +start() { + if [ "${RUN_QUOTACHECK}" = "yes" ] ; then + ebegin "Checking quotas (may take a while)" + quotacheck ${QUOTACHECK_OPTS} + eend $? + fi + + ebegin "Starting quota" + quotaon ${QUOTAON_OPTS} + eend $? +} + +stop() { + ebegin "Stopping quota" + quotaoff ${QUOTAOFF_OPTS} + eend $? +} + +check() { + ebegin "Checking quota" + quotaoff ${QUOTAOFF_OPTS} && \ + quotacheck ${QUOTACHECK_OPTS} && \ + quotaon ${QUOTAON_OPTS} + eend $? +} diff --git a/pcr/openrc-net/rpc.gssd.initd b/pcr/openrc-net/rpc.gssd.initd new file mode 100644 index 000000000..f1b8f8774 --- /dev/null +++ b/pcr/openrc-net/rpc.gssd.initd @@ -0,0 +1,24 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.gssd.initd,v 1.11 2008/10/26 09:02:47 vapier Exp $ + +[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs + +depend() { + use ypbind net + need portmap rpc.pipefs + after quota +} + +start() { + ebegin "Starting gssd" + start-stop-daemon --start --exec /usr/sbin/rpc.gssd -- ${OPTS_RPC_GSSD} + eend $? +} + +stop() { + ebegin "Stopping gssd" + start-stop-daemon --stop --exec /usr/sbin/rpc.gssd + eend $? +} diff --git a/pcr/openrc-net/rpc.idmapd.initd b/pcr/openrc-net/rpc.idmapd.initd new file mode 100644 index 000000000..52838b5da --- /dev/null +++ b/pcr/openrc-net/rpc.idmapd.initd @@ -0,0 +1,26 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.idmapd.initd,v 1.8 2009/03/14 18:43:18 vapier Exp $ + +[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs + +rpc_bin=/usr/sbin/rpc.idmapd + +depend() { + use ypbind net + need portmap rpc.pipefs + after quota +} + +start() { + ebegin "Starting idmapd" + ${rpc_bin} ${OPTS_RPC_IDMAPD} + eend $? "make sure DNOTIFY support is enabled ..." +} + +stop() { + ebegin "Stopping idmapd" + start-stop-daemon --stop --exec ${rpc_bin} + eend $? +} diff --git a/pcr/openrc-net/rpc.pipefs.initd b/pcr/openrc-net/rpc.pipefs.initd new file mode 100644 index 000000000..ebae3b915 --- /dev/null +++ b/pcr/openrc-net/rpc.pipefs.initd @@ -0,0 +1,33 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.pipefs.initd,v 1.3 2014/06/20 04:33:57 vapier Exp $ + +MNT="/var/lib/nfs/rpc_pipefs" + +mount_pipefs() { + local fstype=rpc_pipefs + + # if things are already mounted, nothing to do + mountinfo -q ${MNT} && return 0 + + # if rpc_pipefs is not available, try to load sunrpc for it #219566 + grep -qs ${fstype} /proc/filesystems || modprobe -q sunrpc + # if still not available, the `mount` will issue an error for the user + + # now just do it for kicks + mkdir -p ${MNT} + mount -t ${fstype} ${fstype} ${MNT} +} + +start() { + ebegin "Setting up RPC pipefs" + mount_pipefs + eend $? "make sure you have NFS/SUNRPC enabled in your kernel" +} + +stop() { + ebegin "Unmounting RPC pipefs" + umount ${MNT} + eend $? +} diff --git a/pcr/openrc-net/rpc.rquotad.initd b/pcr/openrc-net/rpc.rquotad.initd new file mode 100644 index 000000000..f657fc469 --- /dev/null +++ b/pcr/openrc-net/rpc.rquotad.initd @@ -0,0 +1,26 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/quota/files/rpc.rquotad.initd,v 1.1 2007/03/25 12:09:39 vapier Exp $ + +[ -e /etc/conf.d/nfs ] && source /etc/conf.d/nfs + +rpc_bin=/usr/sbin/rpc.rquotad + +depend() { + use ypbind net + need portmap + after quota +} + +start() { + ebegin "Starting rpc.rquotad" + ${rpc_bin} ${OPTS_RPC_RQUOTAD} + eend $? +} + +stop() { + ebegin "Stopping rpc.rquotad" + start-stop-daemon --stop --quiet --exec ${rpc_bin} + eend $? +} diff --git a/pcr/openrc-net/rpc.statd.initd b/pcr/openrc-net/rpc.statd.initd new file mode 100644 index 000000000..c82041a4d --- /dev/null +++ b/pcr/openrc-net/rpc.statd.initd @@ -0,0 +1,33 @@ +#!/sbin/runscript +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.statd.initd,v 1.9 2015/02/02 13:47:41 radhermit Exp $ + +[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs + +rpc_bin=/sbin/rpc.statd +rpc_pid=/var/run/rpc.statd.pid + +depend() { + use ypbind net + need portmap + after quota +} + +start() { + # Don't start rpc.statd if already started by someone else ... + # Don't try and kill it if it's already dead ... + if killall -q -0 ${rpc_bin} ; then + return 0 + fi + + ebegin "Starting NFS statd" + start-stop-daemon --start --exec ${rpc_bin} -- --no-notify ${OPTS_RPC_STATD} + eend $? +} + +stop() { + ebegin "Stopping NFS statd" + start-stop-daemon --stop --exec ${rpc_bin} --pidfile /var/run/rpc.statd.pid + eend $? +} diff --git a/pcr/openrc-net/rpc.svcgssd.initd b/pcr/openrc-net/rpc.svcgssd.initd new file mode 100644 index 000000000..74383e24d --- /dev/null +++ b/pcr/openrc-net/rpc.svcgssd.initd @@ -0,0 +1,24 @@ +#!/sbin/runscript +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-fs/nfs-utils/files/rpc.svcgssd.initd,v 1.5 2008/10/26 09:02:47 vapier Exp $ + +[ -e /etc/conf.d/nfs ] && . /etc/conf.d/nfs + +depend() { + use ypbind net + need portmap rpc.pipefs + after quota +} + +start() { + ebegin "Starting svcgssd" + start-stop-daemon --start --exec /usr/sbin/rpc.svcgssd -- ${OPTS_RPC_SVCGSSD} + eend $? +} + +stop() { + ebegin "Stopping svcgssd" + start-stop-daemon --stop --exec /usr/sbin/rpc.svcgssd + eend $? +} diff --git a/pcr/openrc-net/rpc.yppasswdd-r1 b/pcr/openrc-net/rpc.yppasswdd-r1 new file mode 100644 index 000000000..a14762516 --- /dev/null +++ b/pcr/openrc-net/rpc.yppasswdd-r1 @@ -0,0 +1,22 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-nds/ypserv/files/rpc.yppasswdd-r1,v 1.4 2004/07/24 06:26:28 eradicator Exp $ + +depend() { + need net portmap ypserv +} + +start() { + ebegin "Starting rpc.yppasswdd" + YOPTS="" + if [ -n "${YPPASSWDD_OPTS}" ]; then YOPTS="-- ${YPPASSWDD_OPTS}"; fi + start-stop-daemon --start --quiet --exec /usr/sbin/rpc.yppasswdd ${YOPTS} + eend $? +} + +stop() { + ebegin "Stopping rpc.yppasswdd" + start-stop-daemon --stop --quiet --exec /usr/sbin/rpc.yppasswdd + eend $? +} diff --git a/pcr/openrc-net/rpc.yppasswdd.confd b/pcr/openrc-net/rpc.yppasswdd.confd new file mode 100644 index 000000000..0d6673630 --- /dev/null +++ b/pcr/openrc-net/rpc.yppasswdd.confd @@ -0,0 +1,7 @@ +# -e chsh allows changing shell through ypchsh, +# -e chfn allows changing GECOS ("finger") information through ypchfn, +# -D <dir> allows specification of directory with yp/NIS sources +# if other than /etc. +#YPPASSWDD_OPTS="-e chsh -e chfn -D /var/yp/source" + + diff --git a/pcr/openrc-net/rpc.ypxfrd-2.23 b/pcr/openrc-net/rpc.ypxfrd-2.23 new file mode 100644 index 000000000..b1526aa69 --- /dev/null +++ b/pcr/openrc-net/rpc.ypxfrd-2.23 @@ -0,0 +1,22 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-nds/ypserv/files/rpc.ypxfrd-2.23,v 1.1 2011/04/21 14:18:40 jer Exp $ + +depend() { + need net portmap ypserv +} + +start() { + ebegin "Starting rpc.ypxfrd" + YOPTS="" + if [ -n "${YPXFRD_OPTS}" ]; then YOPTS="-- ${YPXFRD_OPTS}"; fi + start-stop-daemon --start --quiet --pidfile /var/run/ypxfrd.pid --exec /usr/sbin/rpc.ypxfrd ${YOPTS} + eend $? +} + +stop() { + ebegin "Stopping rpc.ypxfrd" + start-stop-daemon --stop --quiet --pidfile /var/run/ypxfrd.pid --exec /usr/sbin/rpc.ypxfrd + eend $? +} diff --git a/pcr/openrc-net/rpc.ypxfrd.confd b/pcr/openrc-net/rpc.ypxfrd.confd new file mode 100644 index 000000000..73cfc47e7 --- /dev/null +++ b/pcr/openrc-net/rpc.ypxfrd.confd @@ -0,0 +1,3 @@ +# Command line options to pass to rpc.ypxfrd +# eg: you can pass --port <number> to use a non-standard port +YPXFRD_OPTS="" diff --git a/pcr/openrc-net/rpcbind.initd b/pcr/openrc-net/rpcbind.initd new file mode 100644 index 000000000..995ca71d0 --- /dev/null +++ b/pcr/openrc-net/rpcbind.initd @@ -0,0 +1,22 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-nds/rpcbind/files/rpcbind.initd,v 1.1 2007/12/29 09:13:55 vapier Exp $ + +depend() { + use net + before inetd xinetd + provide portmap +} + +start() { + ebegin "Starting rpcbind" + start-stop-daemon --start --quiet --exec /sbin/rpcbind -- ${RPCBIND_OPTS} + eend $? +} + +stop() { + ebegin "Stopping rpcbind" + start-stop-daemon --stop --quiet --exec /sbin/rpcbind + eend $? +} diff --git a/pcr/openrc-net/rsyncd.conf.d b/pcr/openrc-net/rsyncd.conf.d new file mode 100644 index 000000000..c3d897ed2 --- /dev/null +++ b/pcr/openrc-net/rsyncd.conf.d @@ -0,0 +1,5 @@ +# /etc/conf.d/rsyncd: config file for /etc/init.d/rsyncd + +# see man pages for rsync or run `rsync --help` +# for valid cmdline options +#RSYNC_OPTS="" diff --git a/pcr/openrc-net/rsyncd.init.d-r1 b/pcr/openrc-net/rsyncd.init.d-r1 new file mode 100644 index 000000000..d2e608e49 --- /dev/null +++ b/pcr/openrc-net/rsyncd.init.d-r1 @@ -0,0 +1,12 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/rsync/files/rsyncd.init.d-r1,v 1.1 2012/03/22 22:01:21 idl0r Exp $ + +command="/usr/bin/rsync" +command_args="--daemon ${RSYNC_OPTS}" +pidfile="/var/run/${SVCNAME}.pid" + +depend() { + use net +} diff --git a/pcr/openrc-net/samba4.confd b/pcr/openrc-net/samba4.confd new file mode 100644 index 000000000..58b2c7827 --- /dev/null +++ b/pcr/openrc-net/samba4.confd @@ -0,0 +1,38 @@ +# Add "winbind" to the daemon_list if you also want winbind to start. +# Replace "smbd nmbd" by "samba4" if you want the active directory domain controller part or the ntvfs +# file server part or the rpc proxy to start. +# Note that samba4 controls 'smbd' by itself, thus it can't be started manually. You can, however, +# tweak the behaviour of a samba4-controlled smbd by modifying your '/etc/samba/smb.conf' file +# accordingly. +daemon_list="smbd nmbd" + +#---------------------------------------------------------------------------- +# Daemons calls: <daemon_name>_<command_option> +#---------------------------------------------------------------------------- +my_service_name="samba" +my_service_PRE="unset TMP TMPDIR" +my_service_POST="" + +#---------------------------------------------------------------------------- +# Daemons calls: <daemon_name>_<command_option> +#---------------------------------------------------------------------------- +smbd_start_options="-D" +smbd_start="start-stop-daemon --start --exec /usr/sbin/smbd -- ${smbd_start_options}" +smbd_stop="start-stop-daemon --stop --exec /usr/sbin/smbd" +smbd_reload="killall -HUP smbd" + +nmbd_start_options="-D" +nmbd_start="start-stop-daemon --start --exec /usr/sbin/nmbd -- ${nmbd_start_options}" +nmbd_stop="start-stop-daemon --stop --exec /usr/sbin/nmbd" +nmbd_reload="killall -HUP nmbd" + +samba4_start_options="" +samba4_start="start-stop-daemon --start --exec /usr/sbin/samba -- ${samba4_start_options}" +samba4_stop="start-stop-daemon --stop --exec /usr/sbin/samba" +samba4_reload="killall -HUP samba" + +winbind_start_options="" +winbind_start="start-stop-daemon --start --exec /usr/sbin/winbindd -- ${winbind_start_options}" +winbind_stop="start-stop-daemon --stop --exec /usr/sbin/winbindd" +winbind_reload="killall -HUP winbindd" + diff --git a/pcr/openrc-net/samba4.initd-r1 b/pcr/openrc-net/samba4.initd-r1 new file mode 100644 index 000000000..6401dfbe0 --- /dev/null +++ b/pcr/openrc-net/samba4.initd-r1 @@ -0,0 +1,56 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 or later +# $Header: /var/cvsroot/gentoo-x86/net-fs/samba/files/4.1/samba4.initd-r1,v 1.3 2014/03/13 15:35:07 polynomial-c Exp $ + +extra_started_commands="reload" +piddir="/var/run/samba" + +depend() { + after slapd + need net + use cupsd +} + +DAEMONNAME="${SVCNAME##samba.}" +[ "${DAEMONNAME}" != "samba" ] && daemon_list=${DAEMONNAME} + +signal_do() { + local signal="$1" + [ -z "${signal}" ] && return 0 + + local result=0 last_result=0 daemon= cmd_exec= + for daemon in ${daemon_list} ; do + eval cmd_exec=\$${daemon}_${signal} + if [ -n "${cmd_exec}" ]; then + ebegin "${my_service_name} -> ${signal}: ${daemon}" + #echo ${cmd} '->' ${!cmd} + ${cmd_exec} > /dev/null + last_result=$? + eend ${last_result} + fi + result=$(( ${result} + ${last_result} )) + done + return ${result} +} + +start() { + ${my_service_PRE} + [ -d "${piddir}" ] || mkdir -p "${piddir}" + signal_do start && return 0 + + eerror "Error: starting services (see system logs)" + signal_do stop + return 1 +} +stop() { + ${my_service_PRE} + if signal_do stop ; then + ${my_service_POST} + return 0 + fi +} +reload() { + ${my_service_PRE} + signal_do reload +} diff --git a/pcr/openrc-net/slapd-confd-2.4.28-r1 b/pcr/openrc-net/slapd-confd-2.4.28-r1 new file mode 100644 index 000000000..ef19899a3 --- /dev/null +++ b/pcr/openrc-net/slapd-confd-2.4.28-r1 @@ -0,0 +1,26 @@ +# conf.d file for openldap +# +# To enable both the standard unciphered server and the ssl encrypted +# one uncomment this line or set any other server starting options +# you may desire. + +# If you have multiple slapd instances per #376699, this will provide a default config +INSTANCE="openldap${SVCNAME#slapd}" + +# If you use the classical configuration file: +OPTS_CONF="-f /etc/${INSTANCE}/slapd.conf" +# Uncomment this instead to use the new slapd.d configuration directory for openldap 2.3 +#OPTS_CONF="-F /etc/${INSTANCE}/slapd.d" +# (the OPTS_CONF variable is also passed to slaptest during startup) + +OPTS="${OPTS_CONF} -h 'ldaps:// ldap:// ldapi://%2fvar%2frun%2fopenldap%2fslapd.sock'" +# Optional connectionless LDAP: +#OPTS="${OPTS_CONF} -h 'ldaps:// ldap:// ldapi://%2fvar%2frun%2fopenldap%2fslapd.sock cldap://'" + +# If you change the above listen statement to bind on a specific IP for +# listening, you should ensure that interface is up here (change eth0 as +# needed). +#rc_need="net.eth0" + +# Specify the kerberos keytab file +#KRB5_KTNAME=/etc/openldap/krb5-ldap.keytab diff --git a/pcr/openrc-net/slapd-initd-2.4.28-r1 b/pcr/openrc-net/slapd-initd-2.4.28-r1 new file mode 100644 index 000000000..48946d6ef --- /dev/null +++ b/pcr/openrc-net/slapd-initd-2.4.28-r1 @@ -0,0 +1,36 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-nds/openldap/files/slapd-initd-2.4.28-r1,v 1.4 2012/05/27 07:22:43 robbat2 Exp $ + +extra_commands="checkconfig" + +[ -z "$INSTANCE" ] && INSTANCE="openldap${SVCNAME#slapd}" + +depend() { + need net + before dbus hald avahi-daemon + provide ldap +} + +start() { + checkpath -q -d /var/run/openldap/ -o ldap:ldap + if ! checkconfig -Q ; then + eerror "There is a problem with your slapd.conf!" + return 1 + fi + ebegin "Starting ldap-server" + [ -n "$KRB5_KTNAME" ] && export KRB5_KTNAME + eval start-stop-daemon --start --pidfile /var/run/openldap/${SVCNAME}.pid --exec /usr/lib/openldap/slapd -- -u ldap -g ldap "${OPTS}" + eend $? +} + +stop() { + ebegin "Stopping ldap-server" + start-stop-daemon --stop --signal 2 --quiet --pidfile /var/run/openldap/${SVCNAME}.pid + eend $? +} + +checkconfig() { + /usr/sbin/slaptest -u "$@" ${OPTS_CONF} +} diff --git a/pcr/openrc-net/slpd-init b/pcr/openrc-net/slpd-init new file mode 100644 index 000000000..bbc0eac1a --- /dev/null +++ b/pcr/openrc-net/slpd-init @@ -0,0 +1,89 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-libs/openslp/files/slpd-init,v 1.5 2012/02/09 08:19:35 robbat2 Exp $ + +depend() { + need net +} + +# +# Does nothing if a route exists that supports multicast traffic. +# If no routes supporting multicast traffic exists, the function +# tries to add one. A 0 is returned on success and a 1 on failure. +# One parameter must be passed in. This variable determins verbosity. +# If parameter is non-zero debugging will appear. +# +multicast_route_set() { + PING_OPTIONS_1='-c1 -w1' + PING_OPTIONS_2='-c1 -i1' + MULTICAST_ADDRESS='239.255.255.253' + TMP_FILE=/tmp/route.check + PING_ERROR_NO_ROUTE='unreachable' + + MSG_FAILED_TO_FIND='Failed to Detect Multicast Route' + MSG_SUCCESS_ON_FIND='Multicast Route Enabled' + MSG_ADDING_ROUTE='Attempting to Add Multicast Route ...' + MSG_FAILED_TO_ADD=' FAILED - Route NOT Added.' + MSG_SUCCES_ON_ADD=' SUCCESS - Route Added.' + + CMD_GET_INTERFACE="netstat -i | awk 'BEGIN{}(NR>2)&&(!/^lo*/){print \$1;exit}'" + CMD_ADD_ROUTE="route add -net 224.0.0.0 netmask 240.0.0.0" + + ping $PING_OPTIONS_1 $MULTICAST_ADDRESS 2> $TMP_FILE 1> /dev/null + if [ $? = 2 ]; then + ping $PING_OPTIONS_2 $MULTICAST_ADDRESS 2> $TMP_FILE 1> /dev/null + fi + + grep $PING_ERROR_NO_ROUTE $TMP_FILE > /dev/null 2>&1 + err_unreachable_found=$? + + #If errors, add route. Otherwise, do nothing + if [ -s $TMP_FILE ] && [ $err_unreachable_found = 0 ]; then + + if [ $1 != 0 ]; then + echo $MSG_FAILED_TO_FIND + echo $MSG_ADDING_ROUTE + fi + + $CMD_ADD_ROUTE `eval $CMD_GET_INTERFACE` > /dev/null 2>&1 + retval=$? + if [ $1 != 0 ]; then + + if [ $retval = 0 ]; then + echo $MSG_SUCCES_ON_ADD + else + echo $MSG_FAILED_TO_ADD + fi + fi + else + if [ $1 != 0 ]; then + echo -n $MSG_SUCCESS_ON_FIND + fi + retval=0 + fi + + rm -f $TMP_FILE # Clean up + return $retval +} + +checkconfig() { + multicast_route_set 0 + if [ $? -ne 0 ]; then + eerror "No route available for multicast traffic!" + return 1 + fi +} + +start() { + checkconfig || return 1 + ebegin "Starting slpd" + start-stop-daemon --start --quiet --exec /usr/sbin/slpd --pidfile /var/run/slpd.pid + eend $? +} + +stop() { + ebegin "Stopping slpd" + start-stop-daemon --stop --quiet --pidfile /var/run/slpd.pid + eend $? +} diff --git a/pcr/openrc-net/squid.confd-r1 b/pcr/openrc-net/squid.confd-r1 new file mode 100644 index 000000000..f17bfe06f --- /dev/null +++ b/pcr/openrc-net/squid.confd-r1 @@ -0,0 +1,13 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/files/squid.confd-r1,v 1.1 2013/01/11 15:25:49 eras Exp $ + +# Config file for /etc/init.d/squid + +SQUID_OPTS="-YC" + +# Kerberos keytab file to use. This is required if you enable kerberos authentication. +SQUID_KEYTAB="" + +# Use max_filedescriptors setting in squid.conf to determine the maximum number +# of filedescriptors squid can open. diff --git a/pcr/openrc-net/squid.initd-r4 b/pcr/openrc-net/squid.initd-r4 new file mode 100644 index 000000000..0b5741955 --- /dev/null +++ b/pcr/openrc-net/squid.initd-r4 @@ -0,0 +1,118 @@ +#!/sbin/runscript +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-proxy/squid/files/squid.initd-r4,v 1.1 2014/01/18 22:16:27 eras Exp $ + +extra_started_commands="reload rotate" + +depend() { + use dns net +} + +checkconfig() { + if [ ! -f /etc/squid/${SVCNAME}.conf ]; then + eerror "You need to create /etc/squid/${SVCNAME}.conf first." + eerror "An example can be found in /etc/squid/squid.conf.default" + return 1 + fi + + local PIDFILE=$(awk '/^[ \t]*pid_filename[ \t]+/ { print $2 }' < /etc/squid/${SVCNAME}.conf) + [ -z ${PIDFILE} ] && PIDFILE=/run/squid.pid + if [ /run/${SVCNAME}.pid != ${PIDFILE} ]; then + eerror "/etc/squid/${SVCNAME}.conf must set pid_filename to" + eerror " /run/${SVCNAME}.pid" + eerror "CAUTION: http_port, cache_dir and *_log parameters must be different than" + eerror " in any other instance of squid." + return 1 + fi + + # Maximum file descriptors squid can open is determined by: + # a basic default of N=1024 + # ... altered by ./configure --with-filedescriptors=N + # ... overridden on production by squid.conf max_filedescriptors (if, + # and only if, setrlimit() RLIMIT_NOFILE is able to be built+used). + # Since we do not configure hard coded # of filedescriptors anymore, + # there is no need for ulimit calls in the init script. + # Use max_filedescriptors in squid.conf instead. + + local CACHE_SWAP=$(awk '/^[ \t]*cache_dir[ \t]+/ { if ( $2 == "rock" ) printf "%s/rock ", $3; else if ( $2 == "coss" ) printf "%s/stripe ", $3; else printf "%s/00 ", $3; }' < /etc/squid/${SVCNAME}.conf) + [ -z "$CACHE_SWAP" ] && CACHE_SWAP="/var/cache/squid/00" + + local x + for x in $CACHE_SWAP ; do + if [ ! -e $x ] ; then + ebegin "Initializing cache directory ${x%/*}" + local ORIG_UMASK=$(umask) + umask 027 + + if ! (mkdir -p ${x%/*} && chown squid ${x%/*}) ; then + eend 1 + return 1 + fi + + local INIT_CACHE_RESPONSE="$(/usr/sbin/squid -z -N -f /etc/squid/${SVCNAME}.conf 2>&1)" + if [ $? != 0 ] || echo "$INIT_CACHE_RESPONSE" | grep -q "erminated abnormally" ; then + umask $ORIG_UMASK + eend 1 + echo "$INIT_CACHE_RESPONSE" + return 1 + fi + + umask $ORIG_UMASK + eend 0 + break + fi + done + + return 0 +} + +start() { + checkconfig || return 1 + checkpath -d -q -m 0750 -o squid:squid /run/${SVCNAME} + + ebegin "Starting ${SVCNAME}" + KRB5_KTNAME="${SQUID_KEYTAB}" /usr/sbin/squid ${SQUID_OPTS} -f /etc/squid/${SVCNAME}.conf + eend $? && sleep 1 +} + +stop() { + ebegin "Stopping ${SVCNAME}" + if /usr/sbin/squid -k shutdown -f /etc/squid/${SVCNAME}.conf ; then + # Now we have to wait until squid has _really_ stopped. + sleep 1 + if [ -f /run/${SVCNAME}.pid ] ; then + einfon "Waiting for squid to shutdown ." + cnt=0 + while [ -f /run/${SVCNAME}.pid ] ; do + cnt=$(expr $cnt + 1) + if [ $cnt -gt 60 ] ; then + # Waited 120 seconds now. Fail. + echo + eend 1 "Failed." + break + fi + sleep 2 + echo -n "." + done + echo + fi + else + eerror "Squid shutdown failed, probably service is already down." + fi + eend 0 +} + +reload() { + checkconfig || return 1 + ebegin "Reloading ${SVCNAME}" + /usr/sbin/squid -k reconfigure -f /etc/squid/${SVCNAME}.conf + eend $? +} + +rotate() { + service_started ${SVCNAME} || return 1 + ebegin "Rotating ${SVCNAME} logs" + /usr/sbin/squid -k rotate -f /etc/squid/${SVCNAME}.conf + eend $? +} diff --git a/pcr/openrc-net/sshd.confd b/pcr/openrc-net/sshd.confd new file mode 100644 index 000000000..28952b4a2 --- /dev/null +++ b/pcr/openrc-net/sshd.confd @@ -0,0 +1,21 @@ +# /etc/conf.d/sshd: config file for /etc/init.d/sshd + +# Where is your sshd_config file stored? + +SSHD_CONFDIR="/etc/ssh" + + +# Any random options you want to pass to sshd. +# See the sshd(8) manpage for more info. + +SSHD_OPTS="" + + +# Pid file to use (needs to be absolute path). + +#SSHD_PIDFILE="/var/run/sshd.pid" + + +# Path to the sshd binary (needs to be absolute path). + +#SSHD_BINARY="/usr/sbin/sshd" diff --git a/pcr/openrc-net/sshd.rc6.4 b/pcr/openrc-net/sshd.rc6.4 new file mode 100644 index 000000000..1b872bc87 --- /dev/null +++ b/pcr/openrc-net/sshd.rc6.4 @@ -0,0 +1,87 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/openssh/files/sshd.rc6.4,v 1.3 2013/04/24 03:13:03 vapier Exp $ + +extra_commands="checkconfig" +extra_started_commands="reload" + +SSHD_CONFDIR=${SSHD_CONFDIR:-/etc/ssh} +SSHD_CONFIG=${SSHD_CONFIG:-${SSHD_CONFDIR}/sshd_config} +SSHD_PIDFILE=${SSHD_PIDFILE:-/var/run/${SVCNAME}.pid} +SSHD_BINARY=${SSHD_BINARY:-/usr/sbin/sshd} + +depend() { + use logger dns + if [ "${rc_need+set}" = "set" ]; then + : # Do nothing, the user has explicitly set rc_need + else + warn_addr='' + for x in $(awk '/^ListenAddress/{ print $2 }' "$SSHD_CONFIG" 2>/dev/null) ; do + case "$x" in + 0.0.0.0|0.0.0.0:*) ;; + ::|\[::\]*) ;; + *) warn_addr="${warn_addr} $x" ;; + esac + done + unset x + if [ "${warn_addr:+set}" = "set" ]; then + need net + ewarn "You are binding an interface in ListenAddress statement in your sshd_config!" + ewarn "You must add rc_need=\"net.FOO\" to your /etc/conf.d/sshd" + ewarn "where FOO is the interface(s) providing the following address(es):" + ewarn "${warn_addr}" + fi + unset warn_addr + fi +} + +checkconfig() { + if [ ! -d /var/empty ] ; then + mkdir -p /var/empty || return 1 + fi + + if [ ! -e "${SSHD_CONFDIR}"/sshd_config ] ; then + eerror "You need an ${SSHD_CONFDIR}/sshd_config file to run sshd" + eerror "There is a sample file in /usr/share/doc/openssh" + return 1 + fi + + ssh-keygen -A || return 1 + + [ "${SSHD_PIDFILE}" != "/var/run/sshd.pid" ] \ + && SSHD_OPTS="${SSHD_OPTS} -o PidFile=${SSHD_PIDFILE}" + [ "${SSHD_CONFDIR}" != "/etc/ssh" ] \ + && SSHD_OPTS="${SSHD_OPTS} -f ${SSHD_CONFDIR}/sshd_config" + + "${SSHD_BINARY}" -t ${SSHD_OPTS} || return 1 +} + +start() { + checkconfig || return 1 + + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --exec "${SSHD_BINARY}" \ + --pidfile "${SSHD_PIDFILE}" \ + -- ${SSHD_OPTS} + eend $? +} + +stop() { + if [ "${RC_CMD}" = "restart" ] ; then + checkconfig || return 1 + fi + + ebegin "Stopping ${SVCNAME}" + start-stop-daemon --stop --exec "${SSHD_BINARY}" \ + --pidfile "${SSHD_PIDFILE}" --quiet + eend $? +} + +reload() { + checkconfig || return 1 + ebegin "Reloading ${SVCNAME}" + start-stop-daemon --signal HUP \ + --exec "${SSHD_BINARY}" --pidfile "${SSHD_PIDFILE}" + eend $? +} diff --git a/pcr/openrc-net/tor.confd b/pcr/openrc-net/tor.confd new file mode 100644 index 000000000..4195bf323 --- /dev/null +++ b/pcr/openrc-net/tor.confd @@ -0,0 +1,3 @@ +# +# Set the file limit +rc_ulimit="-n 30000" diff --git a/pcr/openrc-net/tor.initd-r6 b/pcr/openrc-net/tor.initd-r6 new file mode 100644 index 000000000..c31eac12f --- /dev/null +++ b/pcr/openrc-net/tor.initd-r6 @@ -0,0 +1,60 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-misc/tor/files/Attic/tor.initd-r6,v 1.7 2015/03/20 12:46:13 blueness dead $ + +extra_commands="checkconfig" +extra_started_commands="reload" + +PIDFILE=/var/run/tor/tor.pid +CONFFILE=/etc/tor/torrc + +depend() { + need net +} + +checkconfig() { + # first check that it exists + if [ ! -f ${CONFFILE} ] ; then + eerror "You need to setup ${CONFFILE} first" + eerror "Example is in ${CONFFILE}.sample" + return 1 + fi + + # now verify whether the configuration is valid + /usr/bin/tor --verify-config -f ${CONFFILE} > /dev/null 2>&1 + if [ $? -eq 0 ] ; then + einfo "Tor configuration (${CONFFILE}) is valid." + return 0 + else + eerror "Tor configuration (${CONFFILE}) not valid." + /usr/bin/tor --verify-config -f ${CONFFILE} + return 1 + fi +} + +start() { + checkconfig || return 1 + checkpath -d -m 0755 -o tor:tor /var/run/tor + ebegin "Starting Tor" + HOME=/var/lib/tor + start-stop-daemon --start --pidfile "${PIDFILE}" --quiet --exec /usr/bin/tor -- -f "${CONFFILE}" --runasdaemon 1 --PidFile "${PIDFILE}" > /dev/null 2>&1 + eend $? +} + +stop() { + ebegin "Stopping Tor" + start-stop-daemon --stop --pidfile "${PIDFILE}" --exec /usr/bin/tor -- --PidFile "${PIDFILE}" + eend $? +} + +reload() { + if [ ! -f ${PIDFILE} ]; then + eerror "${SVCNAME} isn't running" + return 1 + fi + checkconfig || return 1 + ebegin "Reloading Tor configuration" + start-stop-daemon --signal HUP --pidfile ${PIDFILE} + eend $? +} diff --git a/pcr/openrc-net/transmission-daemon.confd.4 b/pcr/openrc-net/transmission-daemon.confd.4 new file mode 100644 index 000000000..8f3b1317a --- /dev/null +++ b/pcr/openrc-net/transmission-daemon.confd.4 @@ -0,0 +1,14 @@ +# This is the transmission-daemon configuration file. For other options and +# better explanation, take a look at transmission-daemon manual page Note: it's +# better to configure some settings (like username/password) in +# /var/lib/transmission/config/settings.json to avoid other users see it with `ps` + +TRANSMISSION_OPTIONS="--encryption-preferred" + +# Run daemon as another user (username or username:groupname) +# If you change this setting, chown -R /var/lib/transmission/config <and download directory, check web settings> +#runas_user=transmission + +# Location of logfile (should be writeable for runas_user user) +# Set logfile=syslog to use syslog for logging +#logfile=/var/log/transmission/transmission.log diff --git a/pcr/openrc-net/transmission-daemon.initd.9 b/pcr/openrc-net/transmission-daemon.initd.9 new file mode 100644 index 000000000..3c4914c58 --- /dev/null +++ b/pcr/openrc-net/transmission-daemon.initd.9 @@ -0,0 +1,73 @@ +#!/sbin/runscript +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-p2p/transmission/files/transmission-daemon.initd.9,v 1.1 2013/09/07 12:10:01 ssuominen Exp $ + +extra_started_commands="reload" +description="Transmission is a fast, easy and free bittorrent client" +description_start="Start transmission-daemon server and web interface" +description_stop="Stop transmission-daemon server and web interface" +description_reload="Reload transmission-daemon settings" + +rundir=${rundir:-/var/run/transmission} +pidfile=${pidfile:-${rundir}/transmission.pid} +config_dir=${config_dir:-/var/lib/transmission/config} +download_dir=${download_dir:-/var/lib/transmission/downloads} +logfile=${logfile:-/var/log/transmission/transmission.log} +runas_user=${runas_user:-transmission:transmission} + +SSD_OPTIONS="" + +depend() { + need net +} + +check_config() { + if [ ! -d "${rundir}" ]; then + mkdir "${rundir}" + if [ -n "${runas_user}" ]; then + chown -R ${runas_user} "${rundir}" + fi + fi + + # In case no config directory option passed use default + if ! $(echo ${TRANSMISSION_OPTIONS} | grep -q -e '\B-g' -e '\B--config-dir'); then + TRANSMISSION_OPTIONS="${TRANSMISSION_OPTIONS} --config-dir ${config_dir}" + # put download dir location on first run (and take it from config later) + if [ ! -f ${config_dir}/settings.json ]; then + TRANSMISSION_OPTIONS="${TRANSMISSION_OPTIONS} --download-dir ${download_dir}" + fi + fi + + if [ -n "${runas_user}" ]; then + if [ -f /etc/init.d/sysfs ]; then + SSD_OPTIONS="${SSD_OPTIONS} --user ${runas_user}" + else + SSD_OPTIONS="${SSD_OPTIONS} --chuid ${runas_user}" + fi + fi +} + +start() { + check_config + + ebegin "Starting transmission daemon" + start-stop-daemon --start --quiet --pidfile ${pidfile} ${SSD_OPTIONS} \ + --exec /usr/bin/transmission-daemon -- --pid-file ${pidfile} \ + $(test ${logfile} != "syslog" && echo --logfile ${logfile}) \ + ${TRANSMISSION_OPTIONS} + eend $? +} + +stop() { + ebegin "Stopping transmission daemon" + start-stop-daemon --stop --quiet --retry TERM/45/QUIT/15 --pidfile ${pidfile} + eend $? +} + +reload() { + ebegin "Reloading transmission configuration" + start-stop-daemon --signal HUP --pidfile ${pidfile} + eend $? +} + diff --git a/pcr/openrc-net/ufw-2.initd b/pcr/openrc-net/ufw-2.initd new file mode 100644 index 000000000..1ffd1c596 --- /dev/null +++ b/pcr/openrc-net/ufw-2.initd @@ -0,0 +1,137 @@ +#!/sbin/runscript +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-firewall/ufw/files/ufw-2.initd,v 1.2 2012/06/13 21:14:52 thev00d00 Exp $ + +depend() { + before net + provide firewall +} + +start() { + ebegin "Starting ufw" + _source_file || { eend $?; return $?; } + + local enabled_in_cfg ret + _check_if_enabled_in_cfg + enabled_in_cfg=$? + + # Avoid "Firewall already started, use 'force-reload'" message that + # appears if `ufw enable' had been run before start(). + if _status_quiet; then + eend 0 + return + fi + + # The ufw_start function does the same: if ufw is disabled using `ufw disable', + # ufw_start would not start ufw and return 0, so let's handle this case. + case $enabled_in_cfg in + 0) + ufw_start + ret=$? + eend $ret "Failed to start ufw." + ;; + 1) + # see /etc/conf.d/<name> + if [ "${ufw_nonfatal_if_disabled:-no}" != "yes" ]; then + ret=1 + eend $ret "Not starting firewall (not enabled), use \"ufw enable\" first." + else + ret=0 + eend 0 + fi + ;; + 2) + ret=1 + eend $ret "Failed to start ufw." + ;; + esac + + return $ret +} + +stop() { + ebegin "Stopping ufw" + _source_file || { eend $?; return $?; } + local enabled_in_cfg ret + _check_if_enabled_in_cfg + enabled_in_cfg=$? + + # Same as above (unless --force is passed to ufw_stop). + case $enabled_in_cfg in + 0) + ufw_stop + ret=$? + ;; + 1) + einfo "INFO: ufw is configured to be disabled" + ufw_stop --force + ret=$? + ;; + 2) + ret=1 + ;; + esac + + eend $ret "Failed to stop ufw." + return $ret +} + +_status_quiet() { + # return values: 0 - started, 1 - stopped, 2 - error + # Does not execute _source_file. + local ret + ufw_status > /dev/null + ret=$? + # Return values for ufw_status come from /usr/share/ufw/ufw-init-functions. + case $ret in + 0) return 0 ;; + 3) return 1 ;; + *) return 2 ;; + esac +} + +_source_file() { + local sourced_f="/usr/share/ufw/ufw-init-functions" + if [ ! -f "$sourced_f" ]; then + eerror "Cannot find file $sourced_f!" + return 1 + fi + + local _path=$PATH + if ! . "$sourced_f"; then + # PATH can be broken here, fix it... + PATH=$_path + eerror "Error sourcing file $sourced_f" + return 1 + fi + + if [ -z "$PATH" ]; then + PATH=$_path + else + PATH="${PATH}:${_path}" + fi + return 0 +} + +_check_if_enabled_in_cfg() { + # Check if user has enabled the firewall with "ufw enable". + # Return 0 if firewall enabled in configuration file, 1 otherwise, 2 on error. + + local sourced_f="/etc/ufw/ufw.conf" + if [ ! -f "$sourced_f" ]; then + eerror "Cannot find file $sourced_f!" + return 2 + fi + + if ! . "$sourced_f"; then + eerror "Error sourcing file $sourced_f" + return 2 + fi + + if [ "$ENABLED" = "yes" ] || [ "$ENABLED" = "YES" ]; then + return 0 + else + return 1 + fi +} diff --git a/pcr/openrc-net/ufw.confd b/pcr/openrc-net/ufw.confd new file mode 100644 index 000000000..900d3bf67 --- /dev/null +++ b/pcr/openrc-net/ufw.confd @@ -0,0 +1,5 @@ +# If equals to "yes", warnings that firewall is disabled +# (using `ufw disable') will be suppressed and the service +# will be considered started. +# Default if unset or another value is "no". +ufw_nonfatal_if_disabled=no diff --git a/pcr/openrc-net/vsftpd-checkconfig.sh b/pcr/openrc-net/vsftpd-checkconfig.sh new file mode 100644 index 000000000..e1d1e5231 --- /dev/null +++ b/pcr/openrc-net/vsftpd-checkconfig.sh @@ -0,0 +1,29 @@ +#!/bin/sh + +VSFTPD_CONF="${VSFTPD_CONF:-/etc/vsftpd/vsftpd.conf}" + +if [ ! -e ${VSFTPD_CONF} ] ; then + echo "Please setup ${VSFTPD_CONF} before starting vsftpd" >&2 + echo "There are sample configurations in /usr/share/doc/vsftpd" >&2 + exit 1 +fi + +if egrep -iq "^ *background *= *yes" "${VSFTPD_CONF}" ; then + echo "${VSFTPD_CONF} must not set background=YES" >&2 + exit 1 +fi + +has_ip=false has_ipv6=false ip_error=true +egrep -iq "^ *listen *= *yes" "${VSFTPD_CONF}" && has_ip=true +egrep -iq "^ *listen_ipv6 *= *yes" "${VSFTPD_CONF}" && has_ipv6=true +if ${has_ip} && ! ${has_ipv6} ; then + ip_error=false +elif ! ${has_ip} && ${has_ipv6} ; then + ip_error=false +fi +if ${ip_error} ; then + echo "${VSFTPD_CONF} must contain listen=YES or listen_ipv6=YES" >&2 + echo "but not both" >&2 + exit 1 +fi + diff --git a/pcr/openrc-net/vsftpd.init b/pcr/openrc-net/vsftpd.init new file mode 100644 index 000000000..e1c26c7d8 --- /dev/null +++ b/pcr/openrc-net/vsftpd.init @@ -0,0 +1,51 @@ +#!/sbin/runscript +# Copyright 1999-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License, v2 +# $Header: /var/cvsroot/gentoo-x86/net-ftp/vsftpd/files/vsftpd.init,v 1.9 2015/01/31 13:07:47 hwoarang Exp $ + +VSFTPD_NAME=${SVCNAME##*.} +if [ -n "${VSFTPD_NAME}" -a "${SVCNAME}" != "vsftpd" ]; then + VSFTPD_PID="/var/run/vsftpd.${VSFTPD_NAME}.pid" + VSFTPD_CONF_DEFAULT="/etc/vsftpd/${VSFTPD_NAME}.conf" +else + VSFTPD_PID="/var/run/vsftpd.pid" + VSFTPD_CONF_DEFAULT="/etc/vsftpd/vsftpd.conf" +fi +VSFTPD_CONF=${VSFTPD_CONF:-${VSFTPD_CONF_DEFAULT}} +VSFTPD_EXEC=${VSFTPD_EXEC:-/usr/sbin/vsftpd} + +depend() { + need net + use dns logger +} + +checkconfig() { + VSFTPD_CONF="${VSFTPD_CONF}" \ + /usr/libexec/vsftpd-checkconfig.sh || return 1 +} + +start() { + checkconfig || return 1 + ebegin "Starting ${SVCNAME}" + start-stop-daemon --start --exec ${VSFTPD_EXEC} \ + --background --make-pidfile --pidfile "${VSFTPD_PID}" \ + -- "${VSFTPD_CONF}" + eend $? +} + +stop() { + ebegin "Stopping ${SVCNAME}" + local retval=0 + if [ -f ${VSFTPD_PID} ]; then + start-stop-daemon --stop --pidfile ${VSFTPD_PID} || retval=1 + pkill --full ${VSFTPD_CONF} + else + ewarn "Couldn't find ${VSFTPD_PID} trying to stop using the config filename ${VSFTPD_CONF}" + pgrep --full ${VSFTPD_CONF} > ${VSFTPD_PID} + start-stop-daemon --stop --pidfile ${VSFTPD_PID} || retval=1 + pkill --full ${VSFTPD_CONF} + fi + eend ${retval} +} + +# vim: ts=4 diff --git a/pcr/openrc-net/xinetd.confd b/pcr/openrc-net/xinetd.confd new file mode 100644 index 000000000..ae211f3d8 --- /dev/null +++ b/pcr/openrc-net/xinetd.confd @@ -0,0 +1,3 @@ +# /etc/conf.d/xinetd: config file for /etc/init.d/xinetd + +XINETD_OPTS="-stayalive -reuse" diff --git a/pcr/openrc-net/xinetd.rc6 b/pcr/openrc-net/xinetd.rc6 new file mode 100644 index 000000000..2f90775c0 --- /dev/null +++ b/pcr/openrc-net/xinetd.rc6 @@ -0,0 +1,33 @@ +#!/sbin/runscript +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-apps/xinetd/files/xinetd.rc6,v 1.24 2011/10/11 01:26:08 vapier Exp $ + +extra_started_commands="reload dump check" + +depend() { + use net +} + +start() { + ebegin "Starting xinetd" + start-stop-daemon --start --exec /usr/sbin/xinetd -- \ + -pidfile /var/run/xinetd.pid ${XINETD_OPTS} + eend $? +} + +stop() { + ebegin "Stopping xinetd" + start-stop-daemon --stop --quiet --pidfile /var/run/xinetd.pid + eend $? +} + +do_sig() { + local sig=$1 ; shift + ebegin "$*" + start-stop-daemon --signal ${sig} --pidfile /var/run/xinetd.pid + eend $? +} +reload() { do_sig HUP "Reloading configuration" ; } +dump() { do_sig USR1 "Dumping configuration" ; } +check() { do_sig IOT "Performing Consistency Check" ; } diff --git a/pcr/openrc-net/ypbind.confd-r1 b/pcr/openrc-net/ypbind.confd-r1 new file mode 100644 index 000000000..91cdc60c1 --- /dev/null +++ b/pcr/openrc-net/ypbind.confd-r1 @@ -0,0 +1,4 @@ +# Config file for /etc/init.d/ypbind + +# Set any command line options you want to pass to ypbind. +YPBIND_OPTS="" diff --git a/pcr/openrc-net/ypbind.initd b/pcr/openrc-net/ypbind.initd new file mode 100644 index 000000000..f227a4172 --- /dev/null +++ b/pcr/openrc-net/ypbind.initd @@ -0,0 +1,41 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-nds/ypbind/files/ypbind.initd,v 1.6 2009/02/24 17:25:01 drizzt Exp $ + +depend() { + need net portmap + use ypserv domainname +} + +start() { + ebegin "Starting ypbind" + if [ -n "${YPBIND_OPTS}" ]; then + YOPTS="-- ${YPBIND_OPTS}" + fi + start-stop-daemon --start --quiet --exec /usr/sbin/ypbind ${YOPTS} + local ret=$? + if [ $ret -eq 0 ] ; then + notfound=1 + for i in 0 1 2 3 4 5 6 7 8 9 + do + ypwhich >/dev/null 2>&1 && { notfound=0; break; } + sleep 1 + done + if [ $notfound -eq 1 ] ; then + eend 1 "No NIS server found" + else + eend 0 + fi + else + eend $ret + fi +} + +stop() { + ebegin "Stopping ypbind" + start-stop-daemon --stop --quiet --exec /usr/sbin/ypbind + eend $? + # Remove binding files, if ypbind "forgets" it + rm -f /var/yp/binding/* +} diff --git a/pcr/openrc-net/ypserv b/pcr/openrc-net/ypserv new file mode 100644 index 000000000..be1dc42e1 --- /dev/null +++ b/pcr/openrc-net/ypserv @@ -0,0 +1,23 @@ +#!/sbin/runscript +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-nds/ypserv/files/ypserv,v 1.4 2006/04/10 20:00:18 eradicator Exp $ + +depend() { + need net portmap + use domainname +} + +start() { + ebegin "Starting NIS Server" + YOPTS="" + if [ -n "${YPSERV_OPTS}" ]; then YOPTS="-- ${YPSERV_OPTS}"; fi + start-stop-daemon --start --quiet --exec /usr/sbin/ypserv ${YOPTS} + eend $? +} + +stop() { + ebegin "Stopping NIS Server" + start-stop-daemon --stop --quiet --exec /usr/sbin/ypserv + eend $? +} diff --git a/pcr/openrc-net/ypserv.confd b/pcr/openrc-net/ypserv.confd new file mode 100644 index 000000000..0ae9756dc --- /dev/null +++ b/pcr/openrc-net/ypserv.confd @@ -0,0 +1,4 @@ +# Config file for /etc/init.d/ypserv + +# Command line options to pass to ypserv: +YPSERV_OPTS="" |