1
0
This repository has been archived on 2025-01-10. You can view files and clone it, but cannot push or open issues or pull requests.
alacn1_pace_v5471/fsbuild.sh
2017-07-30 16:48:02 -03:00

60 lines
833 B
Bash
Executable File

#!/bin/bash
COLORINFO=4
TOOL=mksquashfs # squashfs-tools
ROOTFS=squashfs-root
if [ -z "$1" ]
then
echo "build squashfs from $ROOTFS"
echo "usage: $0 out.fs"
exit 1
fi
FNAME=$1
if [ ! -e "$ROOTFS" ]
then
echo "ERROR: $ROOTFS doesn't exist"
exit 1
fi
if [ ! -e "$ROOTFS/dev" ]
then
echo "ERROR: $ROOTFS/dev doesn't exist"
exit 1
fi
if [ -e "$FNAME" ]
then
#echo "ERROR: $FNAME already exist"
#exit 1
echo "WARNING: removing $FNAME"
rm -f $FNAME
fi
./permsrestore.sh
RET=$?
if [ $RET != 0 ]
then
exit 1
fi
echo "building $FNAME ..."
echo '------>>>'
tput setaf $COLORINFO
$TOOL $ROOTFS $FNAME -comp lzma -b 65536 -all-root -ef <( find $ROOTFS -name .gitkeep | sed "s@^$ROOTFS/@@" )
RET=$?
tput sgr0
echo '<<<------'
if [ $RET != 0 ]
then
echo "ERROR: build squashfs failed"
exit 1
fi
echo "$FNAME done."
exit 0