purge_distfile.sh: Print info if percent changes
This commit is contained in:
parent
3513504f56
commit
ac844019f4
1 changed files with 12 additions and 2 deletions
|
@ -23,6 +23,7 @@ purge_distfiles() {
|
||||||
msg_error "No srcpkgs/*/template files found. Wrong working directory?"
|
msg_error "No srcpkgs/*/template files found. Wrong working directory?"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
percent=-1
|
||||||
for template in ${templates[@]}; do
|
for template in ${templates[@]}; do
|
||||||
pkg="$(echo "$template" | cut -d / -f 2)"
|
pkg="$(echo "$template" | cut -d / -f 2)"
|
||||||
if [ ! -L "srcpkgs/$pkg" ]; then
|
if [ ! -L "srcpkgs/$pkg" ]; then
|
||||||
|
@ -37,7 +38,11 @@ purge_distfiles() {
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
cur=$((cur + 1))
|
cur=$((cur + 1))
|
||||||
printf "\rScanning templates : %3d%% (%d/%d)" $((100*$cur/$max)) $cur $max
|
pnew=$((100 * cur / max))
|
||||||
|
if [ $pnew -ne $percent ]; then
|
||||||
|
percent=$pnew
|
||||||
|
printf "\rScanning templates : %3d%% (%d/%d)" $percent $cur $max
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
echo "Number of hashes : ${#my_hashes[@]}"
|
echo "Number of hashes : ${#my_hashes[@]}"
|
||||||
|
@ -49,6 +54,7 @@ purge_distfiles() {
|
||||||
distfiles=($XBPS_SRCDISTDIR/*/*)
|
distfiles=($XBPS_SRCDISTDIR/*/*)
|
||||||
max=${#distfiles[@]}
|
max=${#distfiles[@]}
|
||||||
cur=0
|
cur=0
|
||||||
|
percent=-1
|
||||||
for distfile in ${distfiles[@]}; do
|
for distfile in ${distfiles[@]}; do
|
||||||
inode=$(stat "$distfile" --printf "%i")
|
inode=$(stat "$distfile" --printf "%i")
|
||||||
if [ -z "${inodes[$inode]}" ]; then
|
if [ -z "${inodes[$inode]}" ]; then
|
||||||
|
@ -57,7 +63,11 @@ purge_distfiles() {
|
||||||
inodes[$inode]+="|$distfile"
|
inodes[$inode]+="|$distfile"
|
||||||
fi
|
fi
|
||||||
cur=$((cur + 1))
|
cur=$((cur + 1))
|
||||||
printf "\rCollecting inodes : %3d%% (%d/%d)" $((100*$cur/$max)) $cur $max
|
pnew=$((100 * cur / max))
|
||||||
|
if [ $pnew -ne $percent ]; then
|
||||||
|
percent=$pnew
|
||||||
|
printf "\rCollecting inodes : %3d%% (%d/%d)" $percent $cur $max
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
echo
|
echo
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue