aboutsummaryrefslogtreecommitdiffstats
path: root/community/znc/znc.initd
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2018-07-18 08:02:59 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2018-07-18 08:05:06 +0000
commitab17ebc5ee95aaf5dd80dcd83e9ad004434ce475 (patch)
tree83fe86f9c17c1ea45d072f7c24a8c2b3496459c0 /community/znc/znc.initd
parent632ac8c24a84ce04b05d979594931855364cad45 (diff)
downloadaports-ab17ebc5ee95aaf5dd80dcd83e9ad004434ce475.tar.bz2
aports-ab17ebc5ee95aaf5dd80dcd83e9ad004434ce475.tar.xz
main/znc: move to community
Diffstat (limited to 'community/znc/znc.initd')
-rw-r--r--community/znc/znc.initd47
1 files changed, 47 insertions, 0 deletions
diff --git a/community/znc/znc.initd b/community/znc/znc.initd
new file mode 100644
index 0000000000..b6c52791f6
--- /dev/null
+++ b/community/znc/znc.initd
@@ -0,0 +1,47 @@
+#!/sbin/openrc-run
+
+# Upper case variables are here for backward compatibility.
+: ${command_user:=${ZNC_USER:-"znc"}}
+: ${datadir:=${ZNC_CONF:-"/var/lib/znc"}}
+
+extra_started_commands="reload save"
+extra_stopped_commands="setup"
+description_reload="Reload ZNC configuration from disk"
+description_save="Save ZNC configuration to disk"
+description_setup="Interactively create a new config"
+
+command="/usr/bin/znc"
+command_args="-f -d $datadir ${command_args:-}"
+command_background="yes"
+pidfile="/run/$RC_SVCNAME.pid"
+
+depend() {
+ need net
+}
+
+start_pre() {
+ if [ ! -f "$datadir"/configs/znc.conf ]; then
+ eerror "File $datadir/configs/znc.conf does not exist!"
+ eerror "Run 'rc-service $RC_SVCNAME setup' to create ZNC configuration."
+ return 1
+ fi
+}
+
+reload() {
+ ebegin "Reloading ZNC configuration from disk"
+ start-stop-daemon --signal SIGHUP --pidfile "$pidfile"
+ eend $?
+}
+
+save() {
+ ebegin "Saving ZNC configuration to disk"
+ start-stop-daemon --signal SIGUSR1 --pidfile "$pidfile"
+ eend $?
+}
+
+setup() {
+ ebegin "Creating a new ZNC config"
+ checkpath -d -m 750 -o "$command_user" "$datadir"
+ su "$command_user" -s /bin/sh -c "$command $command_args --makeconf"
+ eend $?
+}