There is a floating save icon all that is required is to input the partition to save to eg 'sdb1'. If sfs files are loaded in aufs then a y/n dialogue opens for each dir (pup_ro10-44) that is to be included.
Any pointers appreciated.
Code: Select all
#!/bin/sh
# sfs-direct-save by stemsee copyright (c) 2017 Marcos Contant
# gpl 3.0
# no warranty use at own risk,
#
res=`xwininfo -root | grep 'geometry' | awk '{printf $2}' | cut -f1 -d'+'`
XX=`echo $res | cut -f1 -d'x'`
YY=`echo $res | cut -f2 -d'x'`
is=`mount | grep -e '/aufs/pup_rw'`
svd=`mount | grep -e '/aufs/pup_save'`
pos="+20+$((YY - 80))"
export pos
export is
export svd
ln -s /usr/sbin/sfs-direct-save /root/Startup/sfs-direct-save &> /dev/null
savefn () {
yad --geometry=200x20+0+0 --undecorated --no-border --on-top --no-focus --skip-taskbar --no-buttons --text "Saving" --progress --pulsate &
pid=$!
if [[ -d /aufs ]]; then
. /etc/DISTRO_SPECS
name=S_${DISTRO_FILE_PREFIX}_S.sfs
path=mnt
fi
savede=`yad --on-top --entry`
[[ -z "$savede" ]] && kill $pid && exit
echo "Proceeding with '$name' save on '/$path/$savede' with '$comp'"
yad --geometry=+0+0 --undecorated --skip-taskbar --no-buttons --text "Proceeding with '$name' saved on /$path/$savede" --timeout 1
[[ ! -d /mnt/$savede ]] && mkdir -p /mnt/$savede
mount -f /dev/$savede /mnt/$saved
[[ -f /mnt/$savede/"$name" ]] && rm -f /mnt/$savede/"$name"
sfs=`ls /aufs | grep 'pup_ro[0-4][0-9]'`
if [[ ! -z "$sfs" ]]; then
for i in $sfs
do
answer=`yad --text="include $i ... y or n?" --entry`
case $answer in
y|Y|yes|Yes|YES) rsync -aXxrtv --update /aufs/$i/* /mnt/$savede/"$name"-include;;
*) continue;;
esac
done
if [[ -z "$is" ]]; then
rsync -aXxrtv --update /aufs/pup_save/* /mnt/$savede/"$name"-include
mksquashfs /mnt/$savede/$name-include/* /$path/$savede/$name -keep-as-directory -noappend
else
rsync -aXxrtv --update /aufs/pup_rw/* /mnt/$savede/"$name"-include
mksquashfs /mnt/$savede/$name-include/* /$path/$savede/$name -keep-as-directory -noappend
fi
else
if [[ -z "$is" ]]; then
mksquashfs /aufs/pup_save/* /$path/$savede/$name -keep-as-directory -noappend
else
mksquashfs /aufs/pup_rw/* /$path/$savede/$name -keep-as-directory -noappend
fi
fi
kill $pid
yad --geometry=+0+0 --undecorated --skip-taskbar --no-buttons --text "Finished" --timeout 1
exit 0
}
export -f savefn
if [ -z "$svd" ]; then
ok=`yad --geometry="$pos" --on-top --no-focus --no-buttons --skip-taskbar \
--undecorated --form --field=SAVE:BTN "bash -c savefn"`
fi