pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/pkgtools/rc.d-boot
Module Name: pkgsrc
Committed By: schmonz
Date: Fri Dec 28 20:24:02 UTC 2018
Modified Files:
pkgsrc/pkgtools/rc.d-boot: DEINSTALL INSTALL Makefile PLIST
Added Files:
pkgsrc/pkgtools/rc.d-boot/files: pkgsrc-rc.d-boot
Log Message:
Add support for Linux sysvinit, both Debian and Red Hat styles. Improve
systemd detection. Tested on CentOS 6 (Red Hat init) and 7 (systemd),
Devuan (Debian init), and Debian 9 (systemd).
Add RCDBOOT_STYLE to BUILD_DEFS.
Bump version.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 pkgsrc/pkgtools/rc.d-boot/DEINSTALL
cvs rdiff -u -r1.5 -r1.6 pkgsrc/pkgtools/rc.d-boot/INSTALL
cvs rdiff -u -r1.6 -r1.7 pkgsrc/pkgtools/rc.d-boot/Makefile
cvs rdiff -u -r1.2 -r1.3 pkgsrc/pkgtools/rc.d-boot/PLIST
cvs rdiff -u -r0 -r1.1 pkgsrc/pkgtools/rc.d-boot/files/pkgsrc-rc.d-boot
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/pkgtools/rc.d-boot/DEINSTALL
diff -u pkgsrc/pkgtools/rc.d-boot/DEINSTALL:1.3 pkgsrc/pkgtools/rc.d-boot/DEINSTALL:1.4
--- pkgsrc/pkgtools/rc.d-boot/DEINSTALL:1.3 Wed Dec 26 00:43:55 2018
+++ pkgsrc/pkgtools/rc.d-boot/DEINSTALL Fri Dec 28 20:24:02 2018
@@ -1,4 +1,4 @@
-# $NetBSD: DEINSTALL,v 1.3 2018/12/26 00:43:55 schmonz Exp $
+# $NetBSD: DEINSTALL,v 1.4 2018/12/28 20:24:02 schmonz Exp $
RCDBOOT_STYLE=@RCDBOOT_STYLE@
RCD_SCRIPTS_DIR=@RCD_SCRIPTS_DIR@
@@ -14,6 +14,13 @@ DEINSTALL)
linux-systemd)
systemctl disable pkgsrc-rc.d-boot.service
;;
+ linux-sysv-debian)
+ update-rc.d pkgsrc-rc.d-boot remove
+ ;;
+ linux-sysv-redhat)
+ chkconfig pkgsrc-rc.d-boot off
+ chkconfig --del pkgsrc-rc.d-boot
+ ;;
netbsd-native)
;;
openbsd-rcd)
Index: pkgsrc/pkgtools/rc.d-boot/INSTALL
diff -u pkgsrc/pkgtools/rc.d-boot/INSTALL:1.5 pkgsrc/pkgtools/rc.d-boot/INSTALL:1.6
--- pkgsrc/pkgtools/rc.d-boot/INSTALL:1.5 Wed Dec 26 00:43:55 2018
+++ pkgsrc/pkgtools/rc.d-boot/INSTALL Fri Dec 28 20:24:02 2018
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.5 2018/12/26 00:43:55 schmonz Exp $
+# $NetBSD: INSTALL,v 1.6 2018/12/28 20:24:02 schmonz Exp $
RCDBOOT_STYLE=@RCDBOOT_STYLE@
RCD_SCRIPTS_DIR=@RCD_SCRIPTS_DIR@
@@ -15,6 +15,13 @@ POST-INSTALL)
linux-systemd)
systemctl enable --now /etc/systemd/system/pkgsrc-rc.d-boot.service
;;
+ linux-sysv-debian)
+ update-rc.d pkgsrc-rc.d-boot defaults
+ ;;
+ linux-sysv-redhat)
+ chkconfig --add pkgsrc-rc.d-boot
+ chkconfig pkgsrc-rc.d-boot on
+ ;;
netbsd-native)
;;
openbsd-rcd)
Index: pkgsrc/pkgtools/rc.d-boot/Makefile
diff -u pkgsrc/pkgtools/rc.d-boot/Makefile:1.6 pkgsrc/pkgtools/rc.d-boot/Makefile:1.7
--- pkgsrc/pkgtools/rc.d-boot/Makefile:1.6 Wed Dec 26 00:43:55 2018
+++ pkgsrc/pkgtools/rc.d-boot/Makefile Fri Dec 28 20:24:02 2018
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.6 2018/12/26 00:43:55 schmonz Exp $
+# $NetBSD: Makefile,v 1.7 2018/12/28 20:24:02 schmonz Exp $
#
-PKGNAME= rc.d-boot-20181226
+PKGNAME= rc.d-boot-20181228
CATEGORIES= pkgtools
MAINTAINER= schmonz%NetBSD.org@localhost
@@ -9,6 +9,7 @@ COMMENT= Run package rc.d scripts at bo
LICENSE= 2-clause-bsd
ONLY_FOR_PLATFORM= # empty by default
+RCDBOOT_STYLE= unknown
.include "../../mk/bsd.prefs.mk"
@@ -27,6 +28,7 @@ SUBST_CLASSES= paths
SUBST_STAGE.paths= pre-configure
SUBST_FILES.paths= rc.d-boot
SUBST_FILES.paths+= org.pkgsrc.rc.d-boot.plist \
+ pkgsrc-rc.d-boot \
pkgsrc-rc.d-boot.service
SUBST_VARS.paths= GREP PREFIX RCD_SCRIPTS_DIR RCORDER
@@ -35,30 +37,44 @@ FILES_SUBST+= RCD_SCRIPTS_DIR=${RCD_SCR
EGDIR= share/examples/${PKGBASE}
-.if ${OPSYS} == "Darwin" && exists (/Library/LaunchDaemons)
-ONLY_FOR_PLATFORM+= ${OPSYS}-*-*
+.if ${OPSYS} == "Darwin" && exists(/Library/LaunchDaemons)
RCDBOOT_STYLE= darwin-launchd
CONF_FILES+= ${PREFIX}/${EGDIR}/org.pkgsrc.rc.d-boot.plist \
/Library/LaunchDaemons/org.pkgsrc.rc.d-boot.plist
.elif ${OPSYS} == "FreeBSD" && exists(/etc/rc.d)
-ONLY_FOR_PLATFORM+= ${OPSYS}-*-*
RCDBOOT_STYLE= freebsd-native
-.elif ${OPSYS} == "Linux" && exists(/etc/systemd/system)
-ONLY_FOR_PLATFORM+= ${OPSYS}-*-*
+.elif ${OPSYS} == "Linux" && exists(/run/systemd/system) && exists(/bin/systemctl)
RCDBOOT_STYLE= linux-systemd
CONF_FILES+= ${PREFIX}/${EGDIR}/pkgsrc-rc.d-boot.service \
/etc/systemd/system/pkgsrc-rc.d-boot.service
+.elif ${OPSYS} == "Linux" && exists(/etc/rc.d/init.d) && exists(/sbin/chkconfig)
+RCDBOOT_STYLE= linux-sysv-redhat
+CONF_FILES_PERMS+= ${PREFIX}/${EGDIR}/pkgsrc-rc.d-boot \
+ /etc/init.d/pkgsrc-rc.d-boot \
+ ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} ${RCD_SCRIPTS_MODE}
+.elif ${OPSYS} == "Linux" && exists(/etc/init.d) && exists(/usr/sbin/update-rc.d)
+RCDBOOT_STYLE= linux-sysv-debian
+CONF_FILES_PERMS+= ${PREFIX}/${EGDIR}/pkgsrc-rc.d-boot \
+ /etc/init.d/pkgsrc-rc.d-boot \
+ ${REAL_ROOT_USER} ${REAL_ROOT_GROUP} ${RCD_SCRIPTS_MODE}
.elif ${OPSYS} == "NetBSD" && exists(/etc/rc.d)
-ONLY_FOR_PLATFORM+= ${OPSYS}-*-*
RCDBOOT_STYLE= netbsd-native
.elif ${OPSYS} == "OpenBSD" && exists(/etc/rc.d/rc.subr)
-ONLY_FOR_PLATFORM+= ${OPSYS}-*-*
RCDBOOT_STYLE= openbsd-rcd
+.endif
+
+.if ${RCDBOOT_STYLE} != "unknown"
+ONLY_FOR_PLATFORM+= ${OPSYS}-*-*
.else
+# Help wanted! Some known boot schemes we'd like to support:
+# - https://wiki.gentoo.org/wiki/Project:OpenRC
+# - http://smarden.org/runit/
+# - https://jdebp.eu/Softwares/nosh/
+# - http://upstart.ubuntu.com
NOT_FOR_PLATFORM+= ${OPSYS}-*-*
.endif
-BUILD_DEFS+= RCD_SCRIPTS_DIR
+BUILD_DEFS+= RCDBOOT_STYLE RCD_SCRIPTS_DIR
INSTALLATION_DIRS= sbin ${EGDIR}
do-extract:
@@ -67,7 +83,10 @@ do-extract:
do-install:
. for i in org.pkgsrc.rc.d-boot.plist \
pkgsrc-rc.d-boot.service
- ${INSTALL_DATA} ${WRKSRC}/${i} ${DESTDIR}${PREFIX}/${EGDIR}/
+ ${INSTALL_DATA} ${WRKSRC}/${i} ${DESTDIR}${PREFIX}/${EGDIR}/
+. endfor
+. for i in pkgsrc-rc.d-boot
+ ${INSTALL_SCRIPT} ${WRKSRC}/${i} ${DESTDIR}${PREFIX}/${EGDIR}/
. endfor
${INSTALL_SCRIPT} ${WRKSRC}/rc.d-boot ${DESTDIR}${PREFIX}/sbin/
Index: pkgsrc/pkgtools/rc.d-boot/PLIST
diff -u pkgsrc/pkgtools/rc.d-boot/PLIST:1.2 pkgsrc/pkgtools/rc.d-boot/PLIST:1.3
--- pkgsrc/pkgtools/rc.d-boot/PLIST:1.2 Wed Dec 12 02:08:10 2018
+++ pkgsrc/pkgtools/rc.d-boot/PLIST Fri Dec 28 20:24:02 2018
@@ -1,4 +1,5 @@
-@comment $NetBSD: PLIST,v 1.2 2018/12/12 02:08:10 schmonz Exp $
+@comment $NetBSD: PLIST,v 1.3 2018/12/28 20:24:02 schmonz Exp $
sbin/rc.d-boot
share/examples/rc.d-boot/org.pkgsrc.rc.d-boot.plist
+share/examples/rc.d-boot/pkgsrc-rc.d-boot
share/examples/rc.d-boot/pkgsrc-rc.d-boot.service
Added files:
Index: pkgsrc/pkgtools/rc.d-boot/files/pkgsrc-rc.d-boot
diff -u /dev/null pkgsrc/pkgtools/rc.d-boot/files/pkgsrc-rc.d-boot:1.1
--- /dev/null Fri Dec 28 20:24:02 2018
+++ pkgsrc/pkgtools/rc.d-boot/files/pkgsrc-rc.d-boot Fri Dec 28 20:24:02 2018
@@ -0,0 +1,37 @@
+#! /bin/sh
+#
+# $NetBSD: pkgsrc-rc.d-boot,v 1.1 2018/12/28 20:24:02 schmonz Exp $
+#
+# @PKGNAME@ script to start/stop pkgsrc-provided services
+
+### BEGIN INIT INFO
+# Provides: pkgsrc-rc.d-boot
+# Required-Start: $remote_fs $network
+# Required-Stop: $remote_fs $network
+# Default-Start: 2 3 4 5
+# Default-Stop:
+# Short-Description: Starts all pkgsrc-provided services
+### END INIT INFO
+
+# chkconfig: 2345 70 30
+# description: Starts all pkgsrc-provided services
+
+PREFIX="@PREFIX@"
+export PATH="${PREFIX}/sbin:${PREFIX}/bin:${PATH}"
+RCDBOOT="${PREFIX}/sbin/rc.d-boot"
+
+test -x ${RCDBOOT} || exit 0
+
+case "$1" in
+ start|stop|reload|restart|status)
+ ${RCDBOOT} "$1"
+ ;;
+ force-reload)
+ ${RCDBOOT} restart
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|reload|force-reload|restart|status}"
+ exit 2
+esac
+
+exit $?
Home |
Main Index |
Thread Index |
Old Index