]> Frank Brehm's Git Trees - config/samara/etc.git/commitdiff
saving uncommitted changes in /etc prior to emerge run
authorfbrehm <fbrehm@samara.profitbricks.localdomain>
Wed, 6 Jun 2012 21:55:40 +0000 (23:55 +0200)
committerroot <root@samara.profitbricks.localdomain>
Wed, 6 Jun 2012 21:55:40 +0000 (23:55 +0200)
.etckeeper
eselect/postgresql/slots/9.1/._cfg0000_server [new file with mode: 0644]
init.d/._cfg0000_postgresql-9.1 [new file with mode: 0755]

index 939a02859f8ee0ac3ce69da3fe002707e1e86e0c..b91fa22b5a6186d69905da55b6539f0fef4e6049 100755 (executable)
@@ -848,6 +848,7 @@ maybe chmod 0755 './eselect/postgresql/slots'
 maybe chmod 0755 './eselect/postgresql/slots/9.1'
 maybe chmod 0644 './eselect/postgresql/slots/9.1/._cfg0000_base'
 maybe chmod 0644 './eselect/postgresql/slots/9.1/._cfg0000_docs'
+maybe chmod 0644 './eselect/postgresql/slots/9.1/._cfg0000_server'
 maybe chmod 0644 './eselect/postgresql/slots/9.1/base'
 maybe chmod 0644 './eselect/postgresql/slots/9.1/docs'
 maybe chmod 0644 './eselect/postgresql/slots/9.1/server'
@@ -1177,6 +1178,7 @@ maybe chmod 0644 './imlib/im_palette.pal'
 maybe chmod 0644 './imlib/imrc'
 maybe chmod 0755 './init.d'
 maybe chmod 0755 './init.d/._cfg0000_acpid'
+maybe chmod 0755 './init.d/._cfg0000_postgresql-9.1'
 maybe chmod 0755 './init.d/NetworkManager'
 maybe chmod 0755 './init.d/acpid'
 maybe chmod 0755 './init.d/aiccu'
diff --git a/eselect/postgresql/slots/9.1/._cfg0000_server b/eselect/postgresql/slots/9.1/._cfg0000_server
new file mode 100644 (file)
index 0000000..8805b8c
--- /dev/null
@@ -0,0 +1 @@
+postgres_ebuilds="${postgres_ebuilds} postgresql-server-9.1.4"
diff --git a/init.d/._cfg0000_postgresql-9.1 b/init.d/._cfg0000_postgresql-9.1
new file mode 100755 (executable)
index 0000000..a7616fd
--- /dev/null
@@ -0,0 +1,141 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+extra_started_commands="reload"
+
+get_config() {
+    [ -f ${PGDATA}/postgresql.conf ] || return 1
+
+    eval echo $(sed -e 's:#.*::' ${PGDATA}/postgresql.conf | awk '$1 == "'$1'" { print $2 == "=" ? $3 : $2 }')
+}
+
+depend() {
+    use net
+    provide postgresql
+
+    if [ "$(get_config log_destination)" = "syslog" ]; then
+               use logger
+    fi
+}
+
+configured_port=$(get_config port)
+: ${configured_port:=${PGPORT}}
+socket_path=$(get_config unix_socket_path)
+: ${socket_path:=/run/postgresql}
+
+checkconfig() {
+       # Check that DATA_DIR has been set and exists
+       if [ -z ${DATA_DIR} ] ; then
+               eerror "DATA_DIR not set"
+               eerror "HINT: Perhaps you need to update /etc/conf.d/postgresql-9.1"
+       fi
+       if [ ! -d ${DATA_DIR} ] ; then
+               eerror "Directory not found: ${DATA_DIR}"
+               eerror "HINT: Ensure that DATA_DIR points to the right path."
+               eerror "HINT: Or perhaps you need to create the database cluster:"
+               eerror "    emerge --config dev-db/postgresql-server:9.1"
+               return 1
+       fi
+
+       # Check for the existence of and PostgreSQL's ability to read the config files.
+       if [ ! -f ${PGDATA}/postgresql.conf -o \
+               ! -f ${PGDATA}/pg_hba.conf -o ! -f ${PGDATA}/pg_ident.conf ] ; then
+               eerror "The following file(s) were not found in ${PGDATA}:"
+               [ ! -f ${PGDATA}/postgresql.conf ] && eerror "    postgresql.conf"
+               [ ! -f ${PGDATA}/pg_hba.conf ] && eerror "    pg_hba.conf"
+               [ ! -f ${PGDATA}/pg_ident.conf ] && eerror "    pg_ident.conf"
+               eerror "HINT: Try:"
+               eerror "    mv ${DATA_DIR}/*.conf ${PGDATA}"
+               return 1
+       fi
+
+       local file
+       local failed
+       for file in pg_hba pg_ident postgresql ; do
+               file="${PGDATA}/${file}.conf"
+               su postgres -c "test -r ${file}" || failed="${file} ${failed}"
+       done
+       if [ -n "${failed}" ] ; then
+               eerror "The following file(s) are not readable by 'postgres':"
+               local x
+               for x in ${failed} ; do
+                       eerror "    ${x}"
+               done
+               eerror "HINT: Try: 'chmod 644 ${PGDATA}/*.conf'"
+               return 1
+       fi
+
+       checkpath -d -m 0770 -o postgres:postgres ${socket_path}
+       if [ -e ${socket_path}/.s.PGSQL.${configured_port} ] ; then
+               eerror "Socket conflict."
+               eerror "A server is already listening on:"
+               eerror "    ${socket_path}/.s.PGSQL.${configured_port}"
+               eerror "HINT: Change PGPORT to listen on a different socket."
+               return 1
+       fi
+}
+
+start() {
+       checkconfig || return 1
+
+       ebegin "Starting PostgreSQL"
+
+       rm -f ${DATA_DIR}/postmaster.pid
+
+       local extraenv
+       local x
+       for x in ${PG_EXTRA_ENV} ; do
+               extraenv="${extraenv} --env ${x}"
+       done
+
+       start-stop-daemon --start \
+               --user postgres \
+               --exec /usr/lib/postgresql-9.1/bin/postgres \
+               --env "PGPORT=${configured_port}" \
+               ${extraenv} \
+               --wait $((${START_TIMEOUT}*1000)) \
+               --pidfile ${DATA_DIR}/postmaster.pid \
+               -- -D ${PGDATA} --data-directory=${DATA_DIR} --silent-mode=true ${PGOPTS}
+       local retval=$?
+
+       if [ $retval -ne 0 ] ; then
+               eerror "Check the PostgreSQL 9.1 log for a detailed explanation of the above error."
+               eend $retval
+               return $retval
+       fi
+
+       eend $retval
+}
+
+stop() {
+       local seconds=$(( ${NICE_TIMEOUT} + ${RUDE_TIMEOUT} + ${FORCE_TIMEOUT} ))
+       ebegin "Stopping PostgreSQL (this can take up to ${seconds} seconds)"
+
+       local retval
+       local retries=SIGTERM/${NICE_TIMEOUT}
+
+       if [ "${RUDE_QUIT}" != "NO" ] ; then
+               einfo "RUDE_QUIT enabled."
+               retries="${retries}/SIGINT/${RUDE_TIMEOUT}"
+       fi
+       if [ "${FORCE_QUIT}" = "YES" ] ; then
+               einfo "FORCE_QUIT enabled."
+               ewarn "A recover-run might be executed on next startup."
+               retries="${retries}/SIGQUIT/${FORCE_TIMEOUT}"
+       fi
+
+       start-stop-daemon --stop \
+               --exec /usr/lib/postgresql-9.1/bin/postgres \
+               --retry ${retries} \
+               --pidfile ${DATA_DIR}/postmaster.pid
+
+       eend
+}
+
+reload() {
+       ebegin "Reloading PostgreSQL configuration"
+       kill -HUP $(head -n1 ${DATA_DIR}/postmaster.pid)
+       eend $?
+}