2009年1月14日 星期三

讓OpenSUSE 11.0 每個虛擬主控台都有背景

日前使用openSUSE 11.0,驚訝於他的tty1有背景。但其他tty就沒有相對應的背景,因此上網找資料想達成這個目的。
以下即為我找到的方法

openSUSE的文字背景,是bootsplash這個程式提供的功能。
這個程式主要提供開機畫面(silent),以及tty背景畫面。

該程式主要設定檔在/etc/splashy/config.xml
主題放在/etc/bootsplash/themes/資料夾中
預設主題為openSUSE,在其中的config資料夾中,存有不同解析度的config檔案。
但這些config檔案載入以後會秀出silent的畫面,也就是會出現開機畫面。
因此我們要對這個檔案作修改,讓它只含有background的設定。



可以先看/proc/splash檔案中的內容,了解splash運作的模式

# cat /proc/splash


以bootsplash-1024x768.cfg為例
先將其複製成為console-1024x768.cfg,再將其中的設定作修改

#cp bootsplash-1024x768.cfg console-1024x768.cfg
#vi console-1024x768.cfg


將不要的設定註解後成為以下的內容:

version=3
state=1
#progress_enable=0
overpaintok=0


fgcolor=7
bgcolor=0

tx=20
ty=60
tw=994
th=708


jpeg=/etc/bootsplash/themes/openSUSE/images/bootsplash-1024x768.jpg
#silentjpeg=/etc/bootsplash/themes/openSUSE/images/silent-1024x768.jpg


#mnganim logo /etc/bootsplash/themes/openSUSE/images/logo.mng initframe logo silent center 512 384
mnganim logov /etc/bootsplash/themes/openSUSE/images/logov.mng initframe logov origin 0 2 2
#trigger "isdown" quit
#trigger "rlreached 5" toverbose
#trigger "login" toverbose
#trigger "rlchange 0" tosilent
#trigger "rlchange 6" tosilent


#progress_enable=1
#box silent noover 428 414 588 415 #ffffff10
#box silent inter 428 413 428 415 #ffffff80
#box silent 428 413 588 416 #ffffff80


註解掉的內容也可以砍掉XD
接下來只要執行

#splash -u 1 /etc/bootsplash/themes/openSUSE/config/console-1024x768.cfg


就會在tty2加上背景囉
-u後面的0~5分別對應到tty1~6
如果要去除背景,執行

#splash -s -u 1


就會去除tty2的背景
最後,在開機的/etc/init.d/boot.local中添加以下命令:

#Use splash add backgroupd to tty 2~6
for ((s_num=1;s_num<=5;s_num++))
do
t_num=$((s_num+1))
echo -e "Starting splash in tty $t_num"
splash -u $s_num /etc/bootsplash/themes/openSUSE/config/console-1024x768.cfg
done

#If splash failed to add background to tty 2~6, reset tty 1~5. If splash success to add backgroud, return success message.
if test $? -ne 0
then
echo -e "Warnning!!!Splash failed to add background to virtual terminals. Reset all console now."
for ((s_num=0;s_num<=5;s_num++))
do
t_num=$((s_num+1))
echo -e "Stoping splash in tty $t_num"
splash -s -u $s_num
done
else
echo -e "Splash add background to vitrual terminals seccessful."


開機過程中即會將TTY2~6附加上背景圖案囉! 如果您的openSUSE11.0開機沒有splash特效,請編輯/etc/sysconfig/bootsplash檔案,變更其中的值:

THEME="openSUSE" SPLASH="yes"


之後執行SUSEconfig應該就可以了

# SuSEconfig


參考資料
http://www.linuxforums.org/forum/linux-newbie/45914-having-trouble-creating-custom-bootsplash-screen.html
http://unix-cd.com/vc/www/47/2007-10/8737.html

0 意見: