summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2006-03-17 16:28:12 +0000
committerdes <des@FreeBSD.org>2006-03-17 16:28:12 +0000
commit32c951cbb38c003ff4c50be62876fd52a99be948 (patch)
treee759abf385ba02e25487e18a8f65cd3d34781feb
parentf7a01805a2584bea14bcedf92e3174fac33e02ac (diff)
downloadFreeBSD-src-32c951cbb38c003ff4c50be62876fd52a99be948.zip
FreeBSD-src-32c951cbb38c003ff4c50be62876fd52a99be948.tar.gz
This script symlinks /boot/kernel to the directory that contains the kernel
you booted from, unless /boot/kernel already exists and is not a symlink. This should only affect people like me who juggle multiple kernels and have KODIR = /boot/${KERN_IDENT} in /etc/make.conf to keep them apart.
-rwxr-xr-xetc/rc.d/Makefile2
-rw-r--r--etc/rc.d/kernel25
2 files changed, 26 insertions, 1 deletions
diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile
index 096dc0f..3743975 100755
--- a/etc/rc.d/Makefile
+++ b/etc/rc.d/Makefile
@@ -18,7 +18,7 @@ FILES= DAEMON LOGIN NETWORKING SERVERS \
ip6addrctl ip6fw ipfilter ipfs ipfw ipmon \
ipnat ipsec ipxrouted isdnd \
jail \
- kadmind kerberos keyserv kldxref kpasswdd \
+ kadmind kerberos kernel keyserv kldxref kpasswdd \
ldconfig local localpkg lpd \
mixer motd mountcritlocal mountcritremote \
mountd moused mroute6d mrouted msgs \
diff --git a/etc/rc.d/kernel b/etc/rc.d/kernel
new file mode 100644
index 0000000..ed9e02e
--- /dev/null
+++ b/etc/rc.d/kernel
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: kernel
+# REQUIRE: mountcritremote
+# KEYWORD: nojail
+
+. /etc/rc.subr
+
+name="kernel"
+start_cmd="kernel_start"
+stop_cmd=":"
+
+kernel_start()
+{
+ bootdir=$(dirname $(sysctl -n kern.bootfile))
+ if [ ! -e /boot/kernel -o -h /boot/kernel ] ; then
+ ln -hfs ${bootdir} /boot/kernel
+ fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
OpenPOWER on IntegriCloud