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 Support Linux with systemd. Set LIC...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b118e4dc9907
branches:  trunk
changeset: 388661:b118e4dc9907
user:      schmonz <schmonz%pkgsrc.org@localhost>
date:      Wed Dec 12 02:08:10 2018 +0000

description:
Support Linux with systemd. Set LICENSE (2-clause-bsd). Bump version.

diffstat:

 pkgtools/rc.d-boot/DEINSTALL                      |  29 ++++++++++++++++++++++
 pkgtools/rc.d-boot/INSTALL                        |  15 ++++++----
 pkgtools/rc.d-boot/Makefile                       |  30 +++++++++++++++++-----
 pkgtools/rc.d-boot/PLIST                          |   3 +-
 pkgtools/rc.d-boot/files/pkgsrc-rc.d-boot.service |  12 +++++++++
 5 files changed, 75 insertions(+), 14 deletions(-)

diffs (149 lines):

diff -r bce6406f9ae0 -r b118e4dc9907 pkgtools/rc.d-boot/DEINSTALL
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/rc.d-boot/DEINSTALL      Wed Dec 12 02:08:10 2018 +0000
@@ -0,0 +1,29 @@
+# $NetBSD: DEINSTALL,v 1.1 2018/12/12 02:08:10 schmonz Exp $
+
+RCDBOOT_STYLE=@RCDBOOT_STYLE@
+
+case "${STAGE}" in
+
+DEINSTALL)
+       case "${RCDBOOT_STYLE}" in
+       darwin-launchd)
+               ;;
+       linux-systemd)
+               systemctl disable pkgsrc-rc.d-boot.service
+               ;;
+       netbsd-native)
+               ;;
+       esac
+
+       ${CAT} <<EOF
+===========================================================================
+
+pkgsrc-provided rc.d scripts will no longer be started at boot.
+
+If you wish to stop them, please do so now.
+
+===========================================================================
+EOF
+       ;;
+
+esac
diff -r bce6406f9ae0 -r b118e4dc9907 pkgtools/rc.d-boot/INSTALL
--- a/pkgtools/rc.d-boot/INSTALL        Wed Dec 12 01:08:35 2018 +0000
+++ b/pkgtools/rc.d-boot/INSTALL        Wed Dec 12 02:08:10 2018 +0000
@@ -1,15 +1,18 @@
-# $NetBSD: INSTALL,v 1.2 2018/12/05 19:49:26 schmonz Exp $
+# $NetBSD: INSTALL,v 1.3 2018/12/12 02:08:10 schmonz Exp $
 
-OPSYS=@OPSYS@
+RCDBOOT_STYLE=@RCDBOOT_STYLE@
 
-case ${STAGE} in
+case "${STAGE}" in
 
 POST-INSTALL)
-       case "${OPSYS}" in
-       Darwin)
+       case "${RCDBOOT_STYLE}" in
+       darwin-launchd)
                launchctl load -w /Library/LaunchDaemons/org.pkgsrc.rc.d-boot.plist
                ;;
-       NetBSD)
+       linux-systemd)
+               systemctl enable --now /etc/systemd/system/pkgsrc-rc.d-boot.service
+               ;;
+       netbsd-native)
                ;;
        esac
 
diff -r bce6406f9ae0 -r b118e4dc9907 pkgtools/rc.d-boot/Makefile
--- a/pkgtools/rc.d-boot/Makefile       Wed Dec 12 01:08:35 2018 +0000
+++ b/pkgtools/rc.d-boot/Makefile       Wed Dec 12 02:08:10 2018 +0000
@@ -1,13 +1,14 @@
-# $NetBSD: Makefile,v 1.2 2018/12/05 19:49:26 schmonz Exp $
+# $NetBSD: Makefile,v 1.3 2018/12/12 02:08:10 schmonz Exp $
 #
 
-PKGNAME=               rc.d-boot-20181205
+PKGNAME=               rc.d-boot-20181211
 CATEGORIES=            pkgtools
 
 MAINTAINER=            schmonz%NetBSD.org@localhost
 COMMENT=               Run package rc.d scripts at boot on any supported OS
+LICENSE=               2-clause-bsd
 
-ONLY_FOR_PLATFORM=     Darwin-*-* NetBSD-*-*
+ONLY_FOR_PLATFORM=     # empty by default
 
 .include "../../mk/bsd.prefs.mk"
 
@@ -24,14 +25,26 @@
 
 SUBST_CLASSES=         paths
 SUBST_STAGE.paths=     pre-configure
-SUBST_FILES.paths=     rc.d-boot org.pkgsrc.rc.d-boot.plist
+SUBST_FILES.paths=     rc.d-boot
+SUBST_FILES.paths+=    org.pkgsrc.rc.d-boot.plist \
+                       pkgsrc-rc.d-boot.service
 SUBST_VARS.paths=      PREFIX RCD_SCRIPTS_DIR RCORDER
 
-FILES_SUBST+=          OPSYS=${OPSYS:Q}
+FILES_SUBST+=          RCDBOOT_STYLE=${RCDBOOT_STYLE:Q}
 
-.if ${OPSYS} == "Darwin"
+.if ${OPSYS} == "Darwin" && exists (/Library/LaunchDaemons)
+ONLY_FOR_PLATFORM+=    Darwin-*-*
+RCDBOOT_STYLE=         darwin-launchd
 CONF_FILES+=           ${PREFIX}/share/examples/${PKGBASE}/org.pkgsrc.rc.d-boot.plist \
                        /Library/LaunchDaemons/org.pkgsrc.rc.d-boot.plist
+.elif ${OPSYS} == "Linux" && exists(/etc/systemd/system)
+ONLY_FOR_PLATFORM+=    Linux-*-*
+RCDBOOT_STYLE=         linux-systemd
+CONF_FILES+=           ${PREFIX}/share/examples/${PKGBASE}/pkgsrc-rc.d-boot.service \
+                       /etc/systemd/system/pkgsrc-rc.d-boot.service
+.elif ${OPSYS} == "NetBSD" && exists(/etc/rc.d)
+ONLY_FOR_PLATFORM+=    NetBSD-*-*
+RCDBOOT_STYLE=         netbsd-native
 .endif
 
 INSTALLATION_DIRS=     sbin share/examples/${PKGBASE}
@@ -40,7 +53,10 @@
        ${CP} -R ${FILESDIR} ${WRKSRC}
 
 do-install:
-       ${INSTALL_DATA} ${WRKSRC}/org.pkgsrc.rc.d-boot.plist ${DESTDIR}${PREFIX}/share/examples/${PKGBASE}/
+.      for i in org.pkgsrc.rc.d-boot.plist \
+               pkgsrc-rc.d-boot.service
+       ${INSTALL_DATA} ${WRKSRC}/${i} ${DESTDIR}${PREFIX}/share/examples/${PKGBASE}/
+.      endfor
        ${INSTALL_SCRIPT} ${WRKSRC}/rc.d-boot ${DESTDIR}${PREFIX}/sbin/
 
 .include "../../mk/bsd.pkg.mk"
diff -r bce6406f9ae0 -r b118e4dc9907 pkgtools/rc.d-boot/PLIST
--- a/pkgtools/rc.d-boot/PLIST  Wed Dec 12 01:08:35 2018 +0000
+++ b/pkgtools/rc.d-boot/PLIST  Wed Dec 12 02:08:10 2018 +0000
@@ -1,3 +1,4 @@
-@comment $NetBSD: PLIST,v 1.1 2018/12/05 19:23:04 schmonz Exp $
+@comment $NetBSD: PLIST,v 1.2 2018/12/12 02:08:10 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.service
diff -r bce6406f9ae0 -r b118e4dc9907 pkgtools/rc.d-boot/files/pkgsrc-rc.d-boot.service
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/rc.d-boot/files/pkgsrc-rc.d-boot.service Wed Dec 12 02:08:10 2018 +0000
@@ -0,0 +1,12 @@
+[Unit]
+Description = Run all pkgsrc rc.d scripts enabled in /etc/rc.conf
+After = syslog.target network.target
+
+[Service]
+Type = oneshot
+ExecStart = @PREFIX@/sbin/rc.d-boot start
+ExecStop = @PREFIX@/sbin/rc.d-boot stop
+RemainAfterExit = True
+
+[Install]
+WantedBy = multi-user.target



Home | Main Index | Thread Index | Old Index