33 lines
672 B
Text
33 lines
672 B
Text
|
|
#!/sbin/openrc-run
|
||
|
|
# Copyright 2026 Shin'ya Minazuki
|
||
|
|
supervisor="supervise-daemon"
|
||
|
|
|
||
|
|
command="/usr/bin/writefreely"
|
||
|
|
command_args="-c /etc/writefreely/config.ini"
|
||
|
|
command_user="writefreely:writefreely"
|
||
|
|
command_background="true"
|
||
|
|
extra_commands="genconf initdb"
|
||
|
|
pidfile="/run/${RC_SVCNAME}.pid"
|
||
|
|
|
||
|
|
depend() {
|
||
|
|
want caddy httpd nginx
|
||
|
|
}
|
||
|
|
|
||
|
|
genconf() {
|
||
|
|
ebegin "Generating configuration file..."
|
||
|
|
${command} ${command_args} config gen
|
||
|
|
eend $?
|
||
|
|
}
|
||
|
|
|
||
|
|
initdb() {
|
||
|
|
ebegin "Initializing database..."
|
||
|
|
${command} ${command_args} --init-db
|
||
|
|
eend $?
|
||
|
|
}
|
||
|
|
|
||
|
|
start_pre() {
|
||
|
|
if ! checkpath --file /etc/${RC_SVCNAME}/config.ini; then
|
||
|
|
eerror "You need a configuration file to proceed"
|
||
|
|
fi
|
||
|
|
eend $?
|
||
|
|
}
|