Here is dir2sfs yad version. Contributors to this updated version include rg66, fredx181, misko_2083, stemsee, step, belham2, rufwoof and technosaurus.
topic on murga http://murga-linux.com/puppy/viewtopic.php?t=111674
Code: Select all
#!/bin/bash
#
[[ "`whoami`" != "root" ]] && exec sudo -E -S ${0} "$@"
[ ! -d "$1" ] && exit
if [ "$(echo "$1" | wc -w)" -gt 1 ]; then
yad --window-icon="application-x-squashfs-image" --title="Rename Folder" \
--text="Remove blank spaces from\n<b>$(basename "$1")</b> \
and try again." --text-align="center" --borders="10" --width="220" \
--no-buttons --timeout="3" --center
exit
fi
if [ -f "$1.sfs" ];then
yad --window-icon="application-x-squashfs-image" --title="Overwrite" \
--text="<b>$(basename $1).sfs</b> already exists.\n Would you like to overwrite it?\n" \
--text-align="center" --borders="10" --buttons-layout="center" \
--button="Yes:1" --button="No:0" --center --timeout-indicator=top \
--timeout 7
case $? in
0|252) exit ;;
70|1) [[ -f "$1.sfs" ]] && rm -f $1.sfs
[[ -f "$1.sfs-md5.txt" ]] && rm -f "$1.sfs-md5.txt";;
esac
fi
yad --window-icon="application-x-squashfs-image" \
--title "Choose Compression Type" \
--text="LZ4 is fastest; GZIP for older machines
XZ-HC is the highest compression; ZSTD is latest tech." \
--text-align="center" --borders="10" --buttons-layout="center" \
--columns=2 --button="GZIP:0" --button="XZ:1" --button="XZ-HC:2" \
--button="LZ4:3" --button="LZ4-HC:4" --button="ZSTD:5" --center \
--timeout-indicator=top --timeout 7
case $? in
0) COMP="-comp gzip" ;;
1) COMP="-comp xz" ;;
2) COMP="-comp xz -b 1024k -Xbcj x86" ;;
3) COMP="-comp lz4" ;;
4) COMP="-comp lz4 -Xhc" ;;
5) COMP="-comp zstd" ;;
*) COMP="-comp xz" ;;
esac
( sleep 0.5; pgrep -n mksquashfs >/tmp/$$ ) &
(script -q -c "stty rows 40 cols 100; mksquashfs "$1" "$1.sfs" $COMP" | \
while read -n 100 LINE; do echo $LINE | busybox strings | egrep '[0-9]\%' | \
awk '{print $NF}'; done ) | yad --progress --center --undecorated --on-top \
--skip-taskbar --progress-text="Building $1.sfs $COMP" --borders="10" \
--text-align="center" --button="Stop:1" \
--buttons-layout="center" --auto-close
case $? in
1) kill $(cat /tmp/$$)
[[ -f "$1.sfs" ]] && rm -f $1.sfs
[[ -f "$1.sfs-md5.txt" ]] && rm -f "$1.sfs-md5.txt";;
esac
[[ -f "$1.sfs" ]] && md5sum "$1.sfs" > "$1.sfs-md5.txt"
rm -f typescript
rm -f /tmp/$$
sync
rename as dir2sfs and place in /usr/local/bin, then
Code: Select all
chmod 755 /usr/local/bin/dir2sfs