zoukankan      html  css  js  c++  java
  • init脚本

    #!/bin/sh
    echo "init..."
    mount -t proc proc /proc
    mount -t sysfs sysfs /sys
    mdev -s

    newroot=`findfs LABEL=ROOT`

    cleanmntdir()
    {
        rm -rf /mnt/*
    }

    copyroot()
    {
        FILES=`ls /`
        for F in $FILES
        do
            [ $F != 'mnt' ] && [ $F != 'proc' ] && [ $F != 'sys' ] && cp -a $F /mnt
        done
    }

    if [ "$?" = 0 ]
    then
        echo "findfs find newroot=$newroot"
        mount $newroot /mnt
        if [ "$?" = 0 ]
        then
            echo "mount $newroot on /mnt"
            #if [ ! -x "/mnt/linuxrc" ]; then
            #   echo "No init found. cp rootfs..."
        #       copyroot
            #fi
            cleanmntdir
            copyroot
            umount /proc
            umount /sys
            echo "switch_root..."
    #       exec /sbin/switch_root /mnt /linuxrc -c /dev/tty1
            exec /bin/sh
        fi
    fi

    echo "no ROOT found! enter factory boot..."
    exec /linuxrc

  • 相关阅读:
    关于session
    bootstrap的栅格系统
    js小知识点
    js获取div基础元素
    fixed固定元素
    定时器之延时触发鼠标悬浮事件
    Comparator分组测试
    List去重比较
    点击事件和双击事件
    开机自启动
  • 原文地址:https://www.cnblogs.com/cute/p/2096299.html
Copyright © 2011-2022 走看看