引入:
在前篇思路的指导下,进行了为期三个星期的调试最终建立了一个初步成熟的,具有亲和力的配置界面,现在此虚拟系统已经初步部署了一个机房,用来学生日常上课。在本篇中,本人并不试图去花篇幅讲解彼此之间如何配合,如此设计缘由等等。因为,逻辑的东西真的不好用语言来说,只好将之以一种最直接的方式完整呈现给读者。如果你全全操作,一定会明了我的设计思路及各文档的含义的。
虚拟系统文档:
1、管理员克隆后初次登录相关
【桌面自动运行文件autostart】
对应文件:/etc/xdg/openbox/autostart_half
注:*_half文件,以及后面要出现的*_ok,均是为区分部署给不同用户而设定的。half表示,使用此配置文件时,系统的配置尚未完成。ok表示,通过此配置文件,系统配置即将完成(结束)。这样做有一个好处,当我需要重置系统设置时,可以将所有half文件复制并覆盖对应的配置文件(如:autostart_half覆盖autostart)。而在配置完autostart_half内容的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这个图片,我没有提供,是机房管理员在配置系统时系统的桌面背景图片
- feh --bg-scale /boot/net.jpg &
- #打开系统说明文档,只是起提示与说明作用的文本
- leafpad /etc/vmshenzhi.txt &
/etc/vmshenzhi.txt的内容:
- 现在大家看到的这篇文档,是在克隆系统后交付学生使用前所需的操作
- 说明。在桌面上单击右键,会有一个菜单弹出。我们可能用到的菜单均是
- 含有汉字的,英文的不要操作!
- 菜单的第一项:“**职教虚拟系统使用说明”,就是本文档。接下来会
- 有两大步操作,依次是:
- 第一大步[修改IP与主机名]:
- 1.修改宿主机IP地址
- 2.修改宿主机名称-1
- 3.修改宿主机名称-2
- 第二大步:
- 保存并重启系统
- [之后会进入虚拟机的编辑界面,设置完虚拟机后再次点选重启的菜单项就完成了所有操作]
- 如果在修改过程中出现了无法更正的错误,可以重新对系统进行设置,
- 此时需要选择的菜单是其它子菜单中的"重新配置[慎重]",但要慎重进行选择,系统
- 会进行重启。如果一切顺利,在设置完成后,选择最下方的菜单“设置完毕
- 重启系统”!
- [完]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">
- <!--图形界面中的菜单-管理员状态 -->
- <menu id="root-menu" label="Openbox 3">
- <item label="**职教虚拟系统使用说明">
- <action name="Execute"><execute>leafpad /etc/vmshenzhi.txt</execute></action>
- </item>
- <!--自定义 添加的配置菜单内容 -->
- <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="[第二步]保存并重启系统">
- <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作用相反。其余细节部分不再细述。
- #/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
- #克隆系统后往往网卡不能启动,执行下面的命令就可以了。
- 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
- #恢复图形界面中的菜单至管理员状态
- 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
- #删除先前创建的快照00
- #vmrun -T ws deletesnapshot "/vmos/shenzhi/Windows XP Professional.vmx" 00
- #恢复网络配置文件到初始模板
- 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 "好了,现在可以重新开始配置了!"|leafpad
2、普通用户配置文件
对应文件:cat /home/shenzhi/.config/openbox/menu.xml_ok
作用: 位于普通用户“shenzhi”家目录下的菜单配置文件,用于接上面的设置后通过普通用户下的菜单再次对系统进行配置。
- <?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="**职教虚拟系统">
- <action name="Execute"><execute>/home/shenzhi/.config/openbox/hello.sh</execute></action>
- </item>
- <!--自定义 添加的配置菜单内容 -->
- <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">
- <!--图形界面中的菜单-普通用户状态 -->
- <menu id="root-menu" label="Openbox 3">
- <item label="**职教虚拟系统">
- <action name="Execute"><execute>/home/shenzhi/.config/openbox/hello.sh</execute></action>
- </item>
- <!--自定义 添加的配置菜单内容 -->
- <!-- <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 "欢迎使用深州职教开发的虚拟系统!"|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
作用:清空的菜单内容。
- <?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="**职教虚拟系统">
- <action name="Execute"><execute>/home/shenzhi/.config/openbox/hello.sh</execute></action>
- </item>
- <!--自定义 添加的配置菜单内容 -->
- <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
作用:实时监控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
作用:包含多个选项的系统菜单
- #
- # 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 '**职教虚拟系统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 '**职教虚拟系统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
注:若要实现自动登录,还需要在对应的用户家目录下的配置文件“.bashrc”中添加如下内容:
- if [ $(tty) == "/dev/tty1" ]; then
- startx
- fi
结语:
在我看来,本篇仅是一个罗列,将所涉及的文件陈出,而未细说其中联系,本人是想说,只是想着实在过于困难,故作罢。
【完成于网络实验室, 16:16 2012/2/18 】