45 lines
1.0 KiB
Plaintext
45 lines
1.0 KiB
Plaintext
#!/sbin/runscript
|
|
|
|
DAEMON="/usr/bin/xinit"
|
|
ARGS="/etc/X11/xinit/xinitrc"
|
|
PIDFILE="/var/run/dostartx.pid"
|
|
LOGFILE="/var/log/dostartx.log"
|
|
CWD="/root"
|
|
|
|
totalmem=`free|grep Mem:|awk '{print $2}'`
|
|
if [ "$totalmem" -lt 500000 ]; then
|
|
if grep -q "autoruns=3" /proc/cmdline ; then
|
|
dotextonly=1
|
|
fi
|
|
fi
|
|
|
|
depend() {
|
|
after sysresccd
|
|
}
|
|
|
|
start() {
|
|
if grep -q "dostartx" /proc/cmdline
|
|
then
|
|
if [ "$dotextonly" ]
|
|
then
|
|
ebegin "Not enough memory to start the graphical environment"
|
|
eend 0
|
|
else
|
|
ebegin "Starting the graphical environment"
|
|
start-stop-daemon --start --quiet --user root --env SHELL="/bin/bash" --env PATH="$PATH:/root/rescuebru" \
|
|
--pidfile $PIDFILE --exec $DAEMON --background --chdir $CWD \
|
|
--stdout $LOGFILE --make-pidfile -- $ARGS
|
|
eend $?
|
|
fi
|
|
else
|
|
eend 0
|
|
fi
|
|
}
|
|
|
|
stop() {
|
|
ebegin "Stopping the graphical environment"
|
|
start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON
|
|
eend $?
|
|
}
|
|
|