Initial commit
This commit is contained in:
44
customcd/files/etc/init.d/dostartx
Normal file
44
customcd/files/etc/init.d/dostartx
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/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 $?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user