日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > windows >内容正文

windows

学生机房虚拟化(十)系统操作设计实现

發(fā)布時間:2025/3/8 windows 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 学生机房虚拟化(十)系统操作设计实现 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

引入:

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

虛擬系統(tǒng)文檔:

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

【桌面自動運行文件autostart】

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

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

  • #?
  • #if?test?-x?/usr/lib/openbox/gnome-settings-daemon?>/dev/null;?then?
  • #??/usr/lib/openbox/gnome-settings-daemon?&?
  • #elif?which?gnome-settings-daemon?>/dev/null;?then?
  • #??gnome-settings-daemon?&?
  • #fi?
  • ?
  • #?If?you?want?to?use?XFCE?config?tools...?
  • #?
  • #xfce-mcs-manager?&?
  • #任務欄加載
  • tint2?&?
  • #自動運行終端,有時桌面會停止響應,如果終端開啟,輸入命令“openbox --reconfigure”刷新桌面即可。
  • xterm?&?
  • #net.jpg這個圖片,我沒有提供,是機房管理員在配置系統(tǒng)時系統(tǒng)的桌面背景圖片
  • feh?--bg-scale?/boot/net.jpg?&?
  • #打開系統(tǒng)說明文檔,只是起提示與說明作用的文本
  • leafpad?/etc/vmshenzhi.txt?&?
  • /etc/vmshenzhi.txt的內(nèi)容:

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

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

  • <?xml?version="1.0"?encoding="UTF-8"?>?
  • ?
  • <openbox_menu?xmlns="http://openbox.org/"?
  • ????????xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?
  • ????????xsi:schemaLocation="http://openbox.org/?
  • ????????????????file:///usr/share/openbox/menu.xsd">?
  • ?<!--圖形界面中的菜單-管理員狀態(tài)?-->?
  • <menu?id="root-menu"?label="Openbox?3">?
  • ??<item?label="**職教虛擬系統(tǒng)使用說明">?
  • ????<action?name="Execute"><execute>leafpad?/etc/vmshenzhi.txt</execute></action>?
  • ??</item>?
  • ?<!--自定義?添加的配置菜單內(nèi)容?-->?
  • <separator?/>?
  • ?
  • <menu?id="zheng-menu1"?label="[第一步]修改IP與主機名">?
  • ??<item?label="1.修改宿主機IP地址">?
  • ????<action?name="Execute"><execute>leafpad?/etc/network/interfaces</execute></action>?
  • ??</item>?
  • ??<item?label="2.修改宿主機名稱-1">?
  • ????<action?name="Execute"><execute>leafpad?/etc/hostname</execute></action>?
  • ??</item>?
  • ??<item?label="3.修改宿主機名稱-2">?
  • ????<action?name="Execute"><execute>leafpad?/etc/hosts</execute></action>?
  • ??</item>?
  • </menu>?
  • ??<item?label="[第二步]保存并重啟系統(tǒng)">?
  • ????<action?name="Execute"><execute>/etc/first.sh</execute></action>?
  • ??</item>?
  • ??<separator?/>?
  • <menu?id="zheng-menu3"?label="其它">?
  • ??<!--?This?requires?the?presence?of?the?'menu'?package?to?work?-->?
  • ??<item?label="Terminal?emulator">?
  • ????<action?name="Execute"><execute>x-terminal-emulator</execute></action>?
  • ??</item>?
  • ??<item?label="ObConf">?
  • ????<action?name="Execute"><execute>obconf</execute></action>?
  • ??</item>?
  • ???<item?label="關機">?
  • ????<action?name="Execute"><execute>shutdown?-h?now</execute></action>?
  • ???</item>?
  • ??<item?label="Tint2">?
  • ????<action?name="Execute"><execute>tint2</execute></action>?
  • ??</item>?
  • ??<item?label="Reconfigure">?
  • ????<action?name="Reconfigure"?/>?
  • ??</item>?
  • ??<item?label="!!!重新配置[慎重]!!!">?
  • ????<action?name="Execute"><execute>/etc/refirst2.sh</execute></action>?
  • ??</item>?
  • ??<item?label="Restart">?
  • ????<action?name="Restart"?/>?
  • ??</item>?
  • ??<separator?/>?
  • ??<item?label="Exit">?
  • ????<action?name="Exit"?/>?
  • ??</item>?
  • </menu>?
  • ??<separator?/>?
  • ?
  • <item?label="關于">?
  • ????<action?name="Execute"><execute>feh?/boot/kaichuang.jpg</execute></action>?
  • ??</item>?
  • </menu>?
  • ?
  • </openbox_menu>?
  • menu.xml_half中包含的文檔:

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

    作用:修改主機IP

  • ####################本文件是用來修改機器的IP地址的?
  • #?This?file?describes?the?network?interfaces?available?on?your?system?
  • #?and?how?to?activate?them.?For?more?information,?see?interfaces(5).?
  • ?
  • #?The?loopback?network?interface?
  • auto?lo?
  • iface?lo?inet?loopback?
  • ?
  • #?The?primary?network?interface?
  • auto?eth0?
  • #iface?eth0?inet?dhcp?
  • iface?eth0?inet?static?
  • ####下面一行修改為:192.168.208.10x?
  • ####例如,第1個學生機為192.168.208.101,第50個為192.168.208.150?
  • address?192.168.208.150?
  • ##########下面不修改##########?
  • netmask?255.255.255.0?
  • gateway?192.168.208.254?
  • broadcast?192.168.208.255?
  • 對應文件:/etc/hostname由文件/etc/hostname_half得來

    作用:修改主機名稱

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

    作用:修改主機名稱

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

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

  • #/bin/bash?
  • cp?-f?/etc/xdg/openbox/menu.xml_ok?/etc/xdg/openbox/menu.xml?
  • cp?-f?/etc/xdg/openbox/autostart_ok?/etc/xdg/openbox/autostart?
  • cp?-f?/etc/init/tty1.conf_ok?/etc/init/tty1.conf?
  • cp?/boot/grub/grub.cfg_ok?/boot/grub/grub.cfg?
  • #克隆系統(tǒng)后往往網(wǎng)卡不能啟動,執(zhí)行下面的命令就可以了。
  • rm?/etc/udev/rules.d/70-persistent-net.rules?
  • chmod?u+w?/vmos/shenzhi/Windows\?XP\?Professional.vmx?
  • chown?-R?shenzhi.shenzhi?/vmos/shenzhi/?
  • cp?/home/shenzhi/.config/openbox/menu.xml_ok?/home/shenzhi/.config/openbox/menu.xml?
  • chown?-R?shenzhi.shenzhi?/home/shenzhi/.config/openbox/?
  • chown?-R?shenzhi.shenzhi?/etc/xdg/openbox/?
  • reboot?
  • 對應文件:/etc/refirst2.sh

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

  • #/bin/bash?
  • #恢復圖形界面中的菜單至管理員狀態(tài)?
  • cp?-f?/etc/xdg/openbox/menu.xml_half?/etc/xdg/openbox/menu.xml?
  • #恢復自啟動文件?
  • cp?-f?/etc/xdg/openbox/autostart_half?/etc/xdg/openbox/autostart?
  • #設置root用戶開機自動登錄圖形界面?
  • cp?-f?/etc/init/tty1.conf_half?/etc/init/tty1.conf?
  • #刪除多余菜單,縮短開機時間?
  • cp?/boot/grub/grub.cfg_half?/boot/grub/grub.cfg?
  • #在刪除快照前,先將虛擬主文件設置為可修改權限?
  • chmod?u+w?/vmos/shenzhi/Windows\?XP\?Professional.vmx?
  • #刪除先前創(chuàng)建的快照00?
  • #vmrun?-T?ws?deletesnapshot?"/vmos/shenzhi/Windows?XP?Professional.vmx"?00?
  • #恢復網(wǎng)絡配置文件到初始模板?
  • cp?/etc/network/interfaces_half?/etc/network/interfaces?
  • #恢復主機名配置文件到初始模板?
  • cp?/etc/hosts_half?/etc/hosts?
  • #恢復主機名配置文件到初始模板?
  • cp?/etc/hostname_half?/etc/hostname?
  • #恢復使用說明文件?
  • cp?/etc/vmshenzhi.txt_ok?/etc/vmshenzhi.txt?
  • #重置結束,提醒用戶?
  • echo?"好了,現(xiàn)在可以重新開始配置了!"|leafpad??
  • ???? 2、普通用戶配置文件

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

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

  • <?xml?version="1.0"?encoding="UTF-8"?>?
  • ?
  • <openbox_menu?xmlns="http://openbox.org/"?
  • ????????xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?
  • ????????xsi:schemaLocation="http://openbox.org/?
  • ????????????????file:///usr/share/openbox/menu.xsd">?
  • ?
  • <menu?id="root-menu"?label="Openbox?3">?
  • ??<item?label="**職教虛擬系統(tǒng)">?
  • ????<action?name="Execute"><execute>/home/shenzhi/.config/openbox/hello.sh</execute></action>?
  • ??</item>?
  • ?<!--自定義?添加的配置菜單內(nèi)容?-->?
  • <menu?id="zheng-menu2"?label="[可選]配置虛擬機">?
  • ??<item?label="修改虛擬機快照00">?
  • ????<action?name="Execute"><execute>vmrun?-T?ws?start?"/vmos/shenzhi/Windows?XP?Professional.vmx"</execute></action>?
  • ??</item>?
  • </menu>?
  • ??<item?label="Term">?
  • ????<action?name="Execute"><execute>xterm</execute></action>?
  • ??</item>?
  • ??<item?label="[必選]保存并重啟">?
  • ????<action?name="Execute"><execute>/etc/shenzhi/rebootshenzhi.sh</execute></action>?
  • ??</item>?
  • ?
  • ?
  • <menu?id="zheng3"?label="其他">?
  • ??<item?label="Term">?
  • ????<action?name="Execute"><execute>xterm</execute></action>?
  • ??</item>?
  • ?
  • <separator?/>?
  • ??<!--?This?requires?the?presence?of?the?'menu'?package?to?work?-->?
  • ?
  • ??<item?label="刷新">?
  • ????<action?name="Reconfigure"?/>?
  • ??</item>?
  • ??<separator?/>?
  • </menu>?
  • </menu>?
  • ?
  • </openbox_menu>?
  • 對應文件:/etc/xdg/openbox/menu_ok

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

  • <?xml?version="1.0"?encoding="UTF-8"?>?
  • ?
  • <openbox_menu?xmlns="http://openbox.org/"?
  • ????????xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?
  • ????????xsi:schemaLocation="http://openbox.org/?
  • ????????????????file:///usr/share/openbox/menu.xsd">?
  • ?<!--圖形界面中的菜單-普通用戶狀態(tài)?-->?
  • <menu?id="root-menu"?label="Openbox?3">?
  • ??<item?label="**職教虛擬系統(tǒng)">?
  • ????<action?name="Execute"><execute>/home/shenzhi/.config/openbox/hello.sh</execute></action>?
  • ??</item>?
  • ?<!--自定義?添加的配置菜單內(nèi)容?-->?
  • ?
  • ??<!--???<item?label="Term">?-->?
  • ???<!--????<action?name="Execute"><execute>xterm</execute></action>?-->?
  • ???<!--??</item>?-->?
  • ??<!--?This?requires?the?presence?of?the?'menu'?package?to?work?-->?
  • ?
  • ??<item?label="刷新">?
  • ????<action?name="Reconfigure"?/>?
  • ??</item>?
  • ??<separator?/>???
  • <item?label="關于">?
  • ????<action?name="Execute"><execute>feh?/boot/kaichuang.jpg</execute></action>?
  • ??</item>?
  • </menu>?
  • ?
  • </openbox_menu>?
  • 對應文件:/home/shenzhi/.config/openbox/hello.sh

    作用:歡迎信息。

  • #/bin/bash?
  • echo?"歡迎使用深州職教開發(fā)的虛擬系統(tǒng)!"|leafpad?
  • ?

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

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

  • cp?/home/shenzhi/.config/openbox/menu.xml_ok2?/home/shenzhi/.config/openbox/menu.xml?
  • cp?/etc/xdg/openbox/autostart_ok2?/etc/xdg/openbox/autostart?
  • shutdown?-r?now?
  • 對應文件:/home/shenzhi/.config/openbox/menu.xml_ok2

    作用:清空的菜單內(nèi)容。

  • <?xml?version="1.0"?encoding="UTF-8"?>?
  • ?
  • <openbox_menu?xmlns="http://openbox.org/"?
  • ????????xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"?
  • ????????xsi:schemaLocation="http://openbox.org/?
  • ????????????????file:///usr/share/openbox/menu.xsd">?
  • ?
  • <menu?id="root-menu"?label="Openbox?3">?
  • ??<item?label="**職教虛擬系統(tǒng)">?
  • ????<action?name="Execute"><execute>/home/shenzhi/.config/openbox/hello.sh</execute></action>?
  • ??</item>?
  • ?<!--自定義?添加的配置菜單內(nèi)容?-->?
  • ?
  • <separator?/>?
  • ?
  • ??<!--?This?requires?the?presence?of?the?'menu'?package?to?work?-->?
  • ?
  • ??<item?label="刷新">?
  • ????<action?name="Reconfigure"?/>?
  • ??</item>?
  • ??<separator?/>?
  • </menu>?
  • ?
  • </openbox_menu>?
  • 對應文件:/etc/xdg/openbox/autostart_ok2

    作用:

  • #?
  • #?These?things?are?run?when?an?Openbox?X?Session?is?started.?
  • #?You?may?place?a?similar?script?in?$HOME/.config/openbox/autostart?
  • #?to?run?user-specific?things.?
  • #?
  • ?
  • #?If?you?want?to?use?GNOME?config?tools...?
  • #?
  • #if?test?-x?/usr/lib/openbox/gnome-settings-daemon?>/dev/null;?then?
  • #??/usr/lib/openbox/gnome-settings-daemon?&?
  • #elif?which?gnome-settings-daemon?>/dev/null;?then?
  • #??gnome-settings-daemon?&?
  • #fi?
  • ?
  • #?If?you?want?to?use?XFCE?config?tools...?
  • #?
  • #xfce-mcs-manager?&?
  • tint2?&?
  • #feh?--bg-scale?/boot/net.jpg?&?
  • #feh?/boot/kaichuang.jpg?&?
  • feh?--bg-scale?/boot/kaichuang.jpg?&?
  • rm?-Rf?~/*?
  • xscreensaver?-nosplash&?
  • chmod?u+w?/vmos/shenzhi/Windows\?XP\?Professional.vmx?
  • vmrun?-T?ws?reverttosnapshot?"/vmos/shenzhi/Windows?XP?Professional.vmx"?00?
  • chmod?u-w?/vmos/shenzhi/Windows\?XP\?Professional.vmx?
  • vmrun?-T?ws?start?"/vmos/shenzhi/Windows?XP?Professional.vmx"?
  • /etc/shenzhi/vmware-shutdown?
  • 對應文件:/etc/shenzhi/vmware-shutdown

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

  • #/bin/bash?
  • while?:?
  • do?
  • ????thread_num=`ps?-e?|grep?vmware?|?wc?-l`?
  • ????if?[?$thread_num?-eq?2?];?then?
  • ???????#date?>>?shutdowntime.log?
  • ???????shutdown?-h?now?
  • ???????exit?
  • ????else?
  • ????????echo?"Sleeping?2?second..."?
  • ????????sleep?2?
  • ????fi?
  • done?
  • 其它文件:

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

    作用:包含多個選項的系統(tǒng)菜單

  • #?
  • #?DO?NOT?EDIT?THIS?FILE?
  • #?
  • #?It?is?automatically?generated?by?grub-mkconfig?using?templates?
  • #?from?/etc/grub.d?and?settings?from?/etc/default/grub?
  • #?
  • ?
  • ###?BEGIN?/etc/grub.d/00_header?###?
  • if?[?-s?$prefix/grubenv?];?then?
  • ??set?have_grubenv=true?
  • ??load_env?
  • fi?
  • set?default="0"?
  • if?[?"${prev_saved_entry}"?];?then?
  • ??set?saved_entry="${prev_saved_entry}"?
  • ??save_env?saved_entry?
  • ??set?prev_saved_entry=?
  • ??save_env?prev_saved_entry?
  • ??set?boot_once=true?
  • fi?
  • ?
  • function?savedefault?{?
  • ??if?[?-z?"${boot_once}"?];?then?
  • ????saved_entry="${chosen}"?
  • ????save_env?saved_entry?
  • ??fi?
  • }?
  • ?
  • function?recordfail?{?
  • ??set?recordfail=1?
  • ??if?[?-n?"${have_grubenv}"?];?then?if?[?-z?"${boot_once}"?];?then?save_env?recordfail;?fi;?fi?
  • }?
  • ?
  • function?load_video?{?
  • ??insmod?vbe?
  • ??insmod?vga?
  • ??insmod?video_bochs?
  • ??insmod?video_cirrus?
  • }?
  • ?
  • insmod?part_msdos?
  • insmod?ext2?
  • set?root='(hd0,msdos3)'?
  • search?--no-floppy?--fs-uuid?--set=root?b318e04d-999c-4f93-b1e4-0b43283d46f8?
  • if?loadfont?/usr/share/grub/unicode.pf2?;?then?
  • ??set?gfxmode=1024x768?
  • ??load_video?
  • ??insmod?gfxterm?
  • ??insmod?part_msdos?
  • ??insmod?ext2?
  • ??set?root='(hd0,msdos1)'?
  • ??search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  • ??set?locale_dir=($root)/grub/locale?
  • ??set?lang=en_US?
  • ??insmod?gettext?
  • fi?
  • terminal_output?gfxterm?
  • if?[?"${recordfail}"?=?1?];?then?
  • ??set?timeout=-1?
  • else?
  • ??set?timeout=5?
  • fi?
  • ###?END?/etc/grub.d/00_header?###?
  • ?
  • ###?BEGIN?/etc/grub.d/05_debian_theme?###?
  • insmod?part_msdos?
  • insmod?ext2?
  • set?root='(hd0,msdos1)'?
  • search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  • insmod?jpeg?
  • if?background_image?/kaichuang.jpg;?then?
  • ??true?
  • else?
  • ??set?menu_color_normal=white/black?
  • ??set?menu_color_highlight=black/light-gray?
  • fi?
  • ###?END?/etc/grub.d/05_debian_theme?###?
  • ?
  • ###?BEGIN?/etc/grub.d/05_debian_theme.bak0?###?
  • set?menu_color_normal=white/black?
  • set?menu_color_highlight=black/light-gray?
  • ###?END?/etc/grub.d/05_debian_theme.bak0?###?
  • ?
  • ###?BEGIN?/etc/grub.d/10_linux?###?
  • if?[?${recordfail}?!=?1?];?then?
  • ??if?[?-e?${prefix}/gfxblacklist.txt?];?then?
  • ????if?hwmatch?${prefix}/gfxblacklist.txt?3;?then?
  • ??????if?[?${match}?=?0?];?then?
  • ????????set?linux_gfx_mode=keep?
  • ??????else?
  • ????????set?linux_gfx_mode=text?
  • ??????fi?
  • ????else?
  • ??????set?linux_gfx_mode=text?
  • ????fi?
  • ??else?
  • ????set?linux_gfx_mode=keep?
  • ??fi?
  • else?
  • ??set?linux_gfx_mode=text?
  • fi?
  • export?linux_gfx_mode?
  • if?[?"$linux_gfx_mode"?!=?"text"?];?then?load_video;?fi?
  • menuentry?'**職教虛擬系統(tǒng)V1.0,with?Linux?3.0.0-14-generic'?--class?ubuntu?--class?gnu-linux?--class?gnu?--class?os?{?
  • ????recordfail?
  • ????set?gfxpayload=$linux_gfx_mode?
  • ????insmod?gzio?
  • ????insmod?part_msdos?
  • ????insmod?ext2?
  • ????set?root='(hd0,msdos1)'?
  • ????search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  • ????linux???/vmlinuz-3.0.0-14-generic?root=UUID=b318e04d-999c-4f93-b1e4-0b43283d46f8?ro???quiet?splash?vt.handoff=7?
  • ????initrd??/initrd.img-3.0.0-14-generic?
  • }?
  • ?
  • ##Clonezilla?For?Grub.cfg##?
  • menuentry?"Clonezilla?For?shenzhi"?{?
  • set?root=(hd0,1)?
  • 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?
  • initrd?/clonezilla/live/initrd.img?
  • }?
  • ?
  • menuentry?'Ubuntu,?with?Linux?3.0.0-14-generic?(recovery?mode)'?--class?ubuntu?--class?gnu-linux?--class?gnu?--class?os?{?
  • ????recordfail?
  • ????insmod?gzio?
  • ????insmod?part_msdos?
  • ????insmod?ext2?
  • ????set?root='(hd0,msdos1)'?
  • ????search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  • ????echo????'Loading?Linux?3.0.0-14-generic?...'?
  • ????linux???/vmlinuz-3.0.0-14-generic?root=UUID=b318e04d-999c-4f93-b1e4-0b43283d46f8?ro?recovery?nomodeset??
  • ????echo????'Loading?initial?ramdisk?...'?
  • ????initrd??/initrd.img-3.0.0-14-generic?
  • }?
  • ###?END?/etc/grub.d/10_linux?###?
  • ?
  • ###?BEGIN?/etc/grub.d/20_linux_xen?###?
  • ###?END?/etc/grub.d/20_linux_xen?###?
  • ?
  • ###?BEGIN?/etc/grub.d/20_memtest86+?###?
  • menuentry?"Memory?test?(memtest86+)"?{?
  • ????insmod?part_msdos?
  • ????insmod?ext2?
  • ????set?root='(hd0,msdos1)'?
  • ????search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  • ????linux16?/memtest86+.bin?
  • }?
  • menuentry?"Memory?test?(memtest86+,?serial?console?115200)"?{?
  • ????insmod?part_msdos?
  • ????insmod?ext2?
  • ????set?root='(hd0,msdos1)'?
  • ????search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  • ????linux16?/memtest86+.bin?console=ttyS0,115200n8?
  • }?
  • ###?END?/etc/grub.d/20_memtest86+?###?
  • ?
  • ###?BEGIN?/etc/grub.d/30_os-prober?###?
  • ###?END?/etc/grub.d/30_os-prober?###?
  • ?
  • ###?BEGIN?/etc/grub.d/40_custom?###?
  • #?This?file?provides?an?easy?way?to?add?custom?menu?entries.??Simply?type?the?
  • #?menu?entries?you?want?to?add?after?this?comment.??Be?careful?not?to?change?
  • #?the?'exec?tail'?line?above.?
  • ###?END?/etc/grub.d/40_custom?###?
  • ?
  • ###?BEGIN?/etc/grub.d/41_custom?###?
  • if?[?-f??$prefix/custom.cfg?];?then?
  • ??source?$prefix/custom.cfg;?
  • fi?
  • ###?END?/etc/grub.d/41_custom?###?
  • 對應文件:/boot/grub/grub.cfg_ok

    作用:精簡的grub配置文件

  • #?
  • #?DO?NOT?EDIT?THIS?FILE?
  • #?
  • #?It?is?automatically?generated?by?grub-mkconfig?using?templates?
  • #?from?/etc/grub.d?and?settings?from?/etc/default/grub?
  • #?
  • ?
  • ###?BEGIN?/etc/grub.d/00_header?###?
  • if?[?-s?$prefix/grubenv?];?then?
  • ??set?have_grubenv=true?
  • ??load_env?
  • fi?
  • set?default="0"?
  • if?[?"${prev_saved_entry}"?];?then?
  • ??set?saved_entry="${prev_saved_entry}"?
  • ??save_env?saved_entry?
  • ??set?prev_saved_entry=?
  • ??save_env?prev_saved_entry?
  • ??set?boot_once=true?
  • fi?
  • ?
  • function?savedefault?{?
  • ??if?[?-z?"${boot_once}"?];?then?
  • ????saved_entry="${chosen}"?
  • ????save_env?saved_entry?
  • ??fi?
  • }?
  • ?
  • function?recordfail?{?
  • ??set?recordfail=1?
  • ??if?[?-n?"${have_grubenv}"?];?then?if?[?-z?"${boot_once}"?];?then?save_env?recordfail;?fi;?fi?
  • }?
  • ?
  • function?load_video?{?
  • ??insmod?vbe?
  • ??insmod?vga?
  • ??insmod?video_bochs?
  • ??insmod?video_cirrus?
  • }?
  • ?
  • insmod?part_msdos?
  • insmod?ext2?
  • set?root='(hd0,msdos3)'?
  • search?--no-floppy?--fs-uuid?--set=root?b318e04d-999c-4f93-b1e4-0b43283d46f8?
  • if?loadfont?/usr/share/grub/unicode.pf2?;?then?
  • ??set?gfxmode=1024x768?
  • ??load_video?
  • ??insmod?gfxterm?
  • ??insmod?part_msdos?
  • ??insmod?ext2?
  • ??set?root='(hd0,msdos1)'?
  • ??search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  • ??set?locale_dir=($root)/grub/locale?
  • ??set?lang=en_US?
  • ??insmod?gettext?
  • fi?
  • terminal_output?gfxterm?
  • if?[?"${recordfail}"?=?1?];?then?
  • ??set?timeout=-1?
  • else?
  • ??set?timeout=2?
  • fi?
  • ###?END?/etc/grub.d/00_header?###?
  • ?
  • ###?BEGIN?/etc/grub.d/05_debian_theme?###?
  • insmod?part_msdos?
  • insmod?ext2?
  • set?root='(hd0,msdos1)'?
  • search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  • insmod?jpeg?
  • if?background_image?/kaichuang.jpg;?then?
  • ??true?
  • else?
  • ??set?menu_color_normal=white/black?
  • ??set?menu_color_highlight=black/light-gray?
  • fi?
  • ###?END?/etc/grub.d/05_debian_theme?###?
  • ?
  • ###?BEGIN?/etc/grub.d/05_debian_theme.bak0?###?
  • set?menu_color_normal=white/black?
  • set?menu_color_highlight=black/light-gray?
  • ###?END?/etc/grub.d/05_debian_theme.bak0?###?
  • ?
  • ###?BEGIN?/etc/grub.d/10_linux?###?
  • if?[?${recordfail}?!=?1?];?then?
  • ??if?[?-e?${prefix}/gfxblacklist.txt?];?then?
  • ????if?hwmatch?${prefix}/gfxblacklist.txt?3;?then?
  • ??????if?[?${match}?=?0?];?then?
  • ????????set?linux_gfx_mode=keep?
  • ??????else?
  • ????????set?linux_gfx_mode=text?
  • ??????fi?
  • ????else?
  • ??????set?linux_gfx_mode=text?
  • ????fi?
  • ??else?
  • ????set?linux_gfx_mode=keep?
  • ??fi?
  • else?
  • ??set?linux_gfx_mode=text?
  • fi?
  • export?linux_gfx_mode?
  • if?[?"$linux_gfx_mode"?!=?"text"?];?then?load_video;?fi?
  • menuentry?'**職教虛擬系統(tǒng)V1.0,with?Linux?3.0.0-14-generic'?--class?ubuntu?--class?gnu-linux?--class?gnu?--class?os?{?
  • ????recordfail?
  • ????set?gfxpayload=$linux_gfx_mode?
  • ????insmod?gzio?
  • ????insmod?part_msdos?
  • ????insmod?ext2?
  • ????set?root='(hd0,msdos1)'?
  • ????search?--no-floppy?--fs-uuid?--set=root?2f3c44ac-7e62-4d78-af27-cb6a2a2c50f4?
  • ????linux???/vmlinuz-3.0.0-14-generic?root=UUID=b318e04d-999c-4f93-b1e4-0b43283d46f8?ro???quiet?splash?vt.handoff=7?
  • ????initrd??/initrd.img-3.0.0-14-generic?
  • }?
  • ?
  • ##Clonezilla?For?Grub.cfg##?
  • menuentry?"Clonezilla?For?shenzhi"?{?
  • set?root=(hd0,1)?
  • 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?
  • initrd?/clonezilla/live/initrd.img?
  • }?
  • ?
  • ###?END?/etc/grub.d/20_memtest86+?###?
  • ?
  • ###?BEGIN?/etc/grub.d/30_os-prober?###?
  • ###?END?/etc/grub.d/30_os-prober?###?
  • ?
  • ###?BEGIN?/etc/grub.d/40_custom?###?
  • #?This?file?provides?an?easy?way?to?add?custom?menu?entries.??Simply?type?the?
  • #?menu?entries?you?want?to?add?after?this?comment.??Be?careful?not?to?change?
  • #?the?'exec?tail'?line?above.?
  • ###?END?/etc/grub.d/40_custom?###?
  • ?
  • ###?BEGIN?/etc/grub.d/41_custom?###?
  • if?[?-f??$prefix/custom.cfg?];?then?
  • ??source?$prefix/custom.cfg;?
  • fi?
  • ###?END?/etc/grub.d/41_custom?###?
  • 對應文件:/etc/init/tty1.conf_half

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

  • #?tty1?-?getty?
  • #?
  • #?This?service?maintains?a?getty?on?tty1?from?the?point?the?system?is?
  • #?started?until?it?is?shut?down?again.?
  • ?
  • start?on?stopped?rc?RUNLEVEL=[2345]?
  • stop?on?runlevel?[!2345]?
  • ?
  • respawn?
  • exec?/sbin/getty?-8?38400?tty1?
  • ?
  • exec?/bin/login?-f?root?<?/dev/tty1?>?/dev/tty1?2>&1?
  • #exec?/bin/login?-f?shenzhi?<?/dev/tty1?>?/dev/tty1?2>&1?
  • 對應文件:/etc/init/tty1.conf_ok

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

  • #?tty1?-?getty?
  • #?
  • #?This?service?maintains?a?getty?on?tty1?from?the?point?the?system?is?
  • #?started?until?it?is?shut?down?again.?
  • ?
  • start?on?stopped?rc?RUNLEVEL=[2345]?
  • stop?on?runlevel?[!2345]?
  • ?
  • respawn?
  • exec?/sbin/getty?-8?38400?tty1?
  • exec?/bin/login?-f?shenzhi?<?/dev/tty1?>?/dev/tty1?2>&1?
  • 注:若要實現(xiàn)自動登錄,還需要在對應的用戶家目錄下的配置文件“.bashrc”中添加如下內(nèi)容:

  • if?[?$(tty)?==?"/dev/tty1"?];?then?
  • startx?
  • fi?
  • 結語:

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

    【完成于網(wǎng)絡實驗室, 16:16 2012/2/18 】

    本文轉自tiancong 51CTO博客,原文鏈接:http://blog.51cto.com/tiancong/782737

    總結

    以上是生活随笔為你收集整理的学生机房虚拟化(十)系统操作设计实现的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。