pcp
[Top] [All Lists]

Re: Installing files/dirs as non-root:root user and group

To: Dave Brolley <brolley@xxxxxxxxxx>
Subject: Re: Installing files/dirs as non-root:root user and group
From: Nathan Scott <nathans@xxxxxxxxxx>
Date: Thu, 20 Jun 2013 18:00:51 -0400 (EDT)
Cc: pcp@xxxxxxxxxxx
Delivered-to: pcp@xxxxxxxxxxx
In-reply-to: <51C35A06.6050909@xxxxxxxxxx>
References: <698020944.4509484.1371683485976.JavaMail.root@xxxxxxxxxx> <51C35A06.6050909@xxxxxxxxxx>
Reply-to: Nathan Scott <nathans@xxxxxxxxxx>
Thread-index: Xw/5G7qgfrOBeCJWF3QYmOXR7qn0PA==
Thread-topic: Installing files/dirs as non-root:root user and group
Hi Dave,

----- Original Message -----
> Hey Nathan,
> 
> I was still unable to find a suitable place among the {GNU}makefiles,

Something like this (untested) ...

$ diff --git a/GNUmakefile b/GNUmakefile
index 8a58e9d..567ef24 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -80,6 +80,7 @@ endif
 ifeq "$(findstring $(PCP_TMP_DIR),/var/tmp /tmp)" ""
        $(INSTALL) -m 1777 -d $(PCP_TMP_DIR)
 endif
+       $(INSTALL) -m 775 -g $(PCP_GROUP) -d $(PCP_RUN_DIR)
        $(INSTALL) -m 755 -d $(PCP_SYSCONF_DIR)
        $(INSTALL) -m 755 -d $(PCP_BINADM_DIR)
        $(INSTALL) -m 755 -d $(PCP_SHARE_DIR)/lib


> but making changes to src/pmcd/rc_pmcd seems to do the trick (when pmcd
> is started as a system daemon). Please have a look at the attached patch.

*nod* - I think we need that stuff too ...

> diff --git a/src/pmcd/rc_pmcd b/src/pmcd/rc_pmcd
> index e4adf96..f82bbc3 100644
> --- a/src/pmcd/rc_pmcd
> +++ b/src/pmcd/rc_pmcd
> @@ -98,8 +98,10 @@ _reboot_setup()
>      #
>      if [ ! -d "$PCP_RUN_DIR" ]
>      then
> -     mkdir -p -m 755 "$PCP_RUN_DIR"
> +     mkdir -p "$PCP_RUN_DIR"
>      fi
> +    chgrp $PCP_GROUP "$PCP_RUN_DIR"
> +    chmod 777 "$PCP_RUN_DIR"

With the makefile fix, this should be able to move up within the
"if" branch.  The chmod looks fishy - needs to be "775" I think?
(and I'd do that within the mkdir still via the -m option).

>      # setup and clean up base directories and house-keeping for tracking
>      # pmlogger instances ... needs to be done here because pmcd needs the
> @@ -275,6 +277,7 @@ _shutdown()
>      then
>       [ "$1" = verbose ] && echo "$prog: pmcd not running"
>       rm -f $PCP_RUN_DIR/pmcd.pid
> +     rm -f $PCP_RUN_DIR/pmcd.socket

These could be combined into a oneline rm invocation perhaps.

cheers.

--
Nathan

<Prev in Thread] Current Thread [Next in Thread>