16eb7c2ca0
It is present in all supported versions of FreeBSD, and has had poor takeup. I strongly suspect the strange-looking checks are partially to blame for scaring maintainers off. Go forth and please use it! PR: ports/178269 Approved by: maintainers of all ports involved
65 lines
1.1 KiB
Bash
65 lines
1.1 KiB
Bash
#!/bin/sh
|
|
|
|
# $FreeBSD$
|
|
#
|
|
# PROVIDE: slim
|
|
# REQUIRE: LOGIN dbus hald
|
|
# KEYWORD: shutdown
|
|
#
|
|
# Add the following line to /etc/rc.conf to enable slim:
|
|
# slim_enable="YES"
|
|
#
|
|
# Alternatively, edit /etc/ttys and change the line below
|
|
# ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure
|
|
# to this:
|
|
# ttyv8 "%%PREFIX%%/bin/slim" xterm on secure
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="slim"
|
|
rcvar=slim_enable
|
|
|
|
load_rc_config slim
|
|
|
|
: ${slim_enable:="NO"}
|
|
|
|
command=%%PREFIX%%/bin/slim
|
|
command_args="-d"
|
|
start_precmd=${name}_rmfile
|
|
stop_precmd=${name}_prestop
|
|
stop_postcmd=${name}_rmfile
|
|
|
|
find_pidfile()
|
|
{
|
|
if get_pidfile_from_conf lockfile %%PREFIX%%/etc/${name}.conf; then
|
|
pidfile="$_pidfile_from_conf"
|
|
else
|
|
pidfile="/var/run/${name}.pid"
|
|
fi
|
|
}
|
|
|
|
slim_rmfile()
|
|
{
|
|
local file
|
|
|
|
[ -z "$pidfile" ] && find_pidfile
|
|
|
|
for file in $pidfile /var/run/slim.auth; do
|
|
[ -e "$file" ] && unlink $file
|
|
done
|
|
|
|
# Needed if neither file exists
|
|
return 0
|
|
}
|
|
|
|
slim_prestop()
|
|
{
|
|
local xpid
|
|
|
|
find_pidfile
|
|
|
|
xpid=`ps -axww | grep '/bin/[X] .* -auth /var/run/slim.auth' | grep -v grep | awk '{print $1};'`
|
|
[ -n "$xpid" ] && kill $xpid
|
|
}
|
|
|
|
run_rc_command "$1"
|