summaryrefslogtreecommitdiff
path: root/pkgtools/rc.d-boot
diff options
context:
space:
mode:
authorschmonz <schmonz@pkgsrc.org>2018-12-05 19:23:04 +0000
committerschmonz <schmonz@pkgsrc.org>2018-12-05 19:23:04 +0000
commit9f66315968d7847058bd5c7b6b41af9933e431f3 (patch)
tree74f1d41a600dc1ec21ecf0f1e639f24cea99e797 /pkgtools/rc.d-boot
parent1ef511e7b1f95132f739b15f53fb8f8218778f35 (diff)
downloadpkgsrc-9f66315968d7847058bd5c7b6b41af9933e431f3.tar.gz
Initial version of rc.d-boot, a package that runs all rc.conf-enabled
rc.d scripts at boot time as one "service" in your operating system's normal boot process. Just Darwin so far. Please pitch in for your preferred OS!
Diffstat (limited to 'pkgtools/rc.d-boot')
-rw-r--r--pkgtools/rc.d-boot/DESCR2
-rw-r--r--pkgtools/rc.d-boot/INSTALL10
-rw-r--r--pkgtools/rc.d-boot/Makefile35
-rw-r--r--pkgtools/rc.d-boot/PLIST3
-rw-r--r--pkgtools/rc.d-boot/files/org.pkgsrc.rc.d-boot.plist23
-rw-r--r--pkgtools/rc.d-boot/files/rc.d-boot31
6 files changed, 104 insertions, 0 deletions
diff --git a/pkgtools/rc.d-boot/DESCR b/pkgtools/rc.d-boot/DESCR
new file mode 100644
index 00000000000..75ec5ff0dda
--- /dev/null
+++ b/pkgtools/rc.d-boot/DESCR
@@ -0,0 +1,2 @@
+This package runs all rc.conf-enabled rc.d scripts at boot time as one
+"service" in your operating system's normal boot process.
diff --git a/pkgtools/rc.d-boot/INSTALL b/pkgtools/rc.d-boot/INSTALL
new file mode 100644
index 00000000000..2905abf6d93
--- /dev/null
+++ b/pkgtools/rc.d-boot/INSTALL
@@ -0,0 +1,10 @@
+# $NetBSD: INSTALL,v 1.1 2018/12/05 19:23:04 schmonz Exp $
+
+case ${STAGE} in
+
+POST-INSTALL)
+ launchctl load -w /Library/LaunchDaemons/org.pkgsrc.rc.d-boot.plist
+
+ ;;
+
+esac
diff --git a/pkgtools/rc.d-boot/Makefile b/pkgtools/rc.d-boot/Makefile
new file mode 100644
index 00000000000..ead1203eccf
--- /dev/null
+++ b/pkgtools/rc.d-boot/Makefile
@@ -0,0 +1,35 @@
+# $NetBSD: Makefile,v 1.1 2018/12/05 19:23:04 schmonz Exp $
+#
+
+PKGNAME= rc.d-boot-20181205
+CATEGORIES= pkgtools
+
+MAINTAINER= schmonz@NetBSD.org
+COMMENT= Run package rc.d scripts at boot on any supported OS
+
+ONLY_FOR_PLATFORM= Darwin-*-*
+
+DEPENDS+= rc.subr-[0-9]*:../../pkgtools/rc.subr
+DEPENDS+= rcorder-[0-9]*:../../pkgtools/rcorder
+
+NO_CHECKSUM= yes
+NO_BUILD= yes
+
+SUBST_CLASSES= paths
+SUBST_STAGE.paths= pre-configure
+SUBST_FILES.paths= rc.d-boot org.pkgsrc.rc.d-boot.plist
+SUBST_VARS.paths= PREFIX RCD_SCRIPTS_DIR
+
+CONF_FILES+= ${PREFIX}/share/examples/${PKGBASE}/org.pkgsrc.rc.d-boot.plist \
+ /Library/LaunchDaemons/org.pkgsrc.rc.d-boot.plist
+
+INSTALLATION_DIRS= sbin share/examples/${PKGBASE}
+
+do-extract:
+ ${CP} -R ${FILESDIR} ${WRKSRC}
+
+do-install:
+ ${INSTALL_DATA} ${WRKSRC}/org.pkgsrc.rc.d-boot.plist ${DESTDIR}${PREFIX}/share/examples/${PKGBASE}/
+ ${INSTALL_SCRIPT} ${WRKSRC}/rc.d-boot ${DESTDIR}${PREFIX}/sbin/
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/pkgtools/rc.d-boot/PLIST b/pkgtools/rc.d-boot/PLIST
new file mode 100644
index 00000000000..3f2958d110a
--- /dev/null
+++ b/pkgtools/rc.d-boot/PLIST
@@ -0,0 +1,3 @@
+@comment $NetBSD: PLIST,v 1.1 2018/12/05 19:23:04 schmonz Exp $
+sbin/rc.d-boot
+share/examples/rc.d-boot/org.pkgsrc.rc.d-boot.plist
diff --git a/pkgtools/rc.d-boot/files/org.pkgsrc.rc.d-boot.plist b/pkgtools/rc.d-boot/files/org.pkgsrc.rc.d-boot.plist
new file mode 100644
index 00000000000..71df1d96024
--- /dev/null
+++ b/pkgtools/rc.d-boot/files/org.pkgsrc.rc.d-boot.plist
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>Disabled</key>
+ <false/>
+ <key>Label</key>
+ <string>org.pkgsrc.rc.d-boot</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>@PREFIX@/sbin/rc.d-boot</string>
+ <string>start</string>
+ </array>
+ <key>OnDemand</key>
+ <false/>
+ <key>KeepAlive</key>
+ <false/>
+ <key>LaunchOnlyOnce</key>
+ <true/>
+</dict>
+</plist>
diff --git a/pkgtools/rc.d-boot/files/rc.d-boot b/pkgtools/rc.d-boot/files/rc.d-boot
new file mode 100644
index 00000000000..78b37489b46
--- /dev/null
+++ b/pkgtools/rc.d-boot/files/rc.d-boot
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+run_all_rcd_scripts() {
+ action="$1"; shift
+
+ # from NetBSD /etc/rc
+ scripts=$(for rcd in @RCD_SCRIPTS_DIR@; do
+ test -d ${rcd} && echo ${rcd}/*;
+ done)
+
+ files=$(@PREFIX@/sbin/rcorder -s nostart ${scripts})
+
+ for _rc_elem in $files; do
+ $_rc_elem ${action}
+ done
+}
+
+usage() {
+ echo >&2 "usage: $0 <start|stop>"
+ exit 1
+}
+
+main() {
+ [ $# -eq 1 ] || usage
+ action="$1"; shift
+
+ run_all_rcd_scripts "${action}"
+}
+
+main "$@"
+exit $?