Progressbar for extracting Basefiles
Karsten Nordsiek
kno at tuxedocomputers.com
Wed Jan 18 12:28:26 CET 2023
Hello to all,
a small problem and I hope you can help me
I want to show a progressbar while extracting the basefile so I have
done some changes as follows:
changes in /srv/fai/nfsroot/usr/sbin/ftar
Usage: ftar [OPTION] ... SOURCE
-1 Use only first tar file matching class name.
-c class[class] Define classes (space separated).
-d Delete all files in target before extracting.
-D Create debug output.
-h Show summary of options.
-p Show progress indicator
-r Recursively remove files in target before
extracting.
-s source_dir Look for source files relative to source_dir.
-t target_dir Extract files relativ to target_dir.
-v Be verbose. Not yet used.
(Option p added to the Optionlist)
declare Variables:
source=$FAI/files
target=$FAI_ROOT
deletefiles=0
removedir=0
tardone=0
single=0
ignore=0
progress=0
(added progress=0)
Changes in Section extract()
if [ $progress -eq 1 ]; then
echo "ftar: extracting $file to $target/$dir" | tr -s '/'
$catname $file | pv -s $(du -sb $file | awk '{print $1}') | tar
$xattrs --numeric-owner -C $target/$dir $vflag -xf -
else
echo "ftar: extracting $file to $target/$dir" | tr -s '/'
$catname $file | tar $xattrs --numeric-owner -C $target/$dir
$vflag -xf -
tardone=1
# if option -1 is set, only one class will be used
[ $single -eq 1 ] && exit 0
fi
Changes in File /srv/fai/nfsroot/usr/lib/fai/subroutines
changes in Section task_extrabse()
fetch-basefile
# remember, ftar extracts into $FAI_ROOT by default, so / means
$FAI_ROOT/
# copy the base file class based if it exists
[ -d $FAI/basefiles ] && ftar -1vp -s $FAI/basefiles /
if [ $? -ne 0 ]; then
if [ $do_init_tasks -eq 1 ]; then
ftar -p -1v -c base -s /var/tmp /
else
[ -d $NFSROOT/var/tmp ] &&
ftar -p -1v -c base -s $NFSROOT/var/tmp /
fi
# if no base file was extracted, call debootstrap
if [ ! -d $FAI_ROOT/etc ]; then
echo "No base file found. Calling debootstrap."
[ -z "$FAI_DEBOOTSTRAP" ] && die "\$FAI_DEBOOTSTRAP
undefined. Aborting"
call_debootstrap $FAI_DEBOOTSTRAP
task_error 801 $?
fi
fi
The file has been extracted but there is no output in Stdout (Terminal)
Let me know if you need more Informations
Greetings
Karsten Nordsiek
More information about the linux-fai
mailing list