On Wed, Dec 18, 2013 at 2:08 PM, Serge Dubrouski <[email protected]> wrote:
> Lars - > > I'm a bit lost on "path=$varrun/$path". Why do we need to add $varrun if > it doesn't present? The goal is to cover the case when /run , or any other > directory, is used instead of /var/run > /run is used instead of /var/run, and /var/run is a symlink to /run. Within a distribution RUNDIR is, kind of, hardcoded, no matter what is it. So real question is to distinct usage of the plain RUNDIR and sub-directory under it, as later one requires some special handling on memory based file systems. With regards, Timur Bakeyev. > On Tue, Dec 17, 2013 at 1:48 PM, Timur I. Bakeyev <[email protected]>wrote: > >> Hi, Lars! >> >> On Tue, Dec 17, 2013 at 1:43 PM, Lars Ellenberg < >> [email protected]> wrote: >> >>> On Tue, Dec 17, 2013 at 02:39:52AM +0100, Timur I. Bakeyev wrote: >>> > Hi, guys! >>> > >>> > Any reaction, please? >>> >>> Probably best to add a helper to ocf-functions, say, >>> # require_run_dir <mode> user:group path >>> require_run_dir() >>> { >>> local mode=$1 owner=$2 path=$3 >>> local $varrun=@@__varrun_or_whatever_autofoo_calls_it__@@ >>> case $path in >>> $varrun/*) : nothing ;; >>> *) >>> path=$varrun/$path ;; >>> esac >>> test -d $path && return 0 >>> [ $(id -u) = 0 ] || return 1 >>> >>> # (or some helper function mkdir_p, in case we doubt -p is >>> available...) >>> mkdir -p $path && chown $owner $path && chmod $mode $path >>> } >>> >>> >>> Then use that early in the various resource agents, >>> maybe where the defaults are defined. >>> >>> Yes? >>> >> >> >> That would be even better! There are few more RAs that would benefit from >> that. >> >> I'd only invert the parameters, as path is mandatory, permissions are >> semi-optional and owner, as in 99% we run as root - optional. And I'd put >> some meaningful defaults for the later two parameters: >> >> local path=$1 mode=$2 owner=$3 >> : ${mode:=0755} >> : ${owner:=root} >> >> Also, as 'path' is usually is smth. like '/var/run/named' or >> '/var/run/zabbix' I'm afraid that switch will do nothing in any case. >> >> need a bit more magic, smth. like: >> >> if [ -n "${path##$varrun}" ] >> >> or alike. >> >> With best regards, >> Timur. >> >> >> >> >> >> _______________________________________________________ >> Linux-HA-Dev: [email protected] >> http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev >> Home Page: http://linux-ha.org/ >> >> > > > -- > Serge Dubrouski. > > _______________________________________________________ > Linux-HA-Dev: [email protected] > http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev > Home Page: http://linux-ha.org/ > >
_______________________________________________________ Linux-HA-Dev: [email protected] http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev Home Page: http://linux-ha.org/
