zoukankan      html  css  js  c++  java
  • download fomat install rootfs script

    download.sh

    #!/bin/sh

    # check the network first

    serverip=$(cat /tmp/serverip)

    while true; do
    ping -c 5 $serverip;
    if [ $? = 0 ];then
    break;
    fi
    done

    # then disable the firewall
    /etc/init.d/firewall stop

    cd /tmp

    tftp -g -r rootfs.tar.gz $serverip

    cd /

    format.sh

    #!/bin/sh

    mmcdev=/dev/mmcblk0
    # check device
    while true;do
    if [ -e $mmcdev ];then
    break;
    else
    sleep 1;
    fi
    done

    echo "d
    n
    p
    1


    w" |/usr/sbin/fdisk $mmcdev

    mmcpart=${mmcdev}p1

    while true;do
    if [ -e $mmcpart ];then
    break;
    else
    sleep 1;
    fi
    done

    echo "y
    " | /usr/sbin/mkfs.ext4 $mmcpart

    install.sh

    #!/bin/sh

    mmcpart=/dev/mmcblk0p1

    if [ ! -e $mmcpart ];then
    echo "format the eMMC device failed";
    exit
    fi

    tarfile=/tmp/rootfs.tar.gz

    if [ ! -f $tarfile ]; then
    echo "download the armbian failed";
    exit
    fi

    mount $mmcpart /mnt

    if [ $? = 1 ];then
    echo "format the eMMC device failed";
    exit
    fi

    cd /mnt

    tar vxzf $tarfile

    cd /

    umount /mnt

    echo "install finish"

  • 相关阅读:
    并查集
    归并排序
    树的操作
    活动安排
    动态规划-股票交易
    网络流
    linux 展开
    linux 反引号、单引号、双引号
    linux 命令行快捷键
    判断一个点是否在三角形内部和边界上
  • 原文地址:https://www.cnblogs.com/lianghong881018/p/10273229.html
Copyright © 2011-2022 走看看