=== removed file 'zsh-functions/zsv_defaults_postgresql' --- zsh-functions/zsv_defaults_postgresql 2014-06-27 23:37:39 +0000 +++ zsh-functions/zsv_defaults_postgresql 1970-01-01 00:00:00 +0000 @@ -1,92 +0,0 @@ -if [[ $zsv_name == *.* ]]; then - # slotted install ala gentoo - slot=${zsv_name#*.} - run=( /usr/lib/postgresql-$slot/bin/postmaster ) - configfile=/etc/postgresql-$slot/postgresql.conf - pg_data_dir=/var/lib/postgresql/$slot/data -else - run=( postmaster ) - # pg_data_dir=/var/lib/postgresql/data - # configfile=$pg_data_dir/postgresql.conf - configfile=/var/lib/postgresql/data/postgresql.conf -fi - -parse_postgresql_config() { - typeset -gA conf - : ${PGDATA:=$configfile:h} - : ${pg_user:=postgres} - [[ -r $configfile ]] || exit 1 - - while read key val; do - [[ $key == \#* ]] && continue - [[ $val == '=*' ]] && val=${val/#=[$IFS]#} - conf[$key]=${(Q)val} - done <$configfile - - reload_files+=( - $configfile - ${conf[hba_file]:-$PGDATA/pg_hba.conf} - ${conf[ident_file]:-$PGDATA/pg_ident.conf} - ) - - # fill in defaults - : ${conf[data_directory]:=$PGDATA} - : ${conf[port]:=5432} - : ${conf[unix_socket_directory]:=/tmp} - : ${conf[unix_socket_directories]:=$conf[unix_socket_directory]} - - # get values - : ${pg_data_dir:=$conf[data_directory]} - : ${pg_port:=$conf[port]} - : ${pg_sockdir:=$conf[unix_socket_directories]} - - # add overrides to default values to $args - [[ $configfile != $PGDATA/postgresql.conf ]] && \ - args+=( --config-file=$configfile ) - - [[ $pg_data_dir != $conf[data_directory] ]] && \ - args+=( --data-directory=$pg_data_dir ) - - [[ $pg_port != $conf[port] ]] && \ - args+=( --port=$pg_port ) - - [[ $pg_sockdir != $conf[unix_socket_directories] ]] && \ - args+=( -k $pg_sockdir ) - - cwd=$PGDATA - run=( chpst -u $pguser: $run -D $PGDATA ) - pg_socket=${pg_sockdir%/}/.s.PGSQL.${pg_port} -} - -cond() { - [[ -e $configfile ]] -} - -do_check() { - parse_postgresql_config - zsv_check_unix $pg_socket -} -checkf do_check - -zsv_run_postgresql() { - parse_postgresql_config - - # TODO: support multiple socket directories - if ! [[ -w $pg_sockdir ]]; then - mkdir -p $pg_sockdir || exit $? - chown $pg_user: ${socket_path} - chmod 0775 $pg_sockdir - fi - - # check for stale socket - if [[ -e $pg_socket ]]; then - if zsv_check_unix $pg_socket; then - exit 2 - else - rm -f $pg_socket - fi - fi - - zsv_generic -} -# vim: ft=zsh noet ts=4 sts=4 sw=4