3、初始化rootfs脚本--创建小型linux


#!/bin/bash
# function:Initalize the system script
source /scripts/automount.sh

ROOTFS () {
[ -d $N ] && (mount |grep $N) || echo "ERROR,The $N is not mounted";read -p "Do you want to continue.(y/n)" ANSWER
if [ "$ANSWER" = "n" -o "$ANSWER" = "N" ];then
       exit
fi
 rm -rf $N/*
 mkdir -pv $N/{boot,proc,sys,dev,home,root,etc/{rc.d,sysconfig,init.d},bin,sbin,lib,usr/{bin,sbin,lib,include},var/{log,run},tmp,mnt,opt,media}
 echo "mkdir directory sucessful."
 chmod 1777 $N/tmp
 echo "change the tmp type sucessful."
 cat >> $N/etc/inittab << EOF
id:3:initdefault:
si::sysinit:/etc/rc.d/rc.sysinit
EOF
[ $? -eq 0 ] &&  echo "$N/etc/inittab is sucessful."
 cat >> $N/etc/rc.d/rc.sysinit << EOF
       #!/bin/bash
       echo -e "Welcome to fish linux."
       mount -n -o remount,rw /
       mount -n -a
       /bin/bash
EOF
[ $? -eq 0 ] && echo "$N/etc/rc.d/rc.sysinit is sucessful."
  chmod +x $N/etc/rc.d/rc.sysinit
  cat >> $N/etc/fstab << EOF
       /dev/sda2       /       ext3    defaults        0 0
       /dev/sda1       /boot   ext3    defaults        0 0
       sysfs           /sys    sysfs   defaults        0 0
       proc            /proc   proc    defaults        0 0
EOF
[ $? -eq 0 ] && echo "The $N/etc/fstab is sucessful."

}
ROOTFS $N

本文出自 “fish” 博客,请务必保留此出处http://seeds.blog.51cto.com/1501815/1396132

3、初始化rootfs脚本--创建小型linux,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。