Import of pkgsrc-2016Q3

This commit is contained in:
2016-10-14 07:49:11 +02:00
committed by Lionel Sambuc
parent 9d819b6d54
commit 1242aa1e36
35952 changed files with 949749 additions and 377083 deletions

View File

@@ -0,0 +1,130 @@
#!@RCD_SCRIPTS_SHELL@
#
# $NetBSD: pgsql.sh,v 1.1 2016/02/25 21:37:37 tnn Exp $
#
# PostgreSQL database rc.d control script
#
# PROVIDE: pgsql
# REQUIRE: DAEMON
# KEYWORD: shutdown
#
# You will need to set some variables in /etc/rc.conf to start PostgreSQL:
#
# pgsql=YES
#
# Optionally, "pgsql_flags" contains options for the PostgreSQL postmaster, e.g.
# pgsql_flags="-i" # allows TCP/IP connections
# pgsql_flags="-i -l" # enables SSL connections
# pgsql_home="/path/to/home" # path to pgsql database directory
# See postmaster(1) for possible options.
if [ -f /etc/rc.subr ]; then
. /etc/rc.subr
fi
name="pgsql"
rcvar=${name}
command="@PREFIX@/bin/pg_ctl"
procname="@PREFIX@/bin/postgres"
: ${pgsql_user:=@PGUSER@}
: ${pgsql_group:=@PGGROUP@}
: ${pgsql_home:=@PGHOME@}
extra_commands="initdb reload"
initdb_cmd="pgsql_initdb"
start_precmd="pgsql_precmd"
start_cmd="pgsql_start"
restart_precmd="pgsql_precmd"
restart_cmd="pgsql_restart"
stop_cmd="pgsql_stop"
reload_cmd="pgsql_reload"
if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
load_rc_config $name
elif [ -f /etc/rc.conf ]; then
. /etc/rc.conf
fi
command_args="-w -s -D ${pgsql_home}/data -m fast -l ${pgsql_home}/errlog"
if [ -n "${pgsql_flags}" ]; then
command_args="${command_args} -o \\\"${pgsql_flags}\\\""
fi
pgsql_precmd()
{
ulimit -n 4096
if [ ! -d ${pgsql_home}/data/base ]; then
pgsql_initdb
fi
}
pgsql_initdb()
{
if [ -d ${pgsql_home}/data/base ]; then
@ECHO@ "The PostgreSQL template databases have already been initialized."
@ECHO@ "Skipping database initialization."
else
@ECHO@ "Initializing PostgreSQL databases."
@MKDIR@ -p ${pgsql_home}
@CHOWN@ ${pgsql_user} ${pgsql_home}
@CHGRP@ ${pgsql_group} ${pgsql_home}
@CHMOD@ 0700 ${pgsql_home}
doit="@SU@ -m ${pgsql_user} -c '${command} init ${command_args}'"
eval $doit
fi
}
pgsql_start()
{
@ECHO@ "Starting ${name}."
doit="@SU@ -m ${pgsql_user} -c '${command} start ${command_args}'"
eval $doit
}
pgsql_restart()
{
@ECHO@ "Restarting ${name}."
doit="@SU@ -m ${pgsql_user} -c '${command} restart ${command_args}'"
eval $doit
}
pgsql_stop()
{
@ECHO@ "Stopping ${name}."
doit="@SU@ -m ${pgsql_user} -c '${command} stop ${command_args}'"
eval $doit
}
pgsql_reload()
{
@ECHO@ "Reloading ${name}."
doit="@SU@ -m ${pgsql_user} -c '${command} reload ${command_args}'"
eval $doit
}
if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then
run_rc_command "$1"
else
pidfile="${pgsql_home}/data/postmaster.pid"
case "$1" in
initdb)
eval ${initdb_cmd}
;;
restart)
eval ${restart_precmd}
eval ${restart_cmd}
;;
stop)
if [ -r "${pidfile}" ]; then
eval ${stop_cmd}
fi
;;
reload)
eval ${reload_cmd}
;;
*)
eval ${start_precmd}
eval ${start_cmd}
;;
esac
fi

View File

@@ -0,0 +1,37 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='export'>
<service name='@SMF_PREFIX@/@SMF_NAME@' type='service' version='1'>
<create_default_instance enabled='false' />
<single_instance />
<dependency name='network' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/milestone/network:default' />
</dependency>
<dependency name='filesystem-local' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local:default' />
</dependency>
<method_context>
<method_credential user='@PGUSER@' group='@PGGROUP@' />
<method_environment>
<envvar name="LD_PRELOAD_32" value="/usr/lib/extendedFILE.so.1" />
<envvar name='PATH' value='@PREFIX@/bin:@PREFIX@/sbin:/usr/bin:/usr/sbin:/bin:/sbin'/>
</method_environment>
</method_context>
<exec_method type='method' name='start' exec='@PREFIX@/@SMF_METHOD_FILE.postgresql@ start' timeout_seconds='300' />
<exec_method type='method' name='stop' exec='@PREFIX@/@SMF_METHOD_FILE.postgresql@ stop' timeout_seconds='300' />
<exec_method type='method' name='refresh' exec='@PREFIX@/@SMF_METHOD_FILE.postgresql@ refresh' timeout_seconds='60' />
<property_group name='config' type='application'>
<propval name='data' type='astring' value='@PGHOME@/data' />
<propval name='log' type='astring' value='@VARBASE@/log/postgresql.log' />
</property_group>
<template>
<common_name>
<loctext xml:lang='C'>PostgreSQL RDBMS</loctext>
</common_name>
<documentation>
<manpage title='postgres' section='1M' manpath='@PREFIX@/@PKGMANDIR@'/>
<doc_link name='postgresql.org' uri='http://postgresql.org' />
</documentation>
</template>
</service>
</service_bundle>

View File

@@ -0,0 +1,57 @@
#!/sbin/sh
# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E SMI"
. /lib/svc/share/smf_include.sh
# SMF_FMRI is the name of the target service. This allows multiple instances
# to use the same script.
getproparg()
{ val=`svcprop -p $1 $SMF_FMRI`
[ -n "$val" ] && echo $val
}
PGBIN=@PREFIX@/bin
PGDATA=`getproparg config/data`
PGLOG=`getproparg config/log`
if [ -z $SMF_FMRI ]; then
echo "SMF framework variables are not initialized."
exit $SMF_EXIT_ERR
fi
if [ -z $PGDATA ]; then
echo "postgresql/data property not set"
exit $SMF_EXIT_ERR_CONFIG
fi
if [ -z $PGLOG ]; then
echo "postgresql/log property not set"
exit $SMF_EXIT_ERR_CONFIG
fi
case "$1" in
'start')
ulimit -n 10240
$PGBIN/pg_ctl -D $PGDATA -l $PGLOG start
;;
'stop')
$PGBIN/pg_ctl -D $PGDATA stop
;;
'refresh')
$PGBIN/pg_ctl -D $PGDATA reload
;;
*)
echo $"Usage: $0 {start|refresh}"
exit 1
;;
esac
exit $SMF_EXIT_OK