Commit
182b65bfc allows to use multiple Unix socket directories: /tmp
and /var/run/postgresql. However if the system does not have
accessible /var/run/postgresql, pgpool_setup fails unless
$PGSOCKET_DIR is explicitly set. Instead of failing, this commit
allows pgpool_setup to skip inaccessible directories.
Backpatch-through: v4.5
PGBIN=${PGBIN:-"@@PGSQL_BIN_DIR@@"}
# LD_LIBRARY_PATH
LPATH=${PGLIB:-"@@PGSQL_LIB_DIR@@"}
-# unix socket directory
+# unix socket directories
PGSOCKET_DIR=${PGSOCKET_DIR:-"/tmp,/var/run/postgresql"}
+# remove inaccessible diretories from PGSOCKET_DIR
+tmp=`echo $PGSOCKET_DIR|sed "s/,/ /"`
+dir=""
+first=true
+for i in $tmp
+do
+ if [ -w $i ];then
+ if [ $first != "true" ];then
+ dir="$dir,$i"
+ else
+ dir=$i
+ fi
+ fi
+ first=false
+done
+PGSOCKET_DIR=$dir
# initdb args
INITDBARG="--no-locale -E UTF_8"
# Use replication slot