=== modified file 'zsh-functions/confz_postgresql_init' --- zsh-functions/confz_postgresql_init 2014-06-27 11:02:28 +0000 +++ zsh-functions/confz_postgresql_init 2014-06-27 09:43:35 +0000 @@ -4,32 +4,6 @@ # confz functions for PostgreSQL # -config-protect-mv() { - local n dst base - if [[ -d $2 ]]; then - dst=${2%/}/$1:t - else - dst=$2 - fi - - if ! [[ -e $dst ]]; then - mv $1 $dst - return $? - fi - - n=0 - base=$dst:t - dst="$dst:h/$(printf "._cfg%04d_%s" $n $base)" - - while [[ -e $dst ]]; do - n=$[ $n + 1 ] - dst="$dst:h/$(printf "._cfg%04d_%s" $n $base)" - (( $n > 9999 )) && die "can not config-protect $dst:t/$base" - done - - mv $1 $dst -} - confz_postgresql_cluster_check() { checkvars data_dir defvar owner postgres @@ -46,16 +20,7 @@ chown -Rf $vars[owner]: $vars[data_dir] || return $? chmod 0700 $vars[data_dir] || return $? su $vars[owner] -c "$vars[initdb] -L ${(qqq)vars[locale]} -D ${(qqq)vars[data_dir]} $vars[initdb_opts]" || return $? - - local cfg - - if ! [[ $vars[data_dir] == $vars[pgdata] ]]; then - for cfg in $vars[data_dir]/*.conf(N); do - config-protect-mv $cfg $vars[pgdata]/ - done - fi - - return 0 + [[ $vars[data_dir] == $vars[pgdata] ]] || mv $vars[data_dir]/*.conf $vars[pgdata]/ } confz_postgresql_cluster_slot_check() {