5级只是在2级基础上追加图形功能,所以先复制一份,代码如下。
cp /etc/rc.d/rc.2 /etc/rc.d/rc.5
追加部分查看kdm,gdm,xdm是否存在,存在其一则启动图形界面。否则转到2级登陆界面。
echo "Starting graphical login manager..." if [ -x /opt/kde/bin/kdm ]; then /opt/kde/bin/kdm -nodaemon elif [ -x /usr/bin/gdm ]; then /usr/bin/gdm -nodaemon elif [ -x /usr/X11R6/bin/xdm ]; then /usr/X11R6/bin/xdm -nodaemon else echo "You chose to start graphical login mode, but you don't have either KDM or" echo "GDM or XDM installed. This script looks for these display managers in the" echo "following locations:" echo echo " KDM /opt/kde/bin/kdm" echo " GDM /usr/bin/gdm" echo " XDM /usr/X11R6/bin/xdm" echo echo "This message will go away in 10 seconds, and after that you will be dropped" echo "in runlevel 2." sleep 10 /sbin/telinit 2 fi