MochiMoppel wrote: Sat Oct 05, 2024 4:21 am
fredx181 wrote: Fri Oct 04, 2024 8:23 amHere's script "cr-sfs" that I made some time ago already, it should do what you want, using yad
for the initial gui and Xdialog
for the progress bar.
@fredx181 Are you sure that the Xdialog progress bar still works as it is supposed to work?
...
Yes, you are right, I tested earlier with older Xdialog, the new version in BWpup is built with GTK3, pity that it doesn't display percentage in progress bar.
@mow9902
Anyway, here's a much more basic script, usage e.g. ./cr-sfs /path/to/mydir /path/to/my.sfs
and it will directly show the Xdialog progress.
If you use the newest Xdialog the percentage will show above the progress bar (not inside it, see pic below).
If you use the older Xdialog, just remove lines 11, 18 and 19 (edit: and 20 too) (not needed as percentage is probably already showing inside progress bar)
It doesn't do any checking, i.e. if directory exist or if the .sfs possibly exist already .
Tell me if it's still not exactly what you need.
Code: Select all
#!/bin/bash
DIR="$1"
SFS="$2"
COMP="-comp xz -b 512k -Xbcj x86" # set mksquashfs options
(
script -q -c 'stty rows 40 cols 100; mksquashfs '"'$DIR'"' '"'$SFS'"' '"$COMP"'' |while read -n 250 LINE ; do
NAME="$(basename "$SFS")"
PERC="$(echo $LINE | busybox strings |egrep '[0-9]\%' |awk '{print $NF}' | tail -1)"
echo "XXX"
echo "Creating 4.0 filesystem on:"
echo "\\n"
echo "$NAME"
echo "\\n"
echo "Close this Window to Cancel processing."
echo "\\n"
echo "\\n"
echo "$PERC"
echo "XXX"
echo $LINE | busybox strings |egrep '[0-9]\%'| cut -f1 -d% |awk '{print $NF}'|grep -v '\.' ;done &
) | Xdialog --title "Building Sfs . . . " --gauge "" 12 90 0
if [ $? -ne 0 ]; then
SQUASHPID=$(ps -eo pid,cmd | grep "mksquashfs $DIR $SFS" | grep -v grep | awk '{ print $1 }')
kill $SQUASHPID
echo "SFS creation canceled"
fi
rm -f typescript
exit 0

- Running from BookwormPup with Xdialog built with GTK3
- Screenshot(6).png (19.95 KiB) Viewed 704 times