Code: Select all
#!/bin/sh
# sfs1-sfs2=sfs3
# Use this script to mount two sfs files and ignorantly create a third
# sfs file. Mount sfs1 which contains the files and more as in sfs2, then copy
# the files from sfs1 to a directory for sfs3, only if those files do not exist in
# sfs2.
Version=1
on=`ps -e | grep sfseparator.sh | wc -l`
[[ "$on" -gt 2 ]] && exit #check if running, one instance only
echo "Input path/sfs1 and path/sfs2 and output path/sfs3 directory
eg /mnt/sda1/fd64.sfs /mnt/sda1/fd1/fd64.sfs /mnt/mmcblk2p2/rm/fd64"
read one two three
echo "$one $two $three" > /tmp/paths
rm -rf $three
rm -f $three.sfs
mkdir -p /tmp/one
mkdir -p /tmp/two
umount -f /tmp/one
umount -f /tmp/two
umount -f $one
umount -f $two
mount -loop -t squashfs $one /tmp/one
mount -loop -t squashfs $two /tmp/two
rsync -av --progress --stats --compare-dest=/tmp/two/ /tmp/one/ $three/
sync
mksquashfs $three $three.sfs -comp xz
umount /tmp/one
umount /tmp/two