diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2021-04-28 20:21:43 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2021-04-28 20:21:43 +0100 |
commit | 40aaaa64e86ba6710bbeb31c4615a6ce80e75e11 (patch) | |
tree | 758c221bad35c9288d0bd6df9c7dfc226728e52c /www-apps/nextcloud-notify_push/files | |
parent | 8d5dbd847cbc704a6a06405856e94b461011afe3 (diff) |
gentoo resync : 28.04.2021
Diffstat (limited to 'www-apps/nextcloud-notify_push/files')
5 files changed, 443 insertions, 0 deletions
diff --git a/www-apps/nextcloud-notify_push/files/nextcloud-notify_push-r1.confd b/www-apps/nextcloud-notify_push/files/nextcloud-notify_push-r1.confd new file mode 100644 index 000000000000..31b66e6009f7 --- /dev/null +++ b/www-apps/nextcloud-notify_push/files/nextcloud-notify_push-r1.confd @@ -0,0 +1,87 @@ +# /etc/conf.d/nextcloud-notify_push + +# User to run instance as +#NOTIFY_PUSH_USER=nobody + +# Group to run instance as +#NOTIFY_PUSH_GROUP=nobody + +# Nextcloud config file +# Set this to the Nextcloud configuration file this +# instance is used for. +NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE="/path/to/your/nextcloud/config.php" + +# Data Source Name (DSN) to the Nextcloud database +# E.g. mysql://user:password@db_host/db_name +# +# Note: If you set NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE, notify_push +# will read this information from config.php file. +#DATABASE_URL="" + +# Database prefix of the used Nextcloud database +# +# Note: If you set NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE, notify_push +# will read this information from config.php file. +#DATABASE_PREFIX="oc_" + +# Redis connection string +# To use notify_push, used Nextcloud instance must be configured +# to use Redis. Use this option to point to the same Redis instance. +# +# Note: If you set NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE, notify_push +# will read this information from config.php file. +#REDIS_URL="" + +# URL to used Nextcloud instance +# +# Note: If you set NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE, notify_push +# will read this information from config.php file. +#NEXTCLOUD_URL="" + +# IP address notify_push will bind to +#BIND="127.0.0.1" + +# Port notify_push will listen on +#PORT="7867" + +# Socket notify_push will listen on +SOCKET_PATH="/run/${SVCNAME}/notify_push.socket" + +# Socket permissions +#SOCKET_PERMISSIONS=0666 + +# Port notify_push will listen on for metrics +#METRICS_PORT="9867" + +# Socket notify_push will listen on for metrics +#METRICS_SOCKET_PATH="/run/${SVCNAME}/notify_push_metrics.socket" + +# You can use this configuration option to pass additional options to the +# start-stop-daemon, see start-stop-daemon(8) for more details. +# Per default we wait 1000ms after we have started the service to ensure +# that the daemon is really up and running. +#NOTIFY_PUSH_SSDARGS="--wait 1000" + +# The termination timeout (start-stop-daemon parameter "retry") ensures +# that the service will be terminated within a given time (30 + 5 seconds +# per default) when you are stopping the service. +#NOTIFY_PUSH_TERMTIMEOUT="TERM/30/KILL/5" + +# Options to notify_push +# See `nextcloud-notify_push --help` for more details +#NOTIFY_PUSH_OPTS="" + +# Set log level +# E.g. error, warn, info, debug +#LOG="" + +# By default, a background service in OpenRC will produce no output. +# Uncomment the following option to log output to a file. +#LOGFILE="/var/log/${SVCNAME}.log" + +# Configure service dependencies +# notify_push needs to connect to same mysql and redis instance +# like Nextcloud. By default we assume that Nextcloud is running +# on same host. Adjust when using different instances or when +# notify_push isn't using any listed local service. +RC_USE="mysql redis" diff --git a/www-apps/nextcloud-notify_push/files/nextcloud-notify_push-r1.init b/www-apps/nextcloud-notify_push/files/nextcloud-notify_push-r1.init new file mode 100644 index 000000000000..fa111e3ca4a9 --- /dev/null +++ b/www-apps/nextcloud-notify_push/files/nextcloud-notify_push-r1.init @@ -0,0 +1,128 @@ +#!/sbin/openrc-run +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# shellcheck disable=SC2034 + +: "${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE:=}" +: "${NOTIFY_PUSH_PIDFILE:=/run/${SVCNAME}.pid}" +: "${NOTIFY_PUSH_SSDARGS:=--wait 1000}" +: "${NOTIFY_PUSH_TERMTIMEOUT:=TERM/30/KILL/5}" +: "${NOTIFY_PUSH_USER:=nobody}" +: "${NOTIFY_PUSH_GROUP:=nobody}" + +command="/usr/bin/nextcloud-notify_push" +command_args="${NOTIFY_PUSH_OPTS}" +command_background="yes" +command_user="${NOTIFY_PUSH_USER}:${NOTIFY_PUSH_GROUP}" +pidfile="${NOTIFY_PUSH_PIDFILE}" +retry="${NOTIFY_PUSH_TERMTIMEOUT}" +start_stop_daemon_args="${NOTIFY_PUSH_SSDARGS}" + +description="Push daemon for Nextcloud clients" + +depend() { + use dns +} + +start_pre() { + local has_errors= + + if [ -n "${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}" ] ; then + if ! su -s /bin/sh -c "test -r \"${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}\"" ${NOTIFY_PUSH_USER} 1>/dev/null 2>&1 ; then + eerror "Config file \"${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}\" does not exist or is not accessible for user \"${NOTIFY_PUSH_USER}\"!" + return 1 + fi + + command_args="${command_args} \"${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}\"" + fi + + # Required options when no config file was specified + if [ -n "${DATABASE_URL}" ] ; then + export DATABASE_URL + elif [ -z "${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}" ] && [ -z "${DATABASE_URL}" ] ; then + has_errors=yes + eerror "DATABASE_URL not set!" + fi + + if [ -n "${DATABASE_PREFIX}" ] ; then + export DATABASE_PREFIX + elif [ -z "${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}" ] && [ -z "${DATABASE_PREFIX}" ] ; then + has_errors=yes + eerror "DATABASE_PREFIX not set!" + fi + + if [ -n "${REDIS_URL}" ] ; then + export REDIS_URL + elif [ -z "${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}" ] && [ -z "${REDIS_URL}" ] ; then + has_errors=yes + eerror "REDIS_URL not set!" + fi + + if [ -z "${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}" ] && [ -z "${SOCKET_PATH}" ] && [ -z "${PORT}" ] ; then + has_errors=yes + eerror "Neither SOCKET_PATH nor PORT is set!" + elif [ -n "${SOCKET_PATH}" ] ; then + checkpath -q -d -o ${NOTIFY_PUSH_USER}:${NOTIFY_PUSH_GROUP} -m 0770 "$(dirname "${SOCKET_PATH}")" + service_set_value SOCKET_PATH "${SOCKET_PATH}" + export SOCKET_PATH + elif [ -n "${PORT}" ] ; then + export PORT + fi + + # Optional options + if [ -n "${ALLOW_SELF_SIGNED}" ] ; then + export ALLOW_SELF_SIGNED + fi + + if [ -n "${BIND}" ] ; then + export BIND + fi + + if [ -n "${LOG}" ] ; then + export LOG + fi + + # shellcheck disable=SC2154 + if [ -n "${LOGFILE}" ] ; then + checkpath -q -f -o ${NOTIFY_PUSH_USER}:adm -m 0644 "${LOGFILE}" + output_log="${LOGFILE}" + error_log="${LOGFILE}" + fi + + if [ -n "${METRICS_PORT}" ] ; then + export METRICS_PORT + fi + + if [ -n "${METRICS_SOCKET_PATH}" ] ; then + checkpath -q -d -o ${NOTIFY_PUSH_USER}:${NOTIFY_PUSH_GROUP} -m 0770 "$(dirname "${METRICS_SOCKET_PATH}")" + service_set_value METRICS_SOCKET_PATH "${METRICS_SOCKET_PATH}" + export METRICS_SOCKET_PATH + fi + + if [ -n "${SOCKET_PERMISSIONS}" ] ; then + export SOCKET_PERMISSIONS + fi + + if [ -n "${has_errors}" ] ; then + eerror "" + eerror "Either set the variable above or specify NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE" + eerror "in /etc/conf.d/${SVCNAME}!" + return 1 + fi +} + +stop_post() { + local old_socket= + for old_socket in SOCKET_PATH METRICS_SOCKET_PATH ; do + old_socket=$(service_get_value ${old_socket}) + [ -n "${old_socket}" ] || continue + [ -e "${old_socket}" ] || continue + + ebegin "Cleaning up stale socket \"${old_socket}\"" + rm "${old_socket}" + eend $? + done + + return 0 +} diff --git a/www-apps/nextcloud-notify_push/files/nextcloud-notify_push.confd b/www-apps/nextcloud-notify_push/files/nextcloud-notify_push.confd new file mode 100644 index 000000000000..ccb2c5b5c766 --- /dev/null +++ b/www-apps/nextcloud-notify_push/files/nextcloud-notify_push.confd @@ -0,0 +1,84 @@ +# /etc/conf.d/nextcloud-notify_push + +# User to run instance as +#NOTIFY_PUSH_USER=nobody + +# Group to run instance as +#NOTIFY_PUSH_GROUP=nobody + +# Nextcloud config file +# Set this to the Nextcloud configuration file this +# instance is used for. +NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE="/path/to/your/nextcloud/config.php" + +# Data Source Name (DSN) to the Nextcloud database +# E.g. mysql://user:password@db_host/db_name +# +# Note: If you set NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE, notify_push +# will read this information from config.php file. +#DATABASE_URL="" + +# Database prefix of the used Nextcloud database +# +# Note: If you set NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE, notify_push +# will read this information from config.php file. +#DATABASE_PREFIX="oc_" + +# Redis connection string +# To use notify_push, used Nextcloud instance must be configured +# to use Redis. Use this option to point to the same Redis instance. +# +# Note: If you set NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE, notify_push +# will read this information from config.php file. +#REDIS_URL="" + +# URL to used Nextcloud instance +# +# Note: If you set NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE, notify_push +# will read this information from config.php file. +#NEXTCLOUD_URL="" + +# IP address notify_push will bind to +#BIND="127.0.0.1" + +# Port notify_push will listen on +#PORT="7867" + +# Socket notify_push will listen on +SOCKET_PATH="/run/${SVCNAME}/notify_push.socket" + +# Port notify_push will listen on for metrics +#METRICS_PORT="9867" + +# Socket notify_push will listen on for metrics +#METRICS_SOCKET_PATH="/run/${SVCNAME}/notify_push_metrics.socket" + +# You can use this configuration option to pass additional options to the +# start-stop-daemon, see start-stop-daemon(8) for more details. +# Per default we wait 1000ms after we have started the service to ensure +# that the daemon is really up and running. +#NOTIFY_PUSH_SSDARGS="--wait 1000" + +# The termination timeout (start-stop-daemon parameter "retry") ensures +# that the service will be terminated within a given time (30 + 5 seconds +# per default) when you are stopping the service. +#NOTIFY_PUSH_TERMTIMEOUT="TERM/30/KILL/5" + +# Options to notify_push +# See `nextcloud-notify_push --help` for more details +#NOTIFY_PUSH_OPTS="" + +# Set log level +# E.g. error, warn, info, debug +#LOG="" + +# By default, a background service in OpenRC will produce no output. +# Uncomment the following option to log output to a file. +#LOGFILE="/var/log/${SVCNAME}.log" + +# Configure service dependencies +# notify_push needs to connect to same mysql and redis instance +# like Nextcloud. By default we assume that Nextcloud is running +# on same host. Adjust when using different instances or when +# notify_push isn't using any listed local service. +RC_USE="mysql redis" diff --git a/www-apps/nextcloud-notify_push/files/nextcloud-notify_push.init b/www-apps/nextcloud-notify_push/files/nextcloud-notify_push.init new file mode 100644 index 000000000000..1a3d9c130349 --- /dev/null +++ b/www-apps/nextcloud-notify_push/files/nextcloud-notify_push.init @@ -0,0 +1,124 @@ +#!/sbin/openrc-run +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +# shellcheck disable=SC2034 + +: "${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE:=}" +: "${NOTIFY_PUSH_PIDFILE:=/run/${SVCNAME}.pid}" +: "${NOTIFY_PUSH_SSDARGS:=--wait 1000}" +: "${NOTIFY_PUSH_TERMTIMEOUT:=TERM/30/KILL/5}" +: "${NOTIFY_PUSH_USER:=nobody}" +: "${NOTIFY_PUSH_GROUP:=nobody}" + +command="/usr/bin/nextcloud-notify_push" +command_args="${NOTIFY_PUSH_OPTS}" +command_background="yes" +command_user="${NOTIFY_PUSH_USER}:${NOTIFY_PUSH_GROUP}" +pidfile="${NOTIFY_PUSH_PIDFILE}" +retry="${NOTIFY_PUSH_TERMTIMEOUT}" +start_stop_daemon_args="${NOTIFY_PUSH_SSDARGS}" + +description="Push daemon for Nextcloud clients" + +depend() { + use dns +} + +start_pre() { + local has_errors= + + if [ -n "${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}" ] ; then + if ! su -s /bin/sh -c "test -r \"${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}\"" ${NOTIFY_PUSH_USER} 1>/dev/null 2>&1 ; then + eerror "Config file \"${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}\" does not exist or is not accessible for user \"${NOTIFY_PUSH_USER}\"!" + return 1 + fi + + command_args="${command_args} \"${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}\"" + fi + + # Required options when no config file was specified + if [ -n "${DATABASE_URL}" ] ; then + export DATABASE_URL + elif [ -z "${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}" ] && [ -z "${DATABASE_URL}" ] ; then + has_errors=yes + eerror "DATABASE_URL not set!" + fi + + if [ -n "${DATABASE_PREFIX}" ] ; then + export DATABASE_PREFIX + elif [ -z "${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}" ] && [ -z "${DATABASE_PREFIX}" ] ; then + has_errors=yes + eerror "DATABASE_PREFIX not set!" + fi + + if [ -n "${REDIS_URL}" ] ; then + export REDIS_URL + elif [ -z "${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}" ] && [ -z "${REDIS_URL}" ] ; then + has_errors=yes + eerror "REDIS_URL not set!" + fi + + if [ -z "${NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE}" ] && [ -z "${SOCKET_PATH}" ] && [ -z "${PORT}" ] ; then + has_errors=yes + eerror "Neither SOCKET_PATH nor PORT is set!" + elif [ -n "${SOCKET_PATH}" ] ; then + checkpath -q -d -o ${NOTIFY_PUSH_USER}:${NOTIFY_PUSH_GROUP} -m 0770 "$(dirname "${SOCKET_PATH}")" + service_set_value SOCKET_PATH "${SOCKET_PATH}" + export SOCKET_PATH + elif [ -n "${PORT}" ] ; then + export PORT + fi + + # Optional options + if [ -n "${ALLOW_SELF_SIGNED}" ] ; then + export ALLOW_SELF_SIGNED + fi + + if [ -n "${BIND}" ] ; then + export BIND + fi + + if [ -n "${LOG}" ] ; then + export LOG + fi + + # shellcheck disable=SC2154 + if [ -n "${LOGFILE}" ] ; then + checkpath -q -f -o ${NOTIFY_PUSH_USER}:adm -m 0644 "${LOGFILE}" + output_log="${LOGFILE}" + error_log="${LOGFILE}" + fi + + if [ -n "${METRICS_PORT}" ] ; then + export METRICS_PORT + fi + + if [ -n "${METRICS_SOCKET_PATH}" ] ; then + checkpath -q -d -o ${NOTIFY_PUSH_USER}:${NOTIFY_PUSH_GROUP} -m 0770 "$(dirname "${METRICS_SOCKET_PATH}")" + service_set_value METRICS_SOCKET_PATH "${METRICS_SOCKET_PATH}" + export METRICS_SOCKET_PATH + fi + + if [ -n "${has_errors}" ] ; then + eerror "" + eerror "Either set the variable above or specify NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE" + eerror "in /etc/conf.d/${SVCNAME}!" + return 1 + fi +} + +stop_post() { + local old_socket= + for old_socket in SOCKET_PATH METRICS_SOCKET_PATH ; do + old_socket=$(service_get_value ${old_socket}) + [ -n "${old_socket}" ] || continue + [ -e "${old_socket}" ] || continue + + ebegin "Cleaning up stale socket \"${old_socket}\"" + rm "${old_socket}" + eend $? + done + + return 0 +} diff --git a/www-apps/nextcloud-notify_push/files/nextcloud-notify_push.service b/www-apps/nextcloud-notify_push/files/nextcloud-notify_push.service new file mode 100644 index 000000000000..27fc4e827df0 --- /dev/null +++ b/www-apps/nextcloud-notify_push/files/nextcloud-notify_push.service @@ -0,0 +1,20 @@ +[Unit] +Description=Push daemon for Nextcloud clients +After=mysqld.service +After=redis.service + +[Service] +Type=simple +Environment=NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE= +EnvironmentFile=-/etc/conf.d/nextcloud-notify_push +ExecStart=/usr/bin/nextcloud-notify_push $NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE +Restart=on-failure + +# Adjust user/group to match Nextcloud configuration. +# E.g. make sure that User is able to access NOTIFY_PUSH_NEXTCLOUD_CONFIGFILE +# when used; make sure that webserver is in Group when using sockets +User=nobody +Group=nobody + +[Install] +WantedBy=multi-user.target |