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

  • 相关阅读:
    springboot(6)-热部署
    springboot(5)-文件上传
    ubuntu修改tomcat使用的jdk
    jstack使用
    HeapAnalyzer如何使用
    查看linux下tomcat使用的jdk版本
    ubuntu-tomcat安装目录
    vi命令
    211java-jdk安装记录
    linux的java安装目录
  • 原文地址:https://www.cnblogs.com/cute/p/2096299.html
Copyright © 2011-2022 走看看