Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions lib/SetupWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,26 @@ public function hasSystemd(): bool {
return $result === 0;
}

public function hasRcd(): bool {
$result_bin = null;
$result_dir = null;
$output_bin = [];
$output_dir = [];
// Check if /usr/sbin/service is executable
exec('/bin/sh -c "test -x /usr/sbin/service"', $output_bin, $result_bin);
if ($result_bin !== 0) {
return false;
}
// Check for /usr/local/etc/rc.d
exec('test -d /usr/local/etc/rc.d', $output_dir, $result_dir);
if ($result_dir === 0) {
return true;
}
// Check for /etc/rc.d (always exists on FreeBSD)
exec('test -d /etc/rc.d', $output_dir, $result_dir);
return $result_dir === 0;
}

public function hasSELinux(): bool {
$result = null;
$output = [];
Expand Down
42 changes: 27 additions & 15 deletions service_scripts/nextcloud_notify_push
Original file line number Diff line number Diff line change
@@ -1,36 +1,48 @@
#! /bin/sh
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: nextcloud_notify_push
# REQUIRE: NETWORKING DAEMON
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf to enable nextcloud_notify_push:
#
#nextcloud_notify_push_enable="YES"
#nextcloud_notify_push_droot="YOUR NEXTCLOUD DIRECTORY ROOT"
# Add the following line to /etc/rc.conf to enable nextcloud_notify_push:
# nextcloud_notify_push_enable="YES"

. /etc/rc.subr

name="nextcloud_notify_push"
rcvar="nextcloud_notify_push_enable"
rcvar="${name}_enable"

load_rc_config $name

: ${nextcloud_notify_push_enable:="NO"}
: ${nextcloud_notify_push_user:="www"}
: ${nextcloud_notify_push_group:="www"}
: ${nextcloud_notify_push_enable:=NO}
: ${nextcloud_notify_push_droot:=/usr/local/www/html}
: ${nextcloud_notify_push_droot:=/usr/local/www/nextcloud}
: ${nextcloud_notify_push_config:=${nextcloud_notify_push_droot}/config/config.php}
: ${nextcloud_notify_push_flags:=-p 7867}

my_flags=${nextcloud_notify_push_flags}
nextcloud_notify_push_flags=
pushserver_flags="-p 7867"

pidfile=/var/run/nextcloud_notify_push.pid
pidfile="/var/run/${name}.pid"
binary="${nextcloud_notify_push_droot}/apps/notify_push/bin/fbsd_amd64/notify_push"

command="/usr/sbin/daemon"
command_args="-S -u www -P ${pidfile} -- ${binary} ${my_flags} ${nextcloud_notify_push_config}"
command_args="-S -r -P ${pidfile} -- ${binary} ${pushserver_flags} ${nextcloud_notify_push_config}"

start_precmd="${name}_precmd"
stop_postcmd="${name}_postcmd"

nextcloud_notify_push_precmd()
{
# Create pidfile for user:group
install -o ${nextcloud_notify_push_user} -g ${nextcloud_notify_push_group} /dev/null ${pidfile}
}

nextcloud_notify_push_postcmd()
{
# Clean up
rm -f ${pidfile}
}

run_rc_command "$1"