Made releng/auto_printsize ready for FreeBSD ("bash" linked to /bin/sh)

This commit is contained in:
Thomas Schmitt 2011-08-09 19:38:16 +00:00
parent 976a2483cd
commit cd8b719d66
1 changed files with 42 additions and 4 deletions

View File

@ -55,14 +55,51 @@ FILE_UPPER=10
printf "\n${SELF}: Generating sample tree in ${GEN_DATA_DIR} :\n"
count=0
date
for ((i1=0; i1 < ${DIR_UPPER}/4; i1++))
# Hopefully the for-loops are much faster than while-loops with arithmetics
# This needs 7/4*DIR_UPPER+FILE_UPPER (= 66) while-iterations
#
i1_list=
i1=0
o1=$(expr ${DIR_UPPER} / 4)
while test $i1 -lt $o1
do
for ((i2=0; i2 < ${DIR_UPPER}/2; i2++))
i1_list="$i1_list $i1"
i1=$(expr $i1 + 1)
done
i2_list=
i2=0
o2=$(expr ${DIR_UPPER} / 2)
while test $i2 -lt $o2
do
i2_list="$i2_list $i2"
i2=$(expr $i2 + 1)
done
i3_list=
i3=0
while test $i3 -lt ${DIR_UPPER}
do
i3_list="$i3_list $i3"
i3=$(expr $i3 + 1)
done
i_file_list=
i_file=0
while test $i_file -lt ${FILE_UPPER}
do
i_file_list="$i_file_list $i_file"
i_file=$(expr $i_file + 1)
done
#
# plus 1/8*DIR_UPPER*DIR_UPPER*DIR_UPPER*FILE_UPPER (= 40960) for-iterations
#
for i1 in $i1_list
do
for i2 in $i2_list
do
for ((i3=0; i3 < ${DIR_UPPER}; i3++))
for i3 in $i3_list
do
mkdir -p ${GEN_DATA_DIR}/DirOne$i1/DirTwo$i2/DirThree$i3
for ((i_file=0; i_file < ${FILE_UPPER}; i_file++))
for i_file in $i_file_list
do
echo -n \
> ${GEN_DATA_DIR}/DirOne$i1/DirTwo$i2/DirThree$i3/File_${i_file}
@ -72,6 +109,7 @@ do
done
echo " ${count} files created ..."
done
printf "done.\n"
date
du -s "${GEN_DATA_DIR}"