[cluster] Support XDG Base Directory Specification
Use $XDG_CONFIG_HOME if set, instead of $HOME/.config.
This commit is contained in:
parent
b97bf7ed14
commit
4d5efe91cc
|
@ -4,13 +4,14 @@ fping. They all take as first and mandatory positional argument a host
|
|||
list name “NAME”; the list will be searched according to the following
|
||||
pattern:
|
||||
|
||||
``` $HOME/.config/cluster/NAME.lst
|
||||
``` $XDG_CONFIG_HOME/cluster/NAME.lst
|
||||
|
||||
($XDG_CONFIG_HOME being equivalent to $HOME/.config if unset.)
|
||||
For example, one can call the cluster-ping.sh script typing:
|
||||
|
||||
``` cluster-ping my_hosts
|
||||
|
||||
to use the hosts' file $HOME/.config/cluster/my_hosts.lst
|
||||
to use the hosts' file $XDG_CONFIG_HOME/cluster/my_hosts.lst
|
||||
|
||||
The format of such a .lst file is one line per host name or IP address,
|
||||
for example:
|
||||
|
|
|
@ -96,7 +96,10 @@ fi
|
|||
|
||||
# Hosts' list file
|
||||
HOSTS_LIST_NAME="$1"
|
||||
HOSTS="$HOME/.config/cluster/${HOSTS_LIST_NAME}.lst"
|
||||
if [ "$XDG_CONFIG_HOME" = "" ] ; then
|
||||
XDG_CONFIG_HOME="$HOME/.config"
|
||||
fi
|
||||
HOSTS="$XDG_CONFIG_HOME/cluster/${HOSTS_LIST_NAME}.lst"
|
||||
shift
|
||||
echo "Using file '$HOSTS' as hosts' list."
|
||||
if [ ! -f "$HOSTS" ] ; then
|
||||
|
|
|
@ -17,7 +17,10 @@ if [ $# -ne 1 ] ; then
|
|||
fi
|
||||
|
||||
# Hosts' list file
|
||||
HOSTS="$HOME/.config/cluster/$1.lst"
|
||||
if [ "$XDG_CONFIG_HOME" = "" ] ; then
|
||||
XDG_CONFIG_HOME="$HOME/.config"
|
||||
fi
|
||||
HOSTS="$XDG_CONFIG_HOME/cluster/$1.lst"
|
||||
echo "Using file '$HOSTS' as hosts' list."
|
||||
if [ ! -f "$HOSTS" ] ; then
|
||||
echo "The hosts' list file doesn't exist or is not a regular file."
|
||||
|
|
|
@ -44,7 +44,10 @@ if [ "$PSSH" = "" ] ; then
|
|||
fi
|
||||
|
||||
# Hosts' list file
|
||||
HOSTS="$HOME/.config/cluster/$1.lst"
|
||||
if [ "$XDG_CONFIG_HOME" = "" ] ; then
|
||||
XDG_CONFIG_HOME="$HOME/.config"
|
||||
fi
|
||||
HOSTS="$XDG_CONFIG_HOME/cluster/$1.lst"
|
||||
shift
|
||||
echo "Using file '$HOSTS' as hosts' list."
|
||||
if [ ! -f "$HOSTS" ] ; then
|
||||
|
|
|
@ -35,7 +35,10 @@ elif [ $# -ne 1 ] ; then
|
|||
fi
|
||||
|
||||
# Hosts' list file
|
||||
HOSTS="$HOME/.config/cluster/$1.lst"
|
||||
if [ "$XDG_CONFIG_HOME" = "" ] ; then
|
||||
XDG_CONFIG_HOME="$HOME/.config"
|
||||
fi
|
||||
HOSTS="$XDG_CONFIG_HOME/cluster/$1.lst"
|
||||
shift
|
||||
echo "Using file '$HOSTS' as hosts' list."
|
||||
if [ ! -f "$HOSTS" ] ; then
|
||||
|
|
Loading…
Reference in New Issue