1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-27 05:10:36 +00:00

Update rc.d script to effectively stop slim

Maintainer assisted with testing various versions of the script.
This final version seems to have addressed all of the issues that
he and I saw.

PR:		ports/153392
Submitted by:	me
This commit is contained in:
Doug Barton 2011-01-08 08:05:29 +00:00
parent ddaf24a9a3
commit 368196da2e
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=267506
2 changed files with 29 additions and 2 deletions

View File

@ -7,6 +7,7 @@
PORTNAME= slim
PORTVERSION= 1.3.2
PORTREVISION= 1
CATEGORIES= x11
MASTER_SITES= ${MASTER_SITE_BERLIOS} \
http://depot.fsck.ch/mirror/distfiles/

View File

@ -1,9 +1,11 @@
#!/bin/sh
# $FreeBSD$
#
# PROVIDE: slim
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable slim:
# slim_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable slim
@ -11,13 +13,17 @@
# Alternatively, edit /etc/ttys and change the line below
# ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure
# to this:
# ttyv8 "/usr/local/bin/slim" xterm on secure
# ttyv8 "%%PREFIX%%/bin/slim" xterm on secure
. /etc/rc.subr
name="slim"
rcvar=`set_rcvar`
start_precmd=${name}_rmfile
stop_precmd=${name}_prestop
stop_postcmd=${name}_rmfile
load_rc_config $name
: ${slim_enable="NO"}
@ -26,4 +32,24 @@ command=%%PREFIX%%/bin/slim
command_args="-d"
pidfile=/var/run/slim.pid
slim_rmfile ()
{
local file
for file in $pidfile /var/run/slim.auth; do
[ -e "$file" ] && unlink $file
done
return 0
}
slim_prestop ()
{
local xpid
xpid=`ps -axww | grep '/bin/[X] .* -auth /var/run/slim.auth'`
xpid="${xpid## }"
[ -n "$xpid" ] && kill ${xpid%% *}
}
run_rc_command "$1"