forked from Lainports/freebsd-ports
Fix rustdesk-server startup scripts to use /var/db/rustdesk-server by default to store its files. These files need to be preserved across reboots, so /var/run is the wrong place. Added pkg-message to inform users. While here, fix some issues with comments referencing a different software and update the declared defaults. Reported by: Victor Tschetter <tschetter.victor@gmail.com> https://github.com/rustdesk/rustdesk-server/issues/288 MFH: 2023Q3
65 lines
2.2 KiB
Bash
65 lines
2.2 KiB
Bash
#!/bin/sh
|
|
|
|
# PROVIDE: rustdesk_hbbr
|
|
# REQUIRE: LOGIN
|
|
# KEYWORD: shutdown
|
|
#
|
|
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
|
|
# to enable this service:
|
|
#
|
|
# rustdesk_hbbr_enable (bool): Set to NO by default.
|
|
# Set it to YES to enable rustdesk_hbbr.
|
|
# rustdesk_hbbr_args (string): Set extra arguments to pass to rustdesk_hbbr
|
|
# Default is "-k _".
|
|
# rustdesk_hbbr_user (string): Set user that rustdesk_hbbr will run under
|
|
# Default is "rustdesk".
|
|
# rustdesk_hbbr_group (string): Set group that rustdesk_hbbr will run under
|
|
# Default is "rustdesk".
|
|
|
|
. /etc/rc.subr
|
|
|
|
name=rustdesk_hbbr
|
|
desc="Rustdesk Relay Server"
|
|
rcvar=rustdesk_hbbr_enable
|
|
|
|
load_rc_config $name
|
|
|
|
: ${rustdesk_hbbr_enable:=NO}
|
|
: ${rustdesk_hbbr_args="-k _"}
|
|
: ${rustdesk_hbbr_user:=rustdesk}
|
|
: ${rustdesk_hbbr_group:=rustdesk}
|
|
|
|
pidfile=/var/run/rustdesk_hbbr.pid
|
|
command=/usr/sbin/daemon
|
|
procname=%%PREFIX%%/bin/hbbr
|
|
rustdesk_hbbr_chdir=/var/db/rustdesk-server
|
|
command_args="-p ${pidfile} -T ${name} ${procname} ${rustdesk_hbbr_args}"
|
|
# Command to log directly to file
|
|
#command_args="-P ${pidfile} -H -o /var/log/rustdesk-hbbr.log ${procname} ${rustdesk_hbbr_args}"
|
|
|
|
start_precmd=rustdesk_hbbr_startprecmd
|
|
|
|
rustdesk_hbbr_startprecmd()
|
|
{
|
|
if [ -e ${pidfile} ]; then
|
|
chown ${rustdesk_hbbr_user}:${rustdesk_hbbr_group} ${pidfile};
|
|
else
|
|
install -o ${rustdesk_hbbr_user} -g ${rustdesk_hbbr_group} /dev/null ${pidfile};
|
|
fi
|
|
if [ -e ${rustdesk_hbbr_chdir} ]; then
|
|
chown -R ${rustdesk_hbbr_user}:${rustdesk_hbbr_group} ${rustdesk_hbbr_chdir};
|
|
chmod -R 770 ${rustdesk_hbbr_chdir};
|
|
else
|
|
mkdir -p -m 770 ${rustdesk_hbbr_chdir};
|
|
chown ${rustdesk_hbbr_user}:${rustdesk_hbbr_group} ${rustdesk_hbbr_chdir};
|
|
fi
|
|
if [ -e /var/log/rustdesk-hbbr.log ]; then
|
|
chown -R ${rustdesk_hbbr_user}:${rustdesk_hbbr_group} /var/log/rustdesk-hbbr.log;
|
|
chmod 660 /var/log/rustdesk-hbbr.log;
|
|
else
|
|
install -o ${rustdesk_hbbr_user} -g ${rustdesk_hbbr_group} /dev/null /var/log/rustdesk-hbbr.log;
|
|
chmod 660 /var/log/rustdesk-hbbr.log;
|
|
fi
|
|
}
|
|
|
|
run_rc_command "$1"
|