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 rc.d-boot: Fix for unprivileged use...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f366032428ee
branches:  trunk
changeset: 390176:f366032428ee
user:      triaxx <triaxx%pkgsrc.org@localhost>
date:      Sat Dec 17 21:36:11 2022 +0000

description:
rc.d-boot: Fix for unprivileged users on Darwin

pkgsrc changes:
---------------
  * Replace hardcoded /etc with ${PKG_SYSCONFDIR} to find rc.d scripts installed
    by unprivileged users.
  * For unprivileged bootstrap, the INSTALL script copies
    org.pkgsrc.rc.d-boot.plist to $HOME directory of the user who installs the
    package. This avoids making assumptions on the unprivileged user during the
    build process.

diffstat:

 pkgtools/rc.d-boot/DEINSTALL       |   7 ++++++-
 pkgtools/rc.d-boot/INSTALL         |  12 ++++++++++--
 pkgtools/rc.d-boot/Makefile        |  10 +++++++---
 pkgtools/rc.d-boot/files/rc.d-boot |   2 +-
 4 files changed, 24 insertions(+), 7 deletions(-)

diffs (100 lines):

diff -r 0274fb809bb3 -r f366032428ee pkgtools/rc.d-boot/DEINSTALL
--- a/pkgtools/rc.d-boot/DEINSTALL      Sat Dec 17 21:29:44 2022 +0000
+++ b/pkgtools/rc.d-boot/DEINSTALL      Sat Dec 17 21:36:11 2022 +0000
@@ -1,13 +1,18 @@
-# $NetBSD: DEINSTALL,v 1.4 2018/12/28 20:24:02 schmonz Exp $
+# $NetBSD: DEINSTALL,v 1.5 2022/12/17 21:36:11 triaxx Exp $
 
 RCDBOOT_STYLE=@RCDBOOT_STYLE@
 RCD_SCRIPTS_DIR=@RCD_SCRIPTS_DIR@
+UNPRIVILEGED=@UNPRIVILEGED@
+EGDIR=@EGDIR@
 
 case "${STAGE}" in
 
 DEINSTALL)
        case "${RCDBOOT_STYLE}" in
        darwin-launchd)
+               if [ "x${UNPRIVILEGED}" = "xyes" ] ; then
+                       ${RM} -f $HOME/Library/LaunchAgents/org.pkgsrc.rc.d-boot.plist
+               fi
                ;;
        freebsd-native)
                ;;
diff -r 0274fb809bb3 -r f366032428ee pkgtools/rc.d-boot/INSTALL
--- a/pkgtools/rc.d-boot/INSTALL        Sat Dec 17 21:29:44 2022 +0000
+++ b/pkgtools/rc.d-boot/INSTALL        Sat Dec 17 21:36:11 2022 +0000
@@ -1,14 +1,22 @@
-# $NetBSD: INSTALL,v 1.6 2018/12/28 20:24:02 schmonz Exp $
+# $NetBSD: INSTALL,v 1.7 2022/12/17 21:36:11 triaxx Exp $
 
 RCDBOOT_STYLE=@RCDBOOT_STYLE@
 RCD_SCRIPTS_DIR=@RCD_SCRIPTS_DIR@
+UNPRIVILEGED=@UNPRIVILEGED@
+EGDIR=@EGDIR@
 
 case "${STAGE}" in
 
 POST-INSTALL)
        case "${RCDBOOT_STYLE}" in
        darwin-launchd)
-               launchctl load -w /Library/LaunchDaemons/org.pkgsrc.rc.d-boot.plist
+               if [ "x${UNPRIVILEGED}" = "xyes" ] ; then
+                       ${CP} ${EGDIR}/org.pkgsrc.rc.d-boot.plist \
+                             $HOME/Library/LaunchAgents/org.pkgsrc.rc.d-boot.plist
+                       launchctl load -w $HOME/Library/LaunchAgents/org.pkgsrc.rc.d-boot.plist
+               else
+                       launchctl load -w /Library/LaunchDaemons/org.pkgsrc.rc.d-boot.plist
+               fi
                ;;
        freebsd-native)
                ;;
diff -r 0274fb809bb3 -r f366032428ee pkgtools/rc.d-boot/Makefile
--- a/pkgtools/rc.d-boot/Makefile       Sat Dec 17 21:29:44 2022 +0000
+++ b/pkgtools/rc.d-boot/Makefile       Sat Dec 17 21:36:11 2022 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.12 2020/01/16 16:54:36 schmonz Exp $
+# $NetBSD: Makefile,v 1.13 2022/12/17 21:36:11 triaxx Exp $
 #
 
-PKGNAME=               rc.d-boot-20200116
+PKGNAME=               rc.d-boot-20221202
 CATEGORIES=            pkgtools
 
 MAINTAINER=            schmonz%NetBSD.org@localhost
@@ -30,10 +30,12 @@
 SUBST_FILES.paths+=    org.pkgsrc.rc.d-boot.plist \
                        pkgsrc-rc.d-boot \
                        pkgsrc-rc.d-boot.service
-SUBST_VARS.paths=      GREP PKGNAME PREFIX RCD_SCRIPTS_DIR RCORDER VARBASE
+SUBST_VARS.paths=      GREP PKG_SYSCONFDIR PKGNAME PREFIX RCD_SCRIPTS_DIR RCORDER VARBASE
 
 FILES_SUBST+=          RCDBOOT_STYLE=${RCDBOOT_STYLE:Q}
 FILES_SUBST+=          RCD_SCRIPTS_DIR=${RCD_SCRIPTS_DIR:Q}
+FILES_SUBST+=          UNPRIVILEGED=${UNPRIVILEGED:Q}
+FILES_SUBST+=          EGDIR=${PREFIX:Q}/${EGDIR:Q}
 
 EGDIR=                 share/examples/${PKGBASE}
 
@@ -41,8 +43,10 @@
 
 .if ${OPSYS} == "Darwin" && exists(/Library/LaunchDaemons)
 RCDBOOT_STYLE=         darwin-launchd
+.  if ${UNPRIVILEGED:U:tl} == "no"
 CONF_FILES+=           ${PREFIX}/${EGDIR}/org.pkgsrc.rc.d-boot.plist \
                        ${SLASH_TO_MOLLIFY_PKGLINT}Library/LaunchDaemons/org.pkgsrc.rc.d-boot.plist
+.  endif
 .elif ${OPSYS} == "FreeBSD" && exists(/etc/rc.d)
 RCDBOOT_STYLE=         freebsd-native
 .elif ${OPSYS} == "Linux" && exists(/run/systemd/system) && exists(/bin/systemctl)
diff -r 0274fb809bb3 -r f366032428ee pkgtools/rc.d-boot/files/rc.d-boot
--- a/pkgtools/rc.d-boot/files/rc.d-boot        Sat Dec 17 21:29:44 2022 +0000
+++ b/pkgtools/rc.d-boot/files/rc.d-boot        Sat Dec 17 21:36:11 2022 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-. /etc/rc.subr
+. @PKG_SYSCONFDIR@/rc.subr
 
 run_all_rcd_scripts() {
        action="$1"; shift



Home | Main Index | Thread Index | Old Index