/etc/rc.d/rc.sysinit脚本来源:Fedora 11HOSTNAME=`/bin/hostname` //使用命令获取主机名set -mif [ -f /etc/sysconfig/network ]; then. /etc/sysconfig/networkfi //若存在该脚本且为规则文件则运行之if [ -z "$HOSTNAME" -o "$HOSTNAME" = "(none)" ]; thenHOSTNAME=localhostfi#若HOSTNAME变量字符长度0或为(none)则设定为localhostif [ ! -e /proc/mounts ]; thenmount -n -t proc /proc /procmount -n -t sysfs /sys /sys >/dev/null 2>&1fi#若/proc/mounts 存在,则挂载proc目录 与sysfs目录(不写入/etc/mtab)if [ ! -d /proc/bus/usb ]; thenmodprobe usbcore >/dev/null 2>&1 && mount -n -t usbfs /proc/bus/usb /proc/bus/usbelsemount -n -t usbfs /proc/bus/usb /proc/bus/usbfi#若/proc/bus/usb目录存在,加载usbcore模块,并且以usbfs挂载/proc/bus/usb#否在直接挂载以上目录. /etc/init.d/functions //执行函数库脚本PLYMOUTH=[ -x /usr/bin/plymouth ] && PLYMOUTH=yes#如果plymouth存在且有执行权限,设定PLYMOUTH变量接下来是检查和修改Selinux状态,www.britepic.org以及设定selinux的几个函数##由于鸡与蛋的问题,该函数需要执行两次init_crypto()函数:#接下来是按照系统的版本打印一个启动的欢迎信息:# Print a text banner.echo -en $""t"tWelcome to "……………………# Fix console loglevelif [ -n "$LOGLEVEL" ]; then/bin/dmesg -n $LOGLEVELfi#打印相应日志级别的启动信息cmdline=$(cat /proc/cmdline) #获取一行信息(来自GRUB文件menu.lst)# Initialize hardware 初始化硬件if [ -f /proc/sys/kernel/modprobe ]; thenif ! strstr "$cmdline" nomodules && [ -f /proc/modules ] ; thensysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1else# We used to set this to NULL, but that causes "failed to exec" messages"sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1fifitouch /dev/.in_sysinit >/dev/null 2>&1#若cmdline变量里面没有包含”nomodules”字符串,则设置内核参数指定modporbe的位置,否则设置为true程序。# Set default affinityif [ -x /bin/taskset ]; then……………………#设置默认亲缘关系? 返回一个数值告知使用了哪个CPU?# Load other user-defined modulesfor file in /etc/sysconfig/modules/*.modules ; do[ -x $file ] && $filedone#执行用户自定义模块配置文件Load modules (for backward compatibility with VARs)if [ -f /etc/rc.modules ]; then/etc/rc.modulesfimount -n /dev/pts >/dev/null 2>&1[ -n "$SELINUX_STATE" ] && restorecon /dev/pts >/dev/null 2>&1#加载模块?# Configure kernel parametersupdate_boot_stage Rckernelparam //通知图形启动现在的启动状态sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1#设定内核参数# Set the hostname.update_boot_stage RChostnameaction $"Setting hostname ${HOSTNAME}: " hostname ${HOSTNAME}#设定内核参数{ rmmod scsi_wait_scan ; modprobe scsi_wait_scan ; rmmod scsi_wait_scan ; } >/dev/null 2>&1 //设定等待存储设备# Start any MD RAID arrays that haven"t been started yet[ -f /etc/mdadm.conf -a -x /sbin/mdadm ] && /sbin/mdadm -As --auto=yes –run#启动尚未启动的RAID设备# Device mapper & related initializationif ! __fgrep "device-mapper" /proc/devices >/dev/null 2>&1 ; then……………………#设备映射以及相关设置ipaddr=if [ "$HOSTNAME" = "localhost" -o "$HOSTNAME" = "localhost.localdomain" ]; thenipaddr=$(ip addr show to 0.0.0.0/0 scope global | awk "/[[:space:]]inet / { print gensub("/.*","","g",$2) }")for ip in $ipaddr ; doHOSTNAME=eval $(ipcalc -h $ipaddr 2>/dev/null)[ -n "$HOSTNAME" ] && { hostname ${HOSTNAME} ; break; }donefi从设置好的IP地址获取主机名,从DHCP服务器获取。接下来的一大段代码用来以只读方式挂载根目录,以及SELinux需要的一些操作:relable等,挂载本地文件系统,更新quota,初始化伪随机数生成器。# Configure machine if necessary.if [ -f /.unconfigured ]; thenif [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then………………………………………………#如果根目录下存在那个文件的话,把一些系统设置全部重设(管理员密码,网络设定,键盘布局等……)# Configure machine if necessary.if [ -f /.unconfigured ]; then#读取系统设定重新设定主机名。# Reread in network configuration data.if [ -f /etc/sysconfig/network ]; then. /etc/sysconfig/network…………#清理根目录下的一些文件,清理/var目录# Clean up /var.rm -rf /var/lock/cvs/* /var/run/screen/*#清理/tmp目录,把一些锁文件和其它的一些临时文件删除。[ -n "$SELINUX_STATE" ] && restorecon /tmp…………#创建ICE目录。# Make ICE directorymkdir -m 1777 -p /tmp/.ICE-unix >/dev/null 2>&1#启动交换分区,从fstab读取# Start up swapping.update_boot_stage Rcswap#创建系统崩溃标记,创建文件使下次启动自动检查文件系统。# create the crash indicator flag to warn on crashes, offer fsck with timeouttouch /.autofsck &> /dev/null#让rhgb知道脚本已经执行完成,根已经读写挂载。# Let rhgb know that we"re leaving rc.sysinitif [ -x /usr/bin/rhgb-client ] && /usr/bin/rhgb-client --ping ; then/usr/bin/rhgb-client --sysinitfi写好了一会了,一直没时间深入查看,有很多地方还是理解的不是很透彻。望批评指正!Ubuntu 9.04编译安装Python新版本导致出错的解决办法去掉Pidgin在Ubuntu 9.04中的气泡提醒相关资讯 Fedora 11
- 升级吧!Fedora 11所有更新已停止 (06/28/2010 16:28:49)
- 在Fedora 11中安装Apache2+PHP5+ (01/24/2010 18:28:46)
- Vista 系统环境硬盘安装Fedora 11 (01/08/2010 13:12:10)
| - Fedora 11 编译alsa 声卡 (02/25/2010 16:07:25)
- Fedora 11 下硬盘安装(升级)到 (01/08/2010 13:21:21)
- Fedora 11下7步轻松搞定LAMP安装 (11/16/2009 03:59:45)
|
本文评论 查看全部评论 (0)