引入:

??? 在前篇思路的指導下,進行了為期三個星期的調試最終建立了一個初步成熟的,具有親和力的配置界面,現在此虛擬系統已經初步部署了一個機房,用來學生日常上課。在本篇中,本人并不試圖去花篇幅講解彼此之間如何配合,如此設計緣由等等。因為,邏輯的東西真的不好用語言來說,只好將之以一種最直接的方式完整呈現給讀者。如果你全全操作,一定會明了我的設計思路及各文檔的含義的。

虛擬系統文檔:

???? 1、管理員克隆后初次登錄相關

【桌面自動運行文件autostart】

對應文件:/etc/xdg/openbox/autostart_half

注:*_half文件,以及后面要出現的*_ok,均是為區分部署給不同用戶而設定的。half表示,使用此配置文件時,系統的配置尚未完成。ok表示,通過此配置文件,系統配置即將完成(結束)。這樣做有一個好處,當我需要重置系統設置時,可以將所有half文件復制并覆蓋對應的配置文件(如:autostart_half覆蓋autostart)。而在配置完autostart_half內容的autostart,如果配置將autostart_ok覆蓋autostart文件即可。最后聲明一點,所有以half或ok結尾的配置文件并不起作用,它只是用來覆蓋對應的無后綴文件來起作用的。

 
  1. #?
  2. #if?test?-x?/usr/lib/openbox/gnome-settings-daemon?>/dev/null;?then?
  3. #??/usr/lib/openbox/gnome-settings-daemon?&?
  4. #elif?which?gnome-settings-daemon?>/dev/null;?then?
  5. #??gnome-settings-daemon?&?
  6. #fi?
  7. ?
  8. #?If?you?want?to?use?XFCE?config?tools...?
  9. #?
  10. #xfce-mcs-manager?&?
  11. #任務欄加載
  12. tint2?&?
  13. #自動運行終端,有時桌面會停止響應,如果終端開啟,輸入命令“openbox --reconfigure”刷新桌面即可。
  14. xterm?&?
  15. #net.jpg這個圖片,我沒有提供,是機房管理員在配置系統時系統的桌面背景圖片
  16. feh?--bg-scale?/boot/net.jpg?&?
  17. #打開系統說明文檔,只是起提示與說明作用的文本
  18. leafpad?/etc/vmshenzhi.txt?&?

/etc/vmshenzhi.txt的內容:

 
  1. ??????現在大家看到的這篇文檔,是在克隆系統后交付學生使用前所需的操作?
  2. 說明。在桌面上單擊右鍵,會有一個菜單彈出。我們可能用到的菜單均是?
  3. 含有漢字的,英文的不要操作!?
  4. ?????菜單的第一項:“**職教虛擬系統使用說明”,就是本文檔。接下來會?
  5. 有兩大步操作,依次是:?
  6. 第一大步[修改IP與主機名]:?
  7. ????????1.修改宿主機IP地址?
  8. ????????2.修改宿主機名稱-1?
  9. ????????3.修改宿主機名稱-2?
  10. ?
  11. 第二大步:?
  12. ????????保存并重啟系統?
  13. ????????[之后會進入虛擬機的編輯界面,設置完虛擬機后再次點選重啟的菜單項就完成了所有操作]?
  14. ?
  15. ??????如果在修改過程中出現了無法更正的錯誤,可以重新對系統進行設置,?
  16. 此時需要選擇的菜單是其它子菜單中的"重新配置[慎重]",但要慎重進行選擇,系統?
  17. 會進行重啟。如果一切順利,在設置完成后,選擇最下方的菜單“設置完畢?
  18. 重啟系統”!?
  19. ??????????????????????????????????????????????????????????????[完]12年1月7日21:00:18?

??? 2、桌面菜單

對應文件:/etc/xdg/openbox/menu.xml_half

 
  1. <?xml?version="1.0"?encoding="UTF-8"?>?
  2. ?
  3. <openbox_menu?xmlns="http://openbox.org/"?
  4. ????????xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?
  5. ????????xsi:schemaLocation="http://openbox.org/?
  6. ????????????????file:///usr/share/openbox/menu.xsd">?
  7. ?<!--圖形界面中的菜單-管理員狀態?-->?
  8. <menu?id="root-menu"?label="Openbox?3">?
  9. ??<item?label="**職教虛擬系統使用說明">?
  10. ????<action?name="Execute"><execute>leafpad?/etc/vmshenzhi.txt</execute></action>?
  11. ??</item>?
  12. ?<!--自定義?添加的配置菜單內容?-->?
  13. <separator?/>?
  14. ?
  15. <menu?id="zheng-menu1"?label="[第一步]修改IP與主機名">?
  16. ??<item?label="1.修改宿主機IP地址">?
  17. ????<action?name="Execute"><execute>leafpad?/etc/network/interfaces</execute></action>?
  18. ??</item>?
  19. ??<item?label="2.修改宿主機名稱-1">?
  20. ????<action?name="Execute"><execute>leafpad?/etc/hostname</execute></action>?
  21. ??</item>?
  22. ??<item?label="3.修改宿主機名稱-2">?
  23. ????<action?name="Execute"><execute>leafpad?/etc/hosts</execute></action>?
  24. ??</item>?
  25. </menu>?
  26. ??<item?label="[第二步]保存并重啟系統">?
  27. ????<action?name="Execute"><execute>/etc/first.sh</execute></action>?
  28. ??</item>?
  29. ??<separator?/>?
  30. <menu?id="zheng-menu3"?label="其它">?
  31. ??<!--?This?requires?the?presence?of?the?'menu'?package?to?work?-->?
  32. ??<item?label="Terminal?emulator">?
  33. ????<action?name="Execute"><execute>x-terminal-emulator</execute></action>?
  34. ??</item>?
  35. ??<item?label="ObConf">?
  36. ????<action?name="Execute"><execute>obconf</execute></action>?
  37. ??</item>?
  38. ???<item?label="關機">?
  39. ????<action?name="Execute"><execute>shutdown?-h?now</execute></action>?
  40. ???</item>?
  41. ??<item?label="Tint2">?
  42. ????<action?name="Execute"><execute>tint2</execute></action>?
  43. ??</item>?
  44. ??<item?label="Reconfigure">?
  45. ????<action?name="Reconfigure"?/>?
  46. ??</item>?
  47. ??<item?label="!!!重新配置[慎重]!!!">?
  48. ????<action?name="Execute"><execute>/etc/refirst2.sh</execute></action>?
  49. ??</item>?
  50. ??<item?label="Restart">?
  51. ????<action?name="Restart"?/>?
  52. ??</item>?
  53. ??<separator?/>?
  54. ??<item?label="Exit">?
  55. ????<action?name="Exit"?/>?
  56. ??</item>?
  57. </menu>?
  58. ??<separator?/>?
  59. ?
  60. <item?label="關于">?
  61. ????<action?name="Execute"><execute>feh?/boot/kaichuang.jpg</execute></action>?
  62. ??</item>?
  63. </menu>?
  64. ?
  65. </openbox_menu>?

menu.xml_half中包含的文檔:

對應文件:/etc/network/interfaces由文件interfaces_half得來

作用:修改主機IP

 
  1. ####################本文件是用來修改機器的IP地址的?
  2. #?This?file?describes?the?network?interfaces?available?on?your?system?
  3. #?and?how?to?activate?them.?For?more?information,?see?interfaces(5).?
  4. ?
  5. #?The?loopback?network?interface?
  6. auto?lo?
  7. iface?lo?inet?loopback?
  8. ?
  9. #?The?primary?network?interface?
  10. auto?eth0?
  11. #iface?eth0?inet?dhcp?
  12. iface?eth0?inet?static?
  13. ####下面一行修改為:192.168.208.10x?
  14. ####例如,第1個學生機為192.168.208.101,第50個為192.168.208.150?
  15. address?192.168.208.150?
  16. ##########下面不修改##########?
  17. netmask?255.255.255.0?
  18. gateway?192.168.208.254?
  19. broadcast?192.168.208.255?

對應文件:/etc/hostname由文件/etc/hostname_half得來

作用:修改主機名稱

 
  1. ######此文件用來修改主機名稱,注意sz0801表示第1個學生機,?
  2. ######sz0802表示第2個,sz0801表示第1個學生機?
  3. ######僅需將sz0850修改為對應名稱,?
  4. ######其它地方不做更改,更改完畢,保存并退出!?
  5. sz0850?

對應文件:/etc/hosts由文件/etc/hosts_half得來

作用:修改主機名稱

 
  1. ######此文件用來修改主機名稱,注意sz0801表示第1個學生機,?
  2. ######sz0802表示第2個,sz0801表示第50個學生機?
  3. ######僅需將sz0850修改為對應名稱,?
  4. ######其它地方不做更改,更改完畢,保存并退出!?
  5. 127.0.1.1???sz0850?
  6. ?
  7. #?The?following?lines?are?desirable?for?IPv6?capable?hosts?
  8. ::1?????ip6-localhost?ip6-loopback?
  9. fe00::0?ip6-localnet?
  10. ff00::0?ip6-mcastprefix?
  11. ff02::1?ip6-allnodes?
  12. ff02::2?ip6-allrouters?

對應文件:/etc/first.sh

作用:將配置文件使用以“_ok”結尾的文件替代。其與接下來要展示的/etc/refirst.sh作用相反。其余細節部分不再細述。

 
  1. #/bin/bash?
  2. cp?-f?/etc/xdg/openbox/menu.xml_ok?/etc/xdg/openbox/menu.xml?
  3. cp?-f?/etc/xdg/openbox/autostart_ok?/etc/xdg/openbox/autostart?
  4. cp?-f?/etc/init/tty1.conf_ok?/etc/init/tty1.conf?
  5. cp?/boot/grub/grub.cfg_ok?/boot/grub/grub.cfg?
  6. #克隆系統后往往網卡不能啟動,執行下面的命令就可以了。
  7. rm?/etc/udev/rules.d/70-persistent-net.rules?
  8. chmod?u+w?/vmos/shenzhi/Windows\?XP\?Professional.vmx?
  9. chown?-R?shenzhi.shenzhi?/vmos/shenzhi/?
  10. cp?/home/shenzhi/.config/openbox/menu.xml_ok?/home/shenzhi/.config/openbox/menu.xml?
  11. chown?-R?shenzhi.shenzhi?/home/shenzhi/.config/openbox/?
  12. chown?-R?shenzhi.shenzhi?/etc/xdg/openbox/?
  13. reboot?

對應文件:/etc/refirst2.sh

作用: 用于在配置錯誤后重新配置的腳本。

 
  1. #/bin/bash?
  2. #恢復圖形界面中的菜單至管理員狀態?
  3. cp?-f?/etc/xdg/openbox/menu.xml_half?/etc/xdg/openbox/menu.xml?
  4. #恢復自啟動文件?
  5. cp?-f?/etc/xdg/openbox/autostart_half?/etc/xdg/openbox/autostart?
  6. #設置root用戶開機自動登錄圖形界面?
  7. cp?-f?/etc/init/tty1.conf_half?/etc/init/tty1.conf?
  8. #刪除多余菜單,縮短開機時間?
  9. cp?/boot/grub/grub.cfg_half?/boot/grub/grub.cfg?
  10. #在刪除快照前,先將虛擬主文件設置為可修改權限?
  11. chmod?u+w?/vmos/shenzhi/Windows\?XP\?Professional.vmx?
  12. #刪除先前創建的快照00?
  13. #vmrun?-T?ws?deletesnapshot?"/vmos/shenzhi/Windows?XP?Professional.vmx"?00?
  14. #恢復網絡配置文件到初始模板?
  15. cp?/etc/network/interfaces_half?/etc/network/interfaces?
  16. #恢復主機名配置文件到初始模板?
  17. cp?/etc/hosts_half?/etc/hosts?
  18. #恢復主機名配置文件到初始模板?
  19. cp?/etc/hostname_half?/etc/hostname?
  20. #恢復使用說明文件?
  21. cp?/etc/vmshenzhi.txt_ok?/etc/vmshenzhi.txt?
  22. #重置結束,提醒用戶?
  23. echo?"好了,現在可以重新開始配置了!"|leafpad??

???? 2、普通用戶配置文件

對應文件:cat /home/shenzhi/.config/openbox/menu.xml_ok

作用: 位于普通用戶“shenzhi”家目錄下的菜單配置文件,用于接上面的設置后通過普通用戶下的菜單再次對系統進行配置。

 
  1. <?xml?version="1.0"?encoding="UTF-8"?>?
  2. ?
  3. <openbox_menu?xmlns="http://openbox.org/"?
  4. ????????xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?
  5. ????????xsi:schemaLocation="http://openbox.org/?
  6. ????????????????file:///usr/share/openbox/menu.xsd">?
  7. ?
  8. <menu?id="root-menu"?label="Openbox?3">?
  9. ??<item?label="**職教虛擬系統">?
  10. ????<action?name="Execute"><execute>/home/shenzhi/.config/openbox/hello.sh</execute></action>?
  11. ??</item>?
  12. ?<!--自定義?添加的配置菜單內容?-->?
  13. <menu?id="zheng-menu2"?label="[可選]配置虛擬機">?
  14. ??<item?label="修改虛擬機快照00">?
  15. ????<action?name="Execute"><execute>vmrun?-T?ws?start?"/vmos/shenzhi/Windows?XP?Professional.vmx"</execute></action>?
  16. ??</item>?
  17. </menu>?
  18. ??<item?label="Term">?
  19. ????<action?name="Execute"><execute>xterm</execute></action>?
  20. ??</item>?
  21. ??<item?label="[必選]保存并重啟">?
  22. ????<action?name="Execute"><execute>/etc/shenzhi/rebootshenzhi.sh</execute></action>?
  23. ??</item>?
  24. ?
  25. ?
  26. <menu?id="zheng3"?label="其他">?
  27. ??<item?label="Term">?
  28. ????<action?name="Execute"><execute>xterm</execute></action>?
  29. ??</item>?
  30. ?
  31. <separator?/>?
  32. ??<!--?This?requires?the?presence?of?the?'menu'?package?to?work?-->?
  33. ?
  34. ??<item?label="刷新">?
  35. ????<action?name="Reconfigure"?/>?
  36. ??</item>?
  37. ??<separator?/>?
  38. </menu>?
  39. </menu>?
  40. ?
  41. </openbox_menu>?

對應文件:/etc/xdg/openbox/menu_ok

作用: 最終的菜單文件,給學生看的,屏蔽了有危害的菜單項。

 
  1. <?xml?version="1.0"?encoding="UTF-8"?>?
  2. ?
  3. <openbox_menu?xmlns="http://openbox.org/"?
  4. ????????xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?
  5. ????????xsi:schemaLocation="http://openbox.org/?
  6. ????????????????file:///usr/share/openbox/menu.xsd">?
  7. ?<!--圖形界面中的菜單-普通用戶狀態?-->?
  8. <menu?id="root-menu"?label="Openbox?3">?
  9. ??<item?label="**職教虛擬系統">?
  10. ????<action?name="Execute"><execute>/home/shenzhi/.config/openbox/hello.sh</execute></action>?
  11. ??</item>?
  12. ?<!--自定義?添加的配置菜單內容?-->?
  13. ?
  14. ??<!--???<item?label="Term">?-->?
  15. ???<!--????<action?name="Execute"><execute>xterm</execute></action>?-->?
  16. ???<!--??</item>?-->?
  17. ??<!--?This?requires?the?presence?of?the?'menu'?package?to?work?-->?
  18. ?
  19. ??<item?label="刷新">?
  20. ????<action?name="Reconfigure"?/>?
  21. ??</item>?
  22. ??<separator?/>???
  23. <item?label="關于">?
  24. ????<action?name="Execute"><execute>feh?/boot/kaichuang.jpg</execute></action>?
  25. ??</item>?
  26. </menu>?
  27. ?
  28. </openbox_menu>?

對應文件:/home/shenzhi/.config/openbox/hello.sh

作用:歡迎信息。

 
  1. #/bin/bash?
  2. echo?"歡迎使用深州職教開發的虛擬系統!"|leafpad?

?

對應文件:/etc/shenzhi/rebootshenzhi.sh

作用:所有的配置完畢后,保存并重啟。

 
  1. cp?/home/shenzhi/.config/openbox/menu.xml_ok2?/home/shenzhi/.config/openbox/menu.xml?
  2. cp?/etc/xdg/openbox/autostart_ok2?/etc/xdg/openbox/autostart?
  3. shutdown?-r?now?

對應文件:/home/shenzhi/.config/openbox/menu.xml_ok2

作用:清空的菜單內容。

 
  1. <?xml?version="1.0"?encoding="UTF-8"?>?
  2. ?
  3. <openbox_menu?xmlns="http://openbox.org/"?
  4. ????????xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?
  5. ????????xsi:schemaLocation="http://openbox.org/?
  6. ????????????????file:///usr/share/openbox/menu.xsd">?
  7. ?
  8. <menu?id="root-menu"?label="Openbox?3">?
  9. ??<item?label="**職教虛擬系統">?
  10. ????<action?name="Execute"><execute>/home/shenzhi/.config/openbox/hello.sh</execute></action>?
  11. ??</item>?
  12. ?<!--自定義?添加的配置菜單內容?-->?
  13. ?
  14. <separator?/>?
  15. ?
  16. ??<!--?This?requires?the?presence?of?the?'menu'?package?to?work?-->?
  17. ?
  18. ??<item?label="刷新">?
  19. ????<action?name="Reconfigure"?/>?
  20. ??</item>?
  21. ??<separator?/>?
  22. </menu>?
  23. ?
  24. </openbox_menu>?

對應文件:/etc/xdg/openbox/autostart_ok2

作用:

 
  1. #?
  2. #?These?things?are?run?when?an?Openbox?X?Session?is?started.?
  3. #?You?may?place?a?similar?script?in?$HOME/.config/openbox/autostart?
  4. #?to?run?user-specific?things.?
  5. #?
  6. ?
  7. #?If?you?want?to?use?GNOME?config?tools...?
  8. #?
  9. #if?test?-x?/usr/lib/openbox/gnome-settings-daemon?>/dev/null;?then?
  10. #??/usr/lib/openbox/gnome-settings-daemon?&?
  11. #elif?which?gnome-settings-daemon?>/dev/null;?then?
  12. #??gnome-settings-daemon?&?
  13. #fi?
  14. ?
  15. #?If?you?want?to?use?XFCE?config?tools...?
  16. #?
  17. #xfce-mcs-manager?&?
  18. tint2?&?
  19. #feh?--bg-scale?/boot/net.jpg?&?
  20. #feh?/boot/kaichuang.jpg?&?
  21. feh?--bg-scale?/boot/kaichuang.jpg?&?
  22. rm?-Rf?~/*?
  23. xscreensaver?-nosplash&?
  24. chmod?u+w?/vmos/shenzhi/Windows\?XP\?Professional.vmx?
  25. vmrun?-T?ws?reverttosnapshot?"/vmos/shenzhi/Windows?XP?Professional.vmx"?00?
  26. chmod?u-w?/vmos/shenzhi/Windows\?XP\?Professional.vmx?
  27. vmrun?-T?ws?start?"/vmos/shenzhi/Windows?XP?Professional.vmx"?
  28. /etc/shenzhi/vmware-shutdown?

對應文件:/etc/shenzhi/vmware-shutdown

作用:實時監控vmware是否運行,若無則自動關機

 
  1. #/bin/bash?
  2. while?:?
  3. do?
  4. ????thread_num=`ps?-e?|grep?vmware?|?wc?-l`?
  5. ????if?[?$thread_num?-eq?2?];?then?
  6. ???????#date?>>?shutdowntime.log?
  7. ???????shutdown?-h?now?
  8. ???????exit?
  9. ????else?
  10. ????????echo?"Sleeping?2?second..."?
  11. ????????sleep?2?
  12. ????fi?
  13. done?

其它文件:

對應文件:/boot/grub/grub.cfg_half

作用:包含多個選項的系統菜單

 
  1. #?
  2. #?DO?NOT?EDIT?THIS?FILE?
  3. #?
  4. #?It?is?automatically?generated?by?grub-mkconfig?using?templates?
  5. #?from?/etc/grub.d?and?settings?from?/etc/default/grub?
  6. #?
  7. ?
  8. ###?BEGIN?/etc/grub.d/00_header?###?
  9. if?[?-s?$prefix/grubenv?];?then?
  10. ??set?have_grubenv=true?
  11. ??load_env?
  12. fi?
  13. set?default="0"?
  14. if?[?"${prev_saved_entry}"?];?then?
  15. ??set?saved_entry="${prev_saved_entry}"?
  16. ??save_env?saved_entry?
  17. ??set?prev_saved_entry=?
  18. ??save_env?prev_saved_entry?
  19. ??set?boot_once=true?
  20. fi?
  21. ?
  22. function?savedefault?{?
  23. ??if?[?-z?"${boot_once}"?];?then?
  24. ????saved_entry="${chosen}"?
  25. ????save_env?saved_entry?
  26. ??fi?
  27. }?
  28. ?
  29. function?recordfail?{?
  30. ??set?recordfail=1?
  31. ??if?[?-n?"${have_grubenv}"?];?then?if?[?-z?"${boot_once}"?];?then?save_env?recordfail;?fi;?fi?
  32. }?
  33. ?
  34. function?load_video?{?
  35. ??insmod?vbe?
  36. ??insmod?vga?
  37. ??insmod?video_bochs?
  38. ??insmod?video_cirrus?
  39. }?
  40. ?
  41. insmod?part_msdos?
  42. insmod?ext2?
  43. set?root='(hd0,msdos3)'?
  44. search?--no-floppy?--fs-uuid?--set=root?b318e04d-999c-4f93-b1e4-0b43283d46f8?
  45. if?loadfont?/usr/share/grub/unicode.pf2?;?then?
  46. ??set?gfxmode=1024x768?
  47. ??load_video?
  48. ??insmod?gfxterm?
  49. ??insmod?part_msdos?
  50. ??insmod?ext2?
  51. ??set?root='(hd0,msdos1)'?
  52. ??search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  53. ??set?locale_dir=($root)/grub/locale?
  54. ??set?lang=en_US?
  55. ??insmod?gettext?
  56. fi?
  57. terminal_output?gfxterm?
  58. if?[?"${recordfail}"?=?1?];?then?
  59. ??set?timeout=-1?
  60. else?
  61. ??set?timeout=5?
  62. fi?
  63. ###?END?/etc/grub.d/00_header?###?
  64. ?
  65. ###?BEGIN?/etc/grub.d/05_debian_theme?###?
  66. insmod?part_msdos?
  67. insmod?ext2?
  68. set?root='(hd0,msdos1)'?
  69. search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  70. insmod?jpeg?
  71. if?background_image?/kaichuang.jpg;?then?
  72. ??true?
  73. else?
  74. ??set?menu_color_normal=white/black?
  75. ??set?menu_color_highlight=black/light-gray?
  76. fi?
  77. ###?END?/etc/grub.d/05_debian_theme?###?
  78. ?
  79. ###?BEGIN?/etc/grub.d/05_debian_theme.bak0?###?
  80. set?menu_color_normal=white/black?
  81. set?menu_color_highlight=black/light-gray?
  82. ###?END?/etc/grub.d/05_debian_theme.bak0?###?
  83. ?
  84. ###?BEGIN?/etc/grub.d/10_linux?###?
  85. if?[?${recordfail}?!=?1?];?then?
  86. ??if?[?-e?${prefix}/gfxblacklist.txt?];?then?
  87. ????if?hwmatch?${prefix}/gfxblacklist.txt?3;?then?
  88. ??????if?[?${match}?=?0?];?then?
  89. ????????set?linux_gfx_mode=keep?
  90. ??????else?
  91. ????????set?linux_gfx_mode=text?
  92. ??????fi?
  93. ????else?
  94. ??????set?linux_gfx_mode=text?
  95. ????fi?
  96. ??else?
  97. ????set?linux_gfx_mode=keep?
  98. ??fi?
  99. else?
  100. ??set?linux_gfx_mode=text?
  101. fi?
  102. export?linux_gfx_mode?
  103. if?[?"$linux_gfx_mode"?!=?"text"?];?then?load_video;?fi?
  104. menuentry?'**職教虛擬系統V1.0,with?Linux?3.0.0-14-generic'?--class?ubuntu?--class?gnu-linux?--class?gnu?--class?os?{?
  105. ????recordfail?
  106. ????set?gfxpayload=$linux_gfx_mode?
  107. ????insmod?gzio?
  108. ????insmod?part_msdos?
  109. ????insmod?ext2?
  110. ????set?root='(hd0,msdos1)'?
  111. ????search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  112. ????linux???/vmlinuz-3.0.0-14-generic?root=UUID=b318e04d-999c-4f93-b1e4-0b43283d46f8?ro???quiet?splash?vt.handoff=7?
  113. ????initrd??/initrd.img-3.0.0-14-generic?
  114. }?
  115. ?
  116. ##Clonezilla?For?Grub.cfg##?
  117. menuentry?"Clonezilla?For?shenzhi"?{?
  118. set?root=(hd0,1)?
  119. linux?/clonezilla/live/vmlinuz?boot=live?live-config?noswap?nolocales?edd=on?nomodeset?ocs_live_run=\"ocs-live-general\"?ocs_live_extra_param=\"\"?ocs_live_keymap=\"\"?ocs_live_batch=\"no\"?ocs_lang=\"\"?ip=frommedia?nosplash?live-media-path=/clonezilla/live?bootfrom=/dev/sda6?toram=filesystem.squashfs?
  120. initrd?/clonezilla/live/initrd.img?
  121. }?
  122. ?
  123. menuentry?'Ubuntu,?with?Linux?3.0.0-14-generic?(recovery?mode)'?--class?ubuntu?--class?gnu-linux?--class?gnu?--class?os?{?
  124. ????recordfail?
  125. ????insmod?gzio?
  126. ????insmod?part_msdos?
  127. ????insmod?ext2?
  128. ????set?root='(hd0,msdos1)'?
  129. ????search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  130. ????echo????'Loading?Linux?3.0.0-14-generic?...'?
  131. ????linux???/vmlinuz-3.0.0-14-generic?root=UUID=b318e04d-999c-4f93-b1e4-0b43283d46f8?ro?recovery?nomodeset??
  132. ????echo????'Loading?initial?ramdisk?...'?
  133. ????initrd??/initrd.img-3.0.0-14-generic?
  134. }?
  135. ###?END?/etc/grub.d/10_linux?###?
  136. ?
  137. ###?BEGIN?/etc/grub.d/20_linux_xen?###?
  138. ###?END?/etc/grub.d/20_linux_xen?###?
  139. ?
  140. ###?BEGIN?/etc/grub.d/20_memtest86+?###?
  141. menuentry?"Memory?test?(memtest86+)"?{?
  142. ????insmod?part_msdos?
  143. ????insmod?ext2?
  144. ????set?root='(hd0,msdos1)'?
  145. ????search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  146. ????linux16?/memtest86+.bin?
  147. }?
  148. menuentry?"Memory?test?(memtest86+,?serial?console?115200)"?{?
  149. ????insmod?part_msdos?
  150. ????insmod?ext2?
  151. ????set?root='(hd0,msdos1)'?
  152. ????search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  153. ????linux16?/memtest86+.bin?console=ttyS0,115200n8?
  154. }?
  155. ###?END?/etc/grub.d/20_memtest86+?###?
  156. ?
  157. ###?BEGIN?/etc/grub.d/30_os-prober?###?
  158. ###?END?/etc/grub.d/30_os-prober?###?
  159. ?
  160. ###?BEGIN?/etc/grub.d/40_custom?###?
  161. #?This?file?provides?an?easy?way?to?add?custom?menu?entries.??Simply?type?the?
  162. #?menu?entries?you?want?to?add?after?this?comment.??Be?careful?not?to?change?
  163. #?the?'exec?tail'?line?above.?
  164. ###?END?/etc/grub.d/40_custom?###?
  165. ?
  166. ###?BEGIN?/etc/grub.d/41_custom?###?
  167. if?[?-f??$prefix/custom.cfg?];?then?
  168. ??source?$prefix/custom.cfg;?
  169. fi?
  170. ###?END?/etc/grub.d/41_custom?###?

對應文件:/boot/grub/grub.cfg_ok

作用:精簡的grub配置文件

 
  1. #?
  2. #?DO?NOT?EDIT?THIS?FILE?
  3. #?
  4. #?It?is?automatically?generated?by?grub-mkconfig?using?templates?
  5. #?from?/etc/grub.d?and?settings?from?/etc/default/grub?
  6. #?
  7. ?
  8. ###?BEGIN?/etc/grub.d/00_header?###?
  9. if?[?-s?$prefix/grubenv?];?then?
  10. ??set?have_grubenv=true?
  11. ??load_env?
  12. fi?
  13. set?default="0"?
  14. if?[?"${prev_saved_entry}"?];?then?
  15. ??set?saved_entry="${prev_saved_entry}"?
  16. ??save_env?saved_entry?
  17. ??set?prev_saved_entry=?
  18. ??save_env?prev_saved_entry?
  19. ??set?boot_once=true?
  20. fi?
  21. ?
  22. function?savedefault?{?
  23. ??if?[?-z?"${boot_once}"?];?then?
  24. ????saved_entry="${chosen}"?
  25. ????save_env?saved_entry?
  26. ??fi?
  27. }?
  28. ?
  29. function?recordfail?{?
  30. ??set?recordfail=1?
  31. ??if?[?-n?"${have_grubenv}"?];?then?if?[?-z?"${boot_once}"?];?then?save_env?recordfail;?fi;?fi?
  32. }?
  33. ?
  34. function?load_video?{?
  35. ??insmod?vbe?
  36. ??insmod?vga?
  37. ??insmod?video_bochs?
  38. ??insmod?video_cirrus?
  39. }?
  40. ?
  41. insmod?part_msdos?
  42. insmod?ext2?
  43. set?root='(hd0,msdos3)'?
  44. search?--no-floppy?--fs-uuid?--set=root?b318e04d-999c-4f93-b1e4-0b43283d46f8?
  45. if?loadfont?/usr/share/grub/unicode.pf2?;?then?
  46. ??set?gfxmode=1024x768?
  47. ??load_video?
  48. ??insmod?gfxterm?
  49. ??insmod?part_msdos?
  50. ??insmod?ext2?
  51. ??set?root='(hd0,msdos1)'?
  52. ??search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  53. ??set?locale_dir=($root)/grub/locale?
  54. ??set?lang=en_US?
  55. ??insmod?gettext?
  56. fi?
  57. terminal_output?gfxterm?
  58. if?[?"${recordfail}"?=?1?];?then?
  59. ??set?timeout=-1?
  60. else?
  61. ??set?timeout=2?
  62. fi?
  63. ###?END?/etc/grub.d/00_header?###?
  64. ?
  65. ###?BEGIN?/etc/grub.d/05_debian_theme?###?
  66. insmod?part_msdos?
  67. insmod?ext2?
  68. set?root='(hd0,msdos1)'?
  69. search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  70. insmod?jpeg?
  71. if?background_image?/kaichuang.jpg;?then?
  72. ??true?
  73. else?
  74. ??set?menu_color_normal=white/black?
  75. ??set?menu_color_highlight=black/light-gray?
  76. fi?
  77. ###?END?/etc/grub.d/05_debian_theme?###?
  78. ?
  79. ###?BEGIN?/etc/grub.d/05_debian_theme.bak0?###?
  80. set?menu_color_normal=white/black?
  81. set?menu_color_highlight=black/light-gray?
  82. ###?END?/etc/grub.d/05_debian_theme.bak0?###?
  83. ?
  84. ###?BEGIN?/etc/grub.d/10_linux?###?
  85. if?[?${recordfail}?!=?1?];?then?
  86. ??if?[?-e?${prefix}/gfxblacklist.txt?];?then?
  87. ????if?hwmatch?${prefix}/gfxblacklist.txt?3;?then?
  88. ??????if?[?${match}?=?0?];?then?
  89. ????????set?linux_gfx_mode=keep?
  90. ??????else?
  91. ????????set?linux_gfx_mode=text?
  92. ??????fi?
  93. ????else?
  94. ??????set?linux_gfx_mode=text?
  95. ????fi?
  96. ??else?
  97. ????set?linux_gfx_mode=keep?
  98. ??fi?
  99. else?
  100. ??set?linux_gfx_mode=text?
  101. fi?
  102. export?linux_gfx_mode?
  103. if?[?"$linux_gfx_mode"?!=?"text"?];?then?load_video;?fi?
  104. menuentry?'**職教虛擬系統V1.0,with?Linux?3.0.0-14-generic'?--class?ubuntu?--class?gnu-linux?--class?gnu?--class?os?{?
  105. ????recordfail?
  106. ????set?gfxpayload=$linux_gfx_mode?
  107. ????insmod?gzio?
  108. ????insmod?part_msdos?
  109. ????insmod?ext2?
  110. ????set?root='(hd0,msdos1)'?
  111. ????search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  112. ????linux???/vmlinuz-3.0.0-14-generic?root=UUID=b318e04d-999c-4f93-b1e4-0b43283d46f8?ro???quiet?splash?vt.handoff=7?
  113. ????initrd??/initrd.img-3.0.0-14-generic?
  114. }?
  115. ?
  116. ##Clonezilla?For?Grub.cfg##?
  117. menuentry?"Clonezilla?For?shenzhi"?{?
  118. set?root=(hd0,1)?
  119. linux?/clonezilla/live/vmlinuz?boot=live?live-config?noswap?nolocales?edd=on?nomodeset?ocs_live_run=\"ocs-live-general\"?ocs_live_extra_param=\"\"?ocs_live_keymap=\"\"?ocs_live_batch=\"no\"?ocs_lang=\"\"?ip=frommedia?nosplash?live-media-path=/clonezilla/live?bootfrom=/dev/sda6?toram=filesystem.squashfs?
  120. initrd?/clonezilla/live/initrd.img?
  121. }?
  122. ?
  123. ###?END?/etc/grub.d/20_memtest86+?###?
  124. ?
  125. ###?BEGIN?/etc/grub.d/30_os-prober?###?
  126. ###?END?/etc/grub.d/30_os-prober?###?
  127. ?
  128. ###?BEGIN?/etc/grub.d/40_custom?###?
  129. #?This?file?provides?an?easy?way?to?add?custom?menu?entries.??Simply?type?the?
  130. #?menu?entries?you?want?to?add?after?this?comment.??Be?careful?not?to?change?
  131. #?the?'exec?tail'?line?above.?
  132. ###?END?/etc/grub.d/40_custom?###?
  133. ?
  134. ###?BEGIN?/etc/grub.d/41_custom?###?
  135. if?[?-f??$prefix/custom.cfg?];?then?
  136. ??source?$prefix/custom.cfg;?
  137. fi?
  138. ###?END?/etc/grub.d/41_custom?###?

對應文件:/etc/init/tty1.conf_half

作用: Root用戶自動登錄的腳本

 
  1. #?tty1?-?getty?
  2. #?
  3. #?This?service?maintains?a?getty?on?tty1?from?the?point?the?system?is?
  4. #?started?until?it?is?shut?down?again.?
  5. ?
  6. start?on?stopped?rc?RUNLEVEL=[2345]?
  7. stop?on?runlevel?[!2345]?
  8. ?
  9. respawn?
  10. exec?/sbin/getty?-8?38400?tty1?
  11. ?
  12. exec?/bin/login?-f?root?<?/dev/tty1?>?/dev/tty1?2>&1?
  13. #exec?/bin/login?-f?shenzhi?<?/dev/tty1?>?/dev/tty1?2>&1?

對應文件:/etc/init/tty1.conf_ok

作用:普通用戶自動登錄的腳本

 
  1. #?tty1?-?getty?
  2. #?
  3. #?This?service?maintains?a?getty?on?tty1?from?the?point?the?system?is?
  4. #?started?until?it?is?shut?down?again.?
  5. ?
  6. start?on?stopped?rc?RUNLEVEL=[2345]?
  7. stop?on?runlevel?[!2345]?
  8. ?
  9. respawn?
  10. exec?/sbin/getty?-8?38400?tty1?
  11. exec?/bin/login?-f?shenzhi?<?/dev/tty1?>?/dev/tty1?2>&1?

注:若要實現自動登錄,還需要在對應的用戶家目錄下的配置文件“.bashrc”中添加如下內容:

 
  1. if?[?$(tty)?==?"/dev/tty1"?];?then?
  2. startx?
  3. fi?

結語:

??? 在我看來,本篇僅是一個羅列,將所涉及的文件陳出,而未細說其中聯系,本人是想說,只是想著實在過于困難,故作罷。

【完成于網絡實驗室, 16:16 2012/2/18 】