#!/bin/bash

CPIO_FILE_XZ="ROOTFS.cpio.xz"

progress()
{
    while true;
    do
        echo -e "=\c"  #echo的参数中, -e表示开启转义, /c表示不换行
        sleep 1
    done
}

find * -depth -print | cpio -H newc -o > ../ROOTFS.cpio

cd ..

if [ -f $CPIO_FILE_XZ ]; then
    echo "ROOTFS.cpio.xz already exist in `pwd`, remove it before generate .cpio.xz!!!"
    rm $CPIO_FILE_XZ
fi


progress &
pidback=$!

xz -z ROOTFS.cpio

if mkfep -k ROOTFS.cpio.xz  ROOTFS.FEP ; then
    echo 'FEP generated!!'
    echo "`pwd`/ROOTFS.FEP"
fi


kill -9 $pidback
exit $?

输出:

[root@linux1 temp]# mkfep.sh    
265523 blocks
ROOTFS.cpio.xz already exist in /home/xiatian/, remove it before generate .cpio.xz!!!
=======================================================================FEP generated!!
/home/xiatian/ROOTFS.FEP

Logo

更多推荐