aboutsummaryrefslogtreecommitdiff
path: root/init.d.BSD
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-03-25 14:06:05 +0000
committerRoy Marples <roy@marples.name>2008-03-25 14:06:05 +0000
commit55eb3794fb4ad563102d5ab30c1d5337a599b2e5 (patch)
tree0d052faeb050c1e18ba56f6f6189bff3ffca28c9 /init.d.BSD
parent08aff6ef44ac5dc438d916b53aa61385f6d299f3 (diff)
Rework our folder structure so that we don't have OS specific dirs, making it easier to share init and conf files per OS.
Diffstat (limited to 'init.d.BSD')
-rw-r--r--init.d.BSD/.gitignore10
-rw-r--r--init.d.BSD/Makefile7
-rw-r--r--init.d.BSD/hostid.in78
-rw-r--r--init.d.BSD/moused.in62
-rw-r--r--init.d.BSD/newsyslog.in18
-rw-r--r--init.d.BSD/pf.in59
-rw-r--r--init.d.BSD/rarpd.in28
-rw-r--r--init.d.BSD/rc-enabled.in54
-rw-r--r--init.d.BSD/rpcbind.in21
-rw-r--r--init.d.BSD/savecore.in36
-rw-r--r--init.d.BSD/sysctl.in26
-rw-r--r--init.d.BSD/syslogd.in20
12 files changed, 0 insertions, 419 deletions
diff --git a/init.d.BSD/.gitignore b/init.d.BSD/.gitignore
deleted file mode 100644
index 0d998294..00000000
--- a/init.d.BSD/.gitignore
+++ /dev/null
@@ -1,10 +0,0 @@
-hostid
-moused
-newsyslog
-pf
-rarpd
-rc-enabled
-rpcbind
-savecore
-sysctl
-syslogd
diff --git a/init.d.BSD/Makefile b/init.d.BSD/Makefile
deleted file mode 100644
index 8edff64a..00000000
--- a/init.d.BSD/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-DIR= ${INITDIR}
-SRCS= hostid.in moused.in newsyslog.in pf.in rarpd.in rc-enabled.in \
- rpcbind.in savecore.in sysctl.in syslogd.in
-BIN= ${OBJS}
-
-MK= ../mk
-include ${MK}/scripts.mk
diff --git a/init.d.BSD/hostid.in b/init.d.BSD/hostid.in
deleted file mode 100644
index a0588848..00000000
--- a/init.d.BSD/hostid.in
+++ /dev/null
@@ -1,78 +0,0 @@
-#!@PREFIX@/sbin/runscript
-# Copyright 2007-2008 Roy Marples <roy@marples.name>
-# All rights reserved. Released under the 2-clause BSD license.
-
-extra_commands="reset"
-hostid_file=${hostid_file:-/etc/hostid}
-
-depend()
-{
- need root
- before devd net
- keyword nojail noprefix
-}
-
-_set()
-{
- local id=0
-
- if [ -n "$1" ]; then
- id=$(echo "$1" | md5)
- id="0x${id%????????????????????????}"
- fi
- ebegin "Setting Host ID: ${id}"
- sysctl -w kern.hostid="${id}" >/dev/null
- eend $? || return 1
-
- if sysctl -n kern.hostuuid >/dev/null 2>&1; then
- [ -n "$1" ] && id=$1
- ebegin "Setting Host UUID: ${id}"
- sysctl kern.hostuuid="${id}" >/dev/null
- eend $? || return 1
- fi
-
-}
-
-# First we check to see if there is a system UUID
-# If so then we use that and erase the hostid file,
-# otherwise we generate a random UUID.
-reset()
-{
- local uuid=$(kenv smbios.system.uuid 2>/dev/null)
- local x="[0-9a-f]"
- local y="${x}${x}${x}${x}"
- case "${uuid}" in
- ${y}${y}-${y}-${y}-${y}-${y}${y}${y});;
- *) uuid=;;
- esac
-
- if [ -n "${uuid}" ]; then
- rm -f "${hostid_file}"
- else
- uuid=$(uuidgen)
- if [ -z "${uuid}" ]; then
- eerror "Unable to generate a UUID"
- return 1
- fi
- if ! echo "${uuid}" > "${hostid_file}"; then
- eerror "Failed to store UUID in \`${hostid_file}'"
- return 1
- fi
- fi
-
- _set "${uuid}"
-}
-
-start()
-{
- if [ -r "${hostid_file}" ]; then
- _set $(cat "${hostid_file}")
- else
- reset
- fi
-}
-
-stop()
-{
- _set
-}
diff --git a/init.d.BSD/moused.in b/init.d.BSD/moused.in
deleted file mode 100644
index a0e97cdf..00000000
--- a/init.d.BSD/moused.in
+++ /dev/null
@@ -1,62 +0,0 @@
-#!@PREFIX@/sbin/runscript
-# Copyright 2007-2008 Roy Marples <roy@marples.name>
-# All rights reserved. Released under the 2-clause BSD license.
-
-mouse=${RC_SVCNAME##*.}
-if [ -n "${name}" -a "${mouse}" != "moused" ]; then
- moused_device=/dev/"${mouse}"
- pidfile=/var/run/moused-"${mouse}".pid
-else
- pidfile=/var/run/moused.pid
-fi
-name="Console Mouse Daemon"
-[ -n "${moused_device}" ] && name="${name} (${moused_device})"
-
-depend()
-{
- need localmount
- after bootmisc
- keyword nojail noprefix
-}
-
-start()
-{
- ebegin "Starting ${name}"
-
- if [ -z "${moused_device}" ]; then
- local dev=
- for dev in /dev/psm[0-9]* /dev/ums[0-9]*; do
- [ -c "${dev}" ] || continue
- [ -e /var/run/moused-"${dev##*/}".pid ] && continue
- moused_device=${dev}
- eindent
- einfo "Using mouse on ${moused_device}"
- eoutdent
- break
- done
- fi
-
- if [ -z "${moused_device}" ]; then
- eend 1 "No mouse device found"
- return 1
- fi
-
- local args=
- eval args=\$moused_args_${moused_device##*/}
- [ -z "${args}" ] && args=${moused_args}
-
- start-stop-daemon --start --exec /usr/sbin/moused \
- --pidfile "${pidfile}" \
- -- ${args} -p "${moused_device}" -I "${pidfile}"
- local retval=$?
-
- if [ ${retval} = 0 ]; then
- local ttyv=
- for ttyv in /dev/ttyv*; do
- vidcontrol < "${ttyv}" -m on
- : $((retval+= $?))
- done
- fi
-
- eend ${retval} "Failed to start moused"
-}
diff --git a/init.d.BSD/newsyslog.in b/init.d.BSD/newsyslog.in
deleted file mode 100644
index 04ca7928..00000000
--- a/init.d.BSD/newsyslog.in
+++ /dev/null
@@ -1,18 +0,0 @@
-#!@PREFIX@/sbin/runscript
-# Copyright 2007-2008 Roy Marples <roy@marples.name>
-# All rights reserved. Released under the 2-clause BSD license.
-
-required_files="/etc/newsyslog.conf"
-
-depend()
-{
- need localmount
- keyword noprefix
-}
-
-start()
-{
- ebegin "Creating and/or trimming log files"
- newsyslog -s ${newsyslog_args}
- eend $?
-}
diff --git a/init.d.BSD/pf.in b/init.d.BSD/pf.in
deleted file mode 100644
index fa55ea48..00000000
--- a/init.d.BSD/pf.in
+++ /dev/null
@@ -1,59 +0,0 @@
-#!@PREFIX@/sbin/runscript
-# Copyright 2007-2008 Roy Marples <roy@marples.name>
-# All rights reserved. Released under the 2-clause BSD license.
-
-name="Packet Filter"
-pf_conf=${pf_conf:-${pf_rules:-/etc/pf.conf}}
-required_files=${pf_conf}
-
-extra_commands="checkconfig showstatus"
-extra_started_commands="reload"
-
-depend() {
- need localmount
- keyword nojail noprefix
-}
-
-start()
-{
- ebegin "Starting ${name}"
- if type kldload >/dev/null 2>&1; then
- kldload pf 2>/dev/null
- fi
- pfctl -q -F all
- pfctl -q -f "${pf_conf}" ${pf_args}
- pfctl -q -e
- eend $?
-}
-
-stop()
-{
- ebegin "Stopping ${name}"
- pfctl -q -d
- eend $?
-}
-
-checkconfig()
-{
- ebegin "Checking ${name} configuration"
- pfctl -n -f "${pf_conf}"
- eend $?
-}
-
-reload()
-{
- ebegin "Reloading ${name} rules."
- pfctl -q -n -f "${pf_conf}" && \
- {
- # Flush everything but existing state entries that way when
- # rules are read in, it doesn't break established connections.
- pfctl -q -Fnat -Fqueue -Frules -FSources -Finfo -FTables -Fosfp
- pfctl -q -f "${pf_conf}" ${pf_args}
- }
- eend $?
-}
-
-showstatus()
-{
- pfctl -s info
-}
diff --git a/init.d.BSD/rarpd.in b/init.d.BSD/rarpd.in
deleted file mode 100644
index e7510990..00000000
--- a/init.d.BSD/rarpd.in
+++ /dev/null
@@ -1,28 +0,0 @@
-#!@PREFIX@/sbin/runscript
-# Copyright 2007-2008 Roy Marples <roy@marples.name>
-# All rights reserved. Released under the 2-clause BSD license.
-
-command=/usr/sbin/rarpd
-command_args="-f ${rarpd_args}"
-pidfile=/var/run/rarpd.pid
-name="Reverse ARP Daemon"
-required_files="/etc/ethers"
-
-if [ -z "${rarpd_interface}" ]; then
- command_args="${command_args} -a"
-else
- command_args="${command_args} ${rarpd_interface}"
-fi
-command_background="YES"
-
-depend()
-{
- need localmount
- after bootmisc
-
- if [ -z "${rarpd_interface}" ]; then
- need net
- else
- net net."${rarpd_interface}"
- fi
-}
diff --git a/init.d.BSD/rc-enabled.in b/init.d.BSD/rc-enabled.in
deleted file mode 100644
index 9801203b..00000000
--- a/init.d.BSD/rc-enabled.in
+++ /dev/null
@@ -1,54 +0,0 @@
-#!@PREFIX@/sbin/runscript
-# Copyright 2007-2008 Roy Marples <roy@marples.name>
-# All rights reserved. Released under the 2-clause BSD license.
-
-depend()
-{
- need localmount net
- after *
- before local
- keyword noprefix
-}
-
-start()
-{
- ebegin "Starting local rc services"
- local svc= enabled= retval=0 service=
- for svc in $(rcorder /etc/rc.d/* @PKG_PREFIX@/etc/rc.d/* 2>/dev/null); do
- [ -x "$svc" ] || continue
- service=${svc##*/}
-
- # Skip these services
- for s in cleartmp moused; do
- [ "${s}" = "${service}" ] && continue 2
- done
-
- # If we have an init script for this service, continue
- [ -x @SYSCONFDIR@/init.d/"${service}" ] && continue
- [ -x @PKG_PREFIX@/@SYSCONFDIR@/init.d/"${service}" ] && continue
- [ -x @LOCAL_PREFIX@/@SYSCONFDIR@/init.d/"${service}" ] && continue
-
- # Ensure that the users rc.conf will start us - ignore the defaults
- eval enabled=\$${svc##*/}_enable
- yesno ${enabled} || yesno ${svc##*/} || continue
-
- # Good to go!
- "$svc" start && started="${started} ${svc}"
- : $((retval += $?))
- done
- service_set_value started "${started}"
- eend $retval "Some local rc services failed to start"
- return 0
-}
-
-stop()
-{
- ebegin "Stopping local rc services"
- local svc= retval=0
- for svc in $(rcorder $(service_get_value started) 2>/dev/null | sort -r); do
- "${svc}" stop
- : $((retval += $?))
- done
- eend $retval "Some local rc services failed to stop"
- return 0
-}
diff --git a/init.d.BSD/rpcbind.in b/init.d.BSD/rpcbind.in
deleted file mode 100644
index 2d053ebd..00000000
--- a/init.d.BSD/rpcbind.in
+++ /dev/null
@@ -1,21 +0,0 @@
-#!@PREFIX@/sbin/runscript
-# Copyright 2007-2008 Roy Marples <roy@marples.name>
-# All rights reserved. Released under the 2-clause BSD license.
-
-command=/usr/sbin/rpcbind
-command_args=${rpcbind_args}
-name="RPC program number mapper"
-
-depend()
-{
- provide rpc
- need localmount
- use net logger dns
- before inetd xinetd ntpd ntp-client
-}
-
-stop_post()
-{
- # rpcbind returns too fast, so sleep for a second
- sleep 1
-}
diff --git a/init.d.BSD/savecore.in b/init.d.BSD/savecore.in
deleted file mode 100644
index e23bde48..00000000
--- a/init.d.BSD/savecore.in
+++ /dev/null
@@ -1,36 +0,0 @@
-#!@PREFIX@/sbin/runscript
-# Copyright 2007-2008 Roy Marples <roy@marples.name>
-# All rights reserved. Released under the 2-clause BSD license.
-
-description="Saves a kernel dump."
-
-depend()
-{
- need localmount
- keyword nojail noprefix
-}
-
-start()
-{
- local dump_dir=${dump_dir:-/var/crash}
- if ! [ -d "${dump_dir}" ]; then
- mkdir -p "${dump_dir}"
- chmod 700 "${dump_dir}"
- fi
-
- if [ "${RC_UNAME}" = "FreeBSD" ]; then
- # Don't quote ${dump_device}, so that if it's unset,
- # savecore will check on the partitions listed in fstab
- # without errors in the output
- savecore -C "${dump_dir}" ${dump_device} >/dev/null
- else
- ls "${dump_dir}"/bsd* > /dev/null 2>&1
- fi
- [ $? = 0 ] || return 0
-
- local sopts="${dump_dir} ${dump_device}"
- yesno ${dump_compress} && sopts="-z ${sopts}"
- ebegin "Saving kernel core dump in ${dump_dir}"
- savecore ${sopts} >/dev/null
- eend $?
-}
diff --git a/init.d.BSD/sysctl.in b/init.d.BSD/sysctl.in
deleted file mode 100644
index b1d8fb83..00000000
--- a/init.d.BSD/sysctl.in
+++ /dev/null
@@ -1,26 +0,0 @@
-#!@PREFIX@/sbin/runscript
-# Copyright 2007-2008 Roy Marples <roy@marples.name>
-# All rights reserved. Released under the 2-clause BSD license.
-
-depend()
-{
- use hostname
- before bootmisc logger
- keyword noprefix
-}
-
-start()
-{
- [ -e /etc/sysctl.conf ] || return 0
-
- ebegin "Configuring kernel parameters"
- local retval=0 var= comments=
- while read var comments; do
- case "${var}" in
- ""|"#"*) continue;;
- esac
- sysctl -w "${var}" >/dev/null || retval=1
- done < /etc/sysctl.conf
- eend ${retval} "Some errors were encountered"
- eend $?
-}
diff --git a/init.d.BSD/syslogd.in b/init.d.BSD/syslogd.in
deleted file mode 100644
index b39a7d3c..00000000
--- a/init.d.BSD/syslogd.in
+++ /dev/null
@@ -1,20 +0,0 @@
-#!@PREFIX@/sbin/runscript
-# Copyright 2007-2008 Roy Marples <roy@marples.name>
-# All rights reserved. Released under the 2-clause BSD license.
-
-command=/usr/sbin/syslogd
-command_args=${syslogd_args}
-case "${RC_UNAME}" in
- FreeBSD|DragonFly) pidfile=/var/run/syslog.pid;;
- *) pidfile=/var/run/syslogd.pid;;
-esac
-name="System Logger Daemon"
-
-depend()
-{
- provide logger
- use net newsyslog
- need localmount
- after bootmisc
- keyword noprefix
-}