LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 980|回复: 2

看别人写的rc.sysinit,不太明白它的意思,请高手指点!

[复制链接]
发表于 2006-10-16 18:01:07 | 显示全部楼层 |阅读模式
[PHP]# Remount the root filesystem read-write.
#state=`awk '/(^\/dev\/root| \/ )/ { print $4 }' /proc/mounts`
#[ "$state" != "rw" ] && \
action $"Remounting root filesystem in read-write mode: " mount -n -o remount,rw /

# Mount /proc (done here so volume labels can work with fsck)
action $"Mounting proc filesystem: " mount -n -t proc /proc /proc
action $"Mounting sysfs filesystem: " mount -n -t sysfs /sys /sys

###################################################################

#加设备驱动程序

#modprobe sata_promise
#modprobe sata_sx4
#/modules-init-tools/insmod /lib/modules/2.6.11.11/kernel/drivers/scsi/sata_promise.ko


###################################################################
SOLID="/solid"
SOLIDFS="ext2"

MAX_BLOCK=500000
MIN_BLOCK=60000

echo "robing system partition..."
while [ 1=1 ]; do
SYSTEM_PARTITION=`awk '$3<MAX && $3>MIN {print "/dev/" $4}' MAX="$MAX_BLOCK" MIN="$MIN_BLOCK" /proc/partitions`
if [ -z "$SYSTEM_PARTITION" ]; then
    echo "not found system partition ......"
    sleep 1
else
    echo "system is: $SYSTEM_PARTITION"
    break
fi
done

# mount system_partition
# link /etc to hard disk
#

action $"Mounting system disk" mount -t $SOLIDFS  $SYSTEM_PARTITION $SOLID -o noatime,sync

if [ -d $SOLID/etc ]; then
    mv /etc         /.etc.Orig
    ln -sf $SOLID/etc       /etc
    >/etc/mtab
    echo `date` > /etc/CURRENT
else
    echo `date` > $SOLID/ERROR
    echo "*** Mounting system_partition maybe failed, "
    sleep 1
fi


#
# Append to /etc/fstab file every start
# echo "/dev/ram0 / ext2 defaults        0 0" >  /etc/fstab
#
#echo "Appending fstab file... "
#cp -dpR /etc/fstab.base /etc/fstab
#echo "$SYSTEM_PARTITION $SOLID $SOLIDFS noauto 0 0" >> /etc/fstab

####
# Mounting the partition for saving configuration files
# and log files. This partition is on hardisk or DOC/DOM,
# so we can restore the data after reboot.
# Otherwise, all files are located on ram disk,
# files gone away after restart the system.
#

# Remount the root filesystem read-write.
#state=`awk '/(^\/dev\/root| \/ )/ { print $4 }' /proc/mounts`
#[ "$state" != "rw" ] && \
action $"Remounting root filesystem in read-write mode: " mount -n -o remount,rw /


#action $"Activating swap partitions: " swapon -a -e -p0


>/etc/mtab[/PHP]


为什么我的LFS中提示找不到这个"action"命令?

我想让我的lfs 在启动这前先挂载第一个分区,然后把这个分区上的一个etc ln -sf 到统中用!
请问我该怎么做?

这事很急,请高手勿必回答一下!
发表于 2006-10-16 21:28:01 | 显示全部楼层
action 应该是 rc.sysinit 包含的另一个脚本(可能是 /etc/init.d/functions) 里的函数。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-10-17 02:25:18 | 显示全部楼层
搞定了直接用mount -n -o 就可以了!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表