Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177893328
D7383.1795532974.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D7383.1795532974.diff
View Options
Index: etc/rc.d/Makefile
===================================================================
--- etc/rc.d/Makefile
+++ etc/rc.d/Makefile
@@ -75,6 +75,7 @@
netoptions \
netwait \
newsyslog \
+ nextboot \
nfsclient \
nfscbd \
nfsd \
Index: etc/rc.d/nextboot
===================================================================
--- /dev/null
+++ etc/rc.d/nextboot
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: nextboot
+# REQUIRE: FILESYSTEMS ldconfig
+
+. /etc/rc.subr
+
+name="nextboot"
+desc="Set up kernel nextboot"
+conf_file="/boot/nextboot.conf"
+command="/usr/libexec/k_${name}_helper"
+start_cmd="nextboot_start"
+stop_cmd=":"
+
+nextboot_start()
+{
+ check_startmsgs && echo -n 'Initializing kernel nextboot'
+
+ # Make sure file exists
+ if [ ! -f "${conf_file}" ]; then
+ touch "${conf_file}"
+ fi
+
+ # Pad to 512 bytes to give us room to overwrite at dump time.
+ while [ $(stat -f %z "${conf_file}") -lt 512 ]; do
+ echo -n " " >> "${conf_file}"
+ done
+
+ ${command} "${conf_file}"
+ check_startmsgs && echo '.'
+}
+
+load_rc_config $name
+run_rc_command "$1"
Index: libexec/Makefile
===================================================================
--- libexec/Makefile
+++ libexec/Makefile
@@ -9,6 +9,7 @@
${_comsat} \
${_dma} \
getty \
+ k_nextboot_helper \
${_mail.local} \
${_makewhatis.local} \
${_mknetid} \
Index: libexec/k_nextboot_helper/Makefile
===================================================================
--- /dev/null
+++ libexec/k_nextboot_helper/Makefile
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+PROG= k_nextboot_helper
+MAN=
+SRCS+= k_nextboot_helper.c
+WARNS?= 6
+
+.include <bsd.prog.mk>
Index: libexec/k_nextboot_helper/k_nextboot_helper.c
===================================================================
--- /dev/null
+++ libexec/k_nextboot_helper/k_nextboot_helper.c
@@ -0,0 +1,26 @@
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/filio.h>
+
+#include <err.h>
+#include <fcntl.h>
+
+int
+main(int argc, char **argv)
+{
+ int fd, one;
+
+ if (argc < 2)
+ errx(1, "usage: k_nextboot_helper /path/to/nextboot.conf");
+
+ fd = open(argv[1], O_RDWR);
+ if (fd < 0)
+ err(1, "open(%s)", argv[1]);
+
+ one = 1;
+ fd = ioctl(fd, FIONEXTBOOT, &one);
+ if (fd < 0)
+ err(1, "ioctl");
+
+ return (0);
+}
Index: sbin/reboot/nextboot.sh
===================================================================
--- sbin/reboot/nextboot.sh
+++ sbin/reboot/nextboot.sh
@@ -128,3 +128,4 @@
fsync ${nextboot_tmp}
mv ${nextboot_tmp} ${nextboot_file}
+/usr/libexec/k_nextboot_helper ${nextboot_file}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 24, 3:09 PM (7 h, 54 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41957310
Default Alt Text
D7383.1795532974.diff (2 KB)
Attached To
Mode
D7383: kernel nextboot: Add rc script and helper program to configure at boot time (knextboot 4/5)
Attached
Detach File
Event Timeline