| 1 |
#!/bin/sh |
| 2 |
### BEGIN INIT INFO |
| 3 |
# Provides: nodm |
| 4 |
# Should-Start: bluetooth |
| 5 |
# Required-Start: $remote_fs |
| 6 |
# Required-Stop: |
| 7 |
# Default-Start: 2 3 4 5 |
| 8 |
# Default-Stop: |
| 9 |
# Description: Display Manager for automatic session logins |
| 10 |
# Short-Description: No Display Manager |
| 11 |
### END INIT INFO |
| 12 |
|
| 13 |
|
| 14 |
set -e |
| 15 |
|
| 16 |
PATH=/bin:/usr/bin:/sbin:/usr/sbin |
| 17 |
DESC="Automatic Display Manager" |
| 18 |
NAME=nodm |
| 19 |
PIDDIR=/var/run/ |
| 20 |
PIDFILE=${PIDDIR}/${NAME}.pid |
| 21 |
|
| 22 |
NODM_ENABLED=no |
| 23 |
NODM_XINIT=/usr/bin/xinit |
| 24 |
NODM_FIRST_VT=7 |
| 25 |
NODM_XSESSION=/etc/X11/Xsession |
| 26 |
NODM_OPTIONS= |
| 27 |
NODM_X_OPTIONS="-nolisten tcp" |
| 28 |
NODM_USER=root |
| 29 |
NODM_MIN_SESSION_TIME=60 |
| 30 |
NODM_X_TIMEOUT=300 |
| 31 |
|
| 32 |
if [ -f /etc/default/$NAME ] |
| 33 |
then |
| 34 |
. /etc/default/$NAME |
| 35 |
fi |
| 36 |
|
| 37 |
export NODM_XINIT NODM_XSESSION NODM_X_OPTIONS NODM_USER NODM_MIN_SESSION_TIME NODM_FIRST_VT NODM_X_TIMEOUT |
| 38 |
|
| 39 |
# If you change the user to a non-root user, make sure you |
| 40 |
# set allowed_users=anybody in /etc/X11/Xwrapper.config |
| 41 |
|
| 42 |
# Gracefully exit if the package or its dependencies have been removed (but not purged). |
| 43 |
[ -x /usr/sbin/nodm ] || exit 0 |
| 44 |
|
| 45 |
|
| 46 |
# Load the VERBOSE setting and other rcS variables |
| 47 |
. /lib/init/vars.sh |
| 48 |
|
| 49 |
# Define LSB log_* functions. |
| 50 |
. /lib/lsb/init-functions |
| 51 |
|
| 52 |
|
| 53 |
case "$1" in |
| 54 |
start) |
| 55 |
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" |
| 56 |
if [ "$NODM_ENABLED" = "no" ] || [ "$NODM_ENABLED" = "false" ] |
| 57 |
then |
| 58 |
log_warning_msg "Not starting $NAME because NODM_ENABLED is '$NODM_ENABLED' in /etc/default/$NAME" |
| 59 |
else |
| 60 |
start-stop-daemon --start --quiet --oknodo --pidfile ${PIDFILE} --make-pidfile --background --exec /usr/sbin/nodm -- ${NODM_OPTIONS} |
| 61 |
fi |
| 62 |
[ "$VERBOSE" != no ] && log_end_msg $? |
| 63 |
;; |
| 64 |
stop) |
| 65 |
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" |
| 66 |
start-stop-daemon --stop --quiet --retry 10 --pidfile ${PIDFILE} --oknodo |
| 67 |
rm -f ${PIDFILE} |
| 68 |
[ "$VERBOSE" != no ] && log_end_msg $? |
| 69 |
;; |
| 70 |
restart|force-reload) |
| 71 |
$0 stop |
| 72 |
$0 start |
| 73 |
;; |
| 74 |
status) |
| 75 |
status_of_proc -p ${PIDFILE} /usr/sbin/nodm nodm && exit 0 || exit $? |
| 76 |
;; |
| 77 |
*) |
| 78 |
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2 |
| 79 |
exit 1 |
| 80 |
;; |
| 81 |
esac |
| 82 |
|
| 83 |
|
| 84 |
exit 0 |