diff --git a/cluster/README b/cluster/README index 137ad9d..3669b7f 100644 --- a/cluster/README +++ b/cluster/README @@ -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: diff --git a/cluster/cluster-deploy.sh b/cluster/cluster-deploy.sh index 9775c65..961edc0 100755 --- a/cluster/cluster-deploy.sh +++ b/cluster/cluster-deploy.sh @@ -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 diff --git a/cluster/cluster-ping.sh b/cluster/cluster-ping.sh index 453b8b3..894d0d2 100755 --- a/cluster/cluster-ping.sh +++ b/cluster/cluster-ping.sh @@ -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." diff --git a/cluster/cluster-run.sh b/cluster/cluster-run.sh index d363599..5e12a41 100755 --- a/cluster/cluster-run.sh +++ b/cluster/cluster-run.sh @@ -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 diff --git a/cluster/cluster-ssh.sh b/cluster/cluster-ssh.sh index 9cf2e44..6cb6d16 100755 --- a/cluster/cluster-ssh.sh +++ b/cluster/cluster-ssh.sh @@ -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