pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/pkgtools/rc.d-boot Add support for Linux sysvinit, bot...
details: https://anonhg.NetBSD.org/pkgsrc/rev/de3d07cdb91f
branches: trunk
changeset: 317053:de3d07cdb91f
user: schmonz <schmonz%pkgsrc.org@localhost>
date: Fri Dec 28 20:24:02 2018 +0000
description:
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.
diffstat:
pkgtools/rc.d-boot/DEINSTALL | 9 ++++++-
pkgtools/rc.d-boot/INSTALL | 9 ++++++-
pkgtools/rc.d-boot/Makefile | 41 ++++++++++++++++++++++--------
pkgtools/rc.d-boot/PLIST | 3 +-
pkgtools/rc.d-boot/files/pkgsrc-rc.d-boot | 37 +++++++++++++++++++++++++++
5 files changed, 85 insertions(+), 14 deletions(-)
diffs (191 lines):
diff -r 0fd174460ced -r de3d07cdb91f pkgtools/rc.d-boot/DEINSTALL
--- a/pkgtools/rc.d-boot/DEINSTALL Fri Dec 28 14:18:50 2018 +0000
+++ b/pkgtools/rc.d-boot/DEINSTALL Fri Dec 28 20:24:02 2018 +0000
@@ -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 @@
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)
diff -r 0fd174460ced -r de3d07cdb91f pkgtools/rc.d-boot/INSTALL
--- a/pkgtools/rc.d-boot/INSTALL Fri Dec 28 14:18:50 2018 +0000
+++ b/pkgtools/rc.d-boot/INSTALL Fri Dec 28 20:24:02 2018 +0000
@@ -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 @@
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)
diff -r 0fd174460ced -r de3d07cdb91f pkgtools/rc.d-boot/Makefile
--- a/pkgtools/rc.d-boot/Makefile Fri Dec 28 14:18:50 2018 +0000
+++ b/pkgtools/rc.d-boot/Makefile Fri Dec 28 20:24:02 2018 +0000
@@ -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 @@
LICENSE= 2-clause-bsd
ONLY_FOR_PLATFORM= # empty by default
+RCDBOOT_STYLE= unknown
.include "../../mk/bsd.prefs.mk"
@@ -27,6 +28,7 @@
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 @@
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)
+RCDBOOT_STYLE= openbsd-rcd
+.endif
+
+.if ${RCDBOOT_STYLE} != "unknown"
ONLY_FOR_PLATFORM+= ${OPSYS}-*-*
-RCDBOOT_STYLE= openbsd-rcd
.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-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/
diff -r 0fd174460ced -r de3d07cdb91f pkgtools/rc.d-boot/PLIST
--- a/pkgtools/rc.d-boot/PLIST Fri Dec 28 14:18:50 2018 +0000
+++ b/pkgtools/rc.d-boot/PLIST Fri Dec 28 20:24:02 2018 +0000
@@ -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
diff -r 0fd174460ced -r de3d07cdb91f pkgtools/rc.d-boot/files/pkgsrc-rc.d-boot
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/rc.d-boot/files/pkgsrc-rc.d-boot Fri Dec 28 20:24:02 2018 +0000
@@ -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