diff options
author | Roy Marples <uberlord@gentoo.org> | 2006-10-03 13:38:06 +0000 |
---|---|---|
committer | Roy Marples <uberlord@gentoo.org> | 2006-10-03 13:38:06 +0000 |
commit | ee794007708fc807289028ad4ce50239cca6f91b (patch) | |
tree | ca28fc6a267189622d0629f48689d0af441dc71c /sys-freebsd | |
parent | Bump to 3.5.5 pre-release. (diff) | |
download | historical-ee794007708fc807289028ad4ce50239cca6f91b.tar.gz historical-ee794007708fc807289028ad4ce50239cca6f91b.tar.bz2 historical-ee794007708fc807289028ad4ce50239cca6f91b.zip |
Tart up init scripts. Install a Gentooified devd.cond and devd_queue.
Package-Manager: portage-2.1.2_pre2-r2
Diffstat (limited to 'sys-freebsd')
-rw-r--r-- | sys-freebsd/freebsd-sbin/ChangeLog | 12 | ||||
-rw-r--r-- | sys-freebsd/freebsd-sbin/files/devd.conf | 144 | ||||
-rw-r--r-- | sys-freebsd/freebsd-sbin/files/devd.initd | 50 | ||||
-rw-r--r-- | sys-freebsd/freebsd-sbin/files/devd_queue | 50 | ||||
-rw-r--r-- | sys-freebsd/freebsd-sbin/files/sysctl.initd | 42 | ||||
-rw-r--r-- | sys-freebsd/freebsd-sbin/freebsd-sbin-6.1.ebuild | 19 | ||||
-rw-r--r-- | sys-freebsd/freebsd-sbin/freebsd-sbin-6.2_beta1.ebuild | 19 |
7 files changed, 300 insertions, 36 deletions
diff --git a/sys-freebsd/freebsd-sbin/ChangeLog b/sys-freebsd/freebsd-sbin/ChangeLog index 57799d29d113..71a68451f1af 100644 --- a/sys-freebsd/freebsd-sbin/ChangeLog +++ b/sys-freebsd/freebsd-sbin/ChangeLog @@ -1,6 +1,16 @@ # ChangeLog for sys-freebsd/freebsd-sbin # Copyright 1999-2006 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-sbin/ChangeLog,v 1.17 2006/09/22 05:57:46 flameeyes Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-sbin/ChangeLog,v 1.18 2006/10/03 13:38:06 uberlord Exp $ + + 03 Oct 2006; Roy Marples <uberlord@gentoo.org> + -files/freebsd-sbin-6.1-devd-conf.patch, +files/devd.conf, + +files/devd.initd, +files/devd_queue, files/sysctl.initd, + freebsd-sbin-6.1.ebuild, freebsd-sbin-6.2_beta1.ebuild: + Tart up init scripts. + Install a Gentooified devd.cond and devd_queue + + 03 Oct 2006; Roy Marples <uberlord@gentoo.org> files/sysctl.initd: + Updated sysctl init script a little. 22 Sep 2006; Diego Pettenò <flameeyes@gentoo.org> freebsd-sbin-6.2_beta1.ebuild: diff --git a/sys-freebsd/freebsd-sbin/files/devd.conf b/sys-freebsd/freebsd-sbin/files/devd.conf new file mode 100644 index 000000000000..f7052bca2adc --- /dev/null +++ b/sys-freebsd/freebsd-sbin/files/devd.conf @@ -0,0 +1,144 @@ +# Refer to devd.conf(5) and devd(8) man pages for the details on how to +# run and configure devd. +# + +# NB: All regular expressions have an implicit ^$ around them. +# NB: device-name is shorthand for 'match device-name' + +options { + # Each directory directive adds a directory the list of directories + # that we scan for files. Files are read-in in the order that they + # are returned from readdir(3). The rule-sets are combined to + # create a DFA that's used to match events to actions. + directory "/etc/devd"; + directory "/usr/local/etc/devd"; + pid-file "/var/run/devd.pid"; + + # Setup some shorthand for regex that we use later in the file. + #XXX Yes, these are gross -- imp + set scsi-controller-regex + "(aac|adv|adw|aha|ahb|ahc|ahd|aic|amd|amr|asr|bt|ciss|ct|dpt|\ + esp|ida|iir|ips|isp|mlx|mly|mpt|ncr|ncv|nsp|stg|sym|trm|wds)\ + [0-9]+"; +}; + +# Note that the attach/detach with the highest value wins, so that one can +# override these general rules. + +# +# For ethernet like devices start configuring the interface. Due to +# a historical accident, this script is called pccard_ether. +# +attach 0 { + media-type "ethernet"; + action "/etc/devd_queue add env IN_HOTPLUG=1 /etc/init.d/net.$device-name start"; +}; + +detach 0 { + media-type "ethernet"; + action "/etc/devd_queue add env IN_HOTPLUG=1 /etc/init.d/net.$device-name stop"; +}; + +# +# Try to start dhclient on Ethernet like interfaces when the link comes +# up. Only devices that are configured to support DHCP will actually +# run it. No link down rule exists because dhclient automaticly exits +# when the link goes down. +# +notify 0 { + match "system" "IFNET"; + match "type" "LINK_UP"; + media-type "ethernet"; + action "/etc/devd_queue add /etc/init.d/net.$subsystem start"; +}; +notify 0 { + match "system" "IFNET"; + match "type" "LINK_DOWN"; + media-type "ethernet"; + action "/etc/devd_queue add /etc/init.d/net.$subsystem stop"; +}; + +# +# Like Ethernet devices, but separate because +# they have a different media type. We may want +# to exploit this later. +# +#detach 0 { +# media-type "802.11"; +# action "env IN_HOTPLUG=1 /etc/init.d/net.$device-name stop"; +#}; +#attach 0 { +# media-type "802.11"; +# action "env IN_HOTPLUG=1 /etc/init.d/net.$device-name start"; +#}; + +# Not sure how to handle this in Gentoo yet +# When a USB Bluetooth dongle appears activate it +#attach 100 { +# device-name "ubt[0-9]+"; +# action "/etc/rc.d/bluetooth start $device-name"; +#}; +#detach 100 { +# device-name "ubt[0-9]+"; +# action "/etc/rc.d/bluetooth stop $device-name"; +#}; + +# When a USB keyboard arrives, attach it as the console keyboard. +attach 100 { + device-name "ukbd0"; + action "kbdcontrol -k /dev/ukbd0 < /dev/console"; +}; +detach 100 { + device-name "ukbd0"; + action "kbdcontrol -k /dev/kbd0 < /dev/console"; +}; + +# Not sure how to handle this in Gentoo yet +# The entry below starts moused when a mouse is plugged in. Moused +# stops automatically (actually it bombs :) when the device disappears. +#attach 100 { +# device-name "ums[0-9]+"; +# action "/etc/rc.d/moused start $device-name"; +#}; + + +# Notify all users before beginning emergency shutdown when we get +# a _CRT or _HOT thermal event and we're going to power down the system +# very soon. +notify 10 { + match "system" "ACPI"; + match "subsystem" "Thermal"; + match "notify" "0xcc"; + action "logger -p kern.emerg 'WARNING: system temperature too high, shutting down soon!'"; +}; + +/* EXAMPLES TO END OF FILE + + +# Examples of notify hooks. A notify is a generic way for a kernel +# subsystem to send event notification to userland. +# +# Here are some examples of ACPI notify handlers. ACPI subsystems that +# generate notifies include the AC adapter, power/sleep buttons, +# control method batteries, lid switch, and thermal zones. +# +# Information returned is not always the same as the ACPI notify +# events. See the ACPI specification for more information about +# notifies. Here is the information returned for each subsystem: +# +# ACAD: AC line state (0 is offline, 1 is online) +# Button: Button pressed (0 for power, 1 for sleep) +# CMBAT: ACPI battery events +# Lid: Lid state (0 is closed, 1 is open) +# Thermal: ACPI thermal zone events +# +# This example calls a script when the AC state changes, passing the +# notify value as the first argument. If the state is 0x00, it might +# call some sysctls to implement economy mode. If 0x01, it might set +# the mode to performance. +notify 10 { + match "system" "ACPI"; + match "subsystem" "ACAD"; + action "/etc/acpi_ac $notify"; +}; +*/ diff --git a/sys-freebsd/freebsd-sbin/files/devd.initd b/sys-freebsd/freebsd-sbin/files/devd.initd new file mode 100644 index 000000000000..b8414abb56b7 --- /dev/null +++ b/sys-freebsd/freebsd-sbin/files/devd.initd @@ -0,0 +1,50 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + need localmount + after bootmisc hostname net +} + +start() { + # Services may depend on us, so mark us as inactive + mark_service_inactive "${SVCNAME}" + + # Create a queue so that if things went UP DOWN UP DOWN UP DOWN UP + # We just do an UP + # This is used by /etc/devd_queue + mkdir -p /var/run/devd + + ebegin $"Starting the Device State Change Daemon" + sysctl hw.bus.devctl_disable=0 >/dev/null + start-stop-daemon --start --exec /sbin/devd \ + --pidfile /var/run/devd.pid + eend $? $"Failed to start devd" \ + || return $? + + ebegin $"Waiting for Device State Change Daemon to settle" + LC_ALL=C sleep ${DEVD_WAIT:-2} + eend $? + + # Now flush the queue + einfo $"Flushing Device State Change Daemon queue" + + # Flush the output buffer + eflush + + /etc/devd_queue flush + + mark_service_starting "${SVCNAME}" + return 0 +} + +stop() { + ebegin $"Stopping the Device State Change Daemon" + sysctl hw.bus.devctl_disable=1 >/dev/null + start-stop-daemon --stop --exec /sbin/devd \ + --pidfile /var/run/devd.pid + eend $? $"Failed to stop devd" +} + +# vim: ts=4 : diff --git a/sys-freebsd/freebsd-sbin/files/devd_queue b/sys-freebsd/freebsd-sbin/files/devd_queue new file mode 100644 index 000000000000..c3550cde2336 --- /dev/null +++ b/sys-freebsd/freebsd-sbin/files/devd_queue @@ -0,0 +1,50 @@ +#!/bin/sh + +# Notify the rc system that we're in the background +export IN_BACKGROUND=1 + +arg1="$1" +if [ -z "$arg1" ] ; then + echo "Command required" > /dev/stderr + exit 1 +fi +shift + +case "$arg1" in + add) + if [ -z "$1" ] ; then + echo "Command missing!" > /dev/stderr + exit 1 + fi + + # If we don't have a queue then just run + if [ ! -d /var/run/devd ] ; then + "$@" + exit $? + fi + + cmd="$1" + args="$*" + if [ "$cmd" = "env" ] ; then + shift + while echo "$1" | grep -q "="; do + shift + [ "$1" = "--" ] && shift && break + done + cmd="$1" + fi + echo "$args" > /var/run/devd/$(basename "$cmd") + ;; + flush) + while ! rmdir /var/run/devd 2>/dev/null ; do + for cmd in $(cd /var/run/devd; ls) ; do + args=$(cat /var/run/devd/$cmd) + rm -f /var/run/devd/$cmd + $args + done + done + ;; + *) + echo "Unknown command $arg1" + ;; +esac diff --git a/sys-freebsd/freebsd-sbin/files/sysctl.initd b/sys-freebsd/freebsd-sbin/files/sysctl.initd index 9b28ab06ce03..e719061a2978 100644 --- a/sys-freebsd/freebsd-sbin/files/sysctl.initd +++ b/sys-freebsd/freebsd-sbin/files/sysctl.initd @@ -1,30 +1,26 @@ #!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-sbin/files/sysctl.initd,v 1.2 2006/04/12 16:07:48 flameeyes Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-sbin/files/sysctl.initd,v 1.3 2006/10/03 13:38:06 uberlord Exp $ -start() { - ebegin "Setting sysctl variables" - success=0 +depend() { + need checkroot +} - if [ -f /etc/sysctl.conf ]; then - grep -v '^#' /etc/sysctl.conf | while read var comments - do - if [[ -n ${var} ]]; then - name="${var%%=*}" - val="${var#*=}" - if [[ $(sysctl -N ${name} 2>/dev/null) == ${name} ]]; then - sysctl ${name}=${val} &>/dev/null - else - eerror "Kernel doesn't like ${name}" - success=1 - fi - fi - done - else - eerror "No /etc/sysctl.conf found." - success=1 - fi +start() { + ebegin $"Configuring kernel parameters" - eend $success "Some errors were encountered" + if [[ ! -f /etc/sysctl.conf ]]; then + eend 1 "/etc/sysctl.conf" $"not found" + return 1 + fi + + local retval=0 var= comments= + while read var comments ; do + [[ -z ${var} || ${var} == "#"* ]] && continue + sysctl "${var}" >/dev/null || retval=1 + done < /etc/sysctl.conf + eend ${retval} $"Some errors were encountered" } + +# vim: set ts=4 : diff --git a/sys-freebsd/freebsd-sbin/freebsd-sbin-6.1.ebuild b/sys-freebsd/freebsd-sbin/freebsd-sbin-6.1.ebuild index df62c8a99f59..30d84f70d3cc 100644 --- a/sys-freebsd/freebsd-sbin/freebsd-sbin-6.1.ebuild +++ b/sys-freebsd/freebsd-sbin/freebsd-sbin-6.1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-sbin/freebsd-sbin-6.1.ebuild,v 1.4 2006/09/11 22:08:20 flameeyes Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-sbin/freebsd-sbin-6.1.ebuild,v 1.5 2006/10/03 13:38:06 uberlord Exp $ inherit flag-o-matic bsdmk freebsd @@ -50,9 +50,6 @@ PATCHES="${FILESDIR}/${PN}-setXid.patch src_unpack() { freebsd_src_unpack ln -s "/usr/src/sys-${RV}" "${WORKDIR}/sys" - - cd "${WORKDIR}" - epatch "${FILESDIR}/${PN}-6.1-devd-conf.patch" } src_install() { @@ -63,13 +60,23 @@ src_install() { dodir /bin mv "${D}/sbin/ping" "${D}/bin/" || die "mv failed" + newinitd "${FILESDIR}/devd.initd" devd newinitd "${FILESDIR}/ipfw.initd" ipfw newinitd "${FILESDIR}/sysctl.initd" sysctl + # Gentoo devd.conf + # devd_queue is a filter so that only the last event is applied to an + # init script + insinto /etc + newins "${FILESDIR}/devd.conf" devd.conf + exeinto /etc + newexe "${FILESDIR}/devd_queue" devd_queue + + # Do we need pccard.conf if we have devd? + # Maybe ship our own sysctl.conf so things like radvd work out of the box. cd "${WORKDIR}/etc/" insinto /etc - doins devd.conf pccard_ether defaults/pccard.conf minfree rc.firewall \ - sysctl.conf + doins defaults/pccard.conf minfree sysctl.conf # Install a crontab for adjkerntz insinto /etc/cron.d diff --git a/sys-freebsd/freebsd-sbin/freebsd-sbin-6.2_beta1.ebuild b/sys-freebsd/freebsd-sbin/freebsd-sbin-6.2_beta1.ebuild index eaf7923a29a4..9322e2ee686c 100644 --- a/sys-freebsd/freebsd-sbin/freebsd-sbin-6.2_beta1.ebuild +++ b/sys-freebsd/freebsd-sbin/freebsd-sbin-6.2_beta1.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-sbin/freebsd-sbin-6.2_beta1.ebuild,v 1.2 2006/09/22 05:57:46 flameeyes Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-sbin/freebsd-sbin-6.2_beta1.ebuild,v 1.3 2006/10/03 13:38:06 uberlord Exp $ inherit flag-o-matic bsdmk freebsd @@ -50,9 +50,6 @@ PATCHES="${FILESDIR}/${PN}-setXid.patch src_unpack() { freebsd_src_unpack ln -s "/usr/src/sys-${RV}" "${WORKDIR}/sys" - - cd "${WORKDIR}" - epatch "${FILESDIR}/${PN}-6.1-devd-conf.patch" } src_install() { @@ -63,13 +60,23 @@ src_install() { dodir /bin mv "${D}/sbin/ping" "${D}/bin/" || die "mv failed" + newinitd "${FILESDIR}/devd.initd" devd newinitd "${FILESDIR}/ipfw.initd" ipfw newinitd "${FILESDIR}/sysctl.initd" sysctl + # Gentoo devd.conf + # devd_queue is a filter so that only the last event is applied to an + # init script + insinto /etc + newins "${FILESDIR}/devd.conf" devd.conf + exeinto /etc + newexe "${FILESDIR}/devd_queue" devd_queue + + # Do we need pccard.conf if we have devd? + # Maybe ship our own sysctl.conf so things like radvd work out of the box. cd "${WORKDIR}/etc/" insinto /etc - doins devd.conf pccard_ether defaults/pccard.conf minfree rc.firewall \ - sysctl.conf + doins defaults/pccard.conf minfree sysctl.conf # Install a crontab for adjkerntz insinto /etc/cron.d |