#!/bin/sh # Largely adapted from xdm's init script: # Copyright 1998-2002, 2004, 2005 Branden Robinson . # Copyright 2006 Eugene Konev # # This is free software; you may redistribute it and/or modify # it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2, # or (at your option) any later version. # # This is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License with # the Debian operating system, in /usr/share/common-licenses/GPL; if # not, write to the Free Software Foundation, Inc., 51 Franklin Street, # Fifth Floor, Boston, MA 02110-1301, USA. ### BEGIN INIT INFO # Provides: lightdm # Required-Start: $local_fs $remote_fs dbus # Required-Stop: $local_fs $remote_fs dbus # Should-Start: $named # Should-Stop: $named # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start lightdm ### END INIT INFO set -e setvar HEED_DEFAULT_DISPLAY_MANAGER = '' # To start lightdm even if it is not the default display manager, change # HEED_DEFAULT_DISPLAY_MANAGER to "false." # Also overridable from command line like: # HEED_DEFAULT_DISPLAY_MANAGER=false /etc/init.d/lightdm start test -z $HEED_DEFAULT_DISPLAY_MANAGER && setvar HEED_DEFAULT_DISPLAY_MANAGER = 'true' setvar DEFAULT_DISPLAY_MANAGER_FILE = '/etc/X11/default-display-manager' setvar PATH = "/bin:/usr/bin:/sbin:/usr/sbin" setvar DAEMON = '/usr/sbin/lightdm' setvar PIDFILE = '/var/run/lightdm.pid' if test -r /etc/default/locale { source /etc/default/locale export LANG LANGUAGE } test -x $DAEMON || exit 0 source /lib/lsb/init-functions setvar SSD_START_ARGS = ""--pidfile $PIDFILE --name $(basename $DAEMON) --startas $DAEMON -- -d"" setvar SSD_STOP_ARGS = ""--pidfile $PIDFILE --name $(basename $DAEMON) --retry TERM/5/TERM/5"" match $1 { with start if test $HEED_DEFAULT_DISPLAY_MANAGER = "true" && test -e $DEFAULT_DISPLAY_MANAGER_FILE && test $(cat $DEFAULT_DISPLAY_MANAGER_FILE) != "/usr/bin/lightdm" -a $(cat $DEFAULT_DISPLAY_MANAGER_FILE) != "/usr/sbin/lightdm" { echo "Not starting X display manager (lightdm); it is not the default" \ "display manager." } else { log_daemon_msg "Starting X display manager" "lightdm" start-stop-daemon --start --quiet $SSD_START_ARGS \ || log_progress_msg "already running" log_end_msg 0 } with restart test -f $PIDFILE && /etc/init.d/lightdm stop test -f $PIDFILE && exit 1 /etc/init.d/lightdm start with stop log_daemon_msg "Stopping X display manager" "lightdm" if ! test -f $PIDFILE { log_progress_msg "not running ($PIDFILE not found)" } else { start-stop-daemon --stop --quiet $SSD_STOP_ARGS setvar SSD_RES = "$Status" if test $SSD_RES -eq 1 { log_progress_msg "not running" } if test $SSD_RES -eq 2 { log_progress_msg "not responding to TERM signals" } else { if test -f $PIDFILE { log_progress_msg "(removing stale $PIDFILE)" rm $PIDFILE } } } log_end_msg 0 with force-reload /etc/init.d/lightdm restart with * echo "Usage: /etc/init.d/lightdm {start|stop|restart|force-reload}" exit 1 } exit 0