spbx/roms/srcs/Decompress_rfs/mkcramfs.sh

35 lines
536 B
Bash
Raw Normal View History

2019-03-11 00:13:23 +00:00
#!/bin/sh
switch_file=rfs.cpio.gz
target_file=cramfs.tar.gz
if [ "$1" == "" ]; then
echo "Please input source file"
exit
fi
if [ -f $1 ]; then
echo "Decompress $1 rootfs file to $target_file"
else
echo "Input source [$1] not exists"
exit
fi
dd skip=1 if=$1 of=./$switch_file bs=64 > /dev/null
mkdir cramfs
cd cramfs
zcat ../$switch_file | cpio -idmv > /dev/null
cd ..
if [ -f $target_file ]; then
echo "Remove old target file"
rm $target_file
fi
tar -cvzf $target_file ./cramfs > /dev/null
rm cramfs -rf
rm $switch_file