diff --git a/customscripts/battle_of_the_compressors.sh b/customscripts/battle_of_the_compressors.sh index 30f8326..905df16 100644 --- a/customscripts/battle_of_the_compressors.sh +++ b/customscripts/battle_of_the_compressors.sh @@ -18,7 +18,7 @@ RESET='\033[0m' echo -e "\n${GREEN}Battle of the img compressions${RESET}\n" # first, delete any outstanding logs or compressed files -if [[ "$1" =~ nuke ]]; then +if [[ "$2" =~ nuke ]]; then echo -e "${GREEN}Deleting old Files because NUKE was specified${RESET}" rm -f *.log *.zip *.xz *.tar *.gz *.7z echo -e "${GREEN}Done!${RESET}" @@ -42,8 +42,8 @@ xz_img_size=$(du --bytes "$img_file" | awk '{print $1}') xz_compressed_size=$(du --bytes "$img_file.xz" | awk '{print $1}') xz_compression_ratio=$(($xz_compressed_size / $xz_img_size)) echo -e "\n\nxz_img_size: $xz_img_size xz_compressed_size: $xz_compressed_size xz_compression_ratio: $xz_compression_ratio seconds: $xz_time start: $xz_start end: $xz_end\n\n" -echo -e "Size of file $img_file is: $(du -h $img_file | awk '{print $1}') or $(du --bytes $img_file | awk '{print $1}') bytes taking $xz_time seconds to complete" | tee -a "$log_file" -echo -e "Size of the compressed file is $(du -h $img_file.xz | awk '{print $1}') or $(du --bytes $img_file.xz | awk '{print $1}') bytes" | tee -a "$log_file" +# echo -e "Size of file $img_file is: $(du -h $img_file | awk '{print $1}') or $(du --bytes $img_file | awk '{print $1}') bytes taking $xz_time seconds to complete" | tee -a "$log_file" +# echo -e "Size of the compressed file is $(du -h $img_file.xz | awk '{print $1}') or $(du --bytes $img_file.xz | awk '{print $1}') bytes" | tee -a "$log_file" # gzip echo -e "\n${GREEN}Starting test with gzip${RESET}" @@ -55,7 +55,7 @@ gz_time=$(($gz_end - $gz_start)) gz_img_size=$(du --bytes "$img_file" | awk '{print $1}') gz_compressed_size=$(du --bytes "$img_file.gz" | awk '{print $1}') gz_compression_ratio=$(($gz_img_size / $gz_compressed_size)) -echo -e "\n\n${GREEN}GZ Finished!\n\tgz_img_size: $gz_img_size\n\tgz_compressed_size: $gz_compressed_size\n\tgz_compression_ratio: $gz_compression_ratio\n\tseconds: $gz_time\n\ystart: $gz_start\n\tend: $gz_end \n\tretcode: $gz_retcode${RESET}\n\n" +echo -e "\n\n${GREEN}GZ Finished!\n\tgz_img_size: $gz_img_size\n\tgz_compressed_size: $gz_compressed_size\n\tgz_compression_ratio: $gz_compression_ratio\n\tseconds: $gz_time\n\tstart: $gz_start\n\tend: $gz_end \n\tretcode: $gz_retcode${RESET}\n\n" # echo -e "Size of file $img_file is: $(du -h $img_file | awk '{print $1}') bytes taking $gz_time seconds to complete" | tee -a "$log_file" # echo -e "Size of the compressed file is $(du -h $img_file.gz | awk '{print $1}') or $(du --bytes $img_file.xz | awk '{print $1}') bytes" | tee -a "$log_file" @@ -66,10 +66,10 @@ tar -cvf "$img_file.tar" "$img_file" tar_retcode=$? tar_end=$(date +%s) tar_time=$(($tar_end - $tar_start)) -tar_img_size=$(du --bytes "$img_file") -tar_compressed_size=$(du --bytes "$img_file.tar") +tar_img_size=$(du --bytes "$img_file" | awk '{print $1}') +tar_compressed_size=$(du --bytes "$img_file.tar" | awk '{print $1}') tar_compression_ratio=$(($tar_img_size / $tar_compressed_size)) -echo -e "\n\n${GREEN}TAR Finished!\n\tar_img_size: $tar_img_size\n\tar_compressed_size: $tar_compressed_size\n\tar_compression_ratio: $tar_compression_ratio\n\tseconds: $tar_time\n\ystart: $tar_start\n\tend: $tar_end \n\tretcode: $tar_retcode${RESET}\n\n" +echo -e "\n\n${GREEN}TAR Finished!\n\ttar_img_size: $tar_img_size\n\ttar_compressed_size: $tar_compressed_size\n\ttar_compression_ratio: $tar_compression_ratio\n\tseconds: $tar_time\n\tstart: $tar_start\n\tend: $tar_end \n\tretcode: $tar_retcode${RESET}\n\n" # echo -e "Size of file $img_file is: $(du -h $img_file | awk '{print $1}') or $(du --bytes $img_file | awk '{print $1}') bytes taking $tar_time seconds to complete" | tee -a "$log_file" # echo -e "Size of the compressed file is $(du -h $img_file.tar | awk '{print $1}') or $(du --bytes $img_file.tar | awk '{print $1}') bytes" | tee -a "$log_file" @@ -79,10 +79,10 @@ sevenz_start="$(date +%s)" 7z a "$img_file.7z" "$img_file" sevenz_end=$(date +%s) sevevnz_time=$(($sevenz_end - $sevenz_start)) -seven_img_size=$(du --bytes "$img_file") -seven_compressed_size=$(du --bytes "$img_file.7z") +seven_img_size=$(du --bytes "$img_file" | awk '{print $1}') +seven_compressed_size=$(du --bytes "$img_file.7z" | awk '{print $1}') seven_compression_ratio=$(($sevem_img_size / $seven_compressed_size)) -echo -e "\n\n${GREEN}7ZIP Finished!\n\tseven_img_size: $sevem_img_size\n\seven_compressed_size: $seven_compressed_size\n\tar_compression_ratio: $seven_compression_ratio\n\tseconds: $tar_time\n\ystart: $tar_start\n\tend: $tar_end \n\tretcode: $tar_retcode${RESET}\n\n" +echo -e "\n\n${GREEN}7ZIP Finished!\n\tseven_img_size: $sevem_img_size\n\tseven_compressed_size: $seven_compressed_size\n\tseven_compression_ratio: $seven_compression_ratio\n\tseconds: $tar_time\n\tstart: $tar_start\n\tend: $tar_end \n\tretcode: $tar_retcode${RESET}\n\n" # echo -e "Size of file $img_file is: $(du -h "$img_file" | awk '{print $1}') or $(du --bytes "$img_file" | awk '{print $1}') bytes taking "$sevenz_time" seconds to complete" | tee -a "$log_file" # echo -e "Size of the compressed file is $(du -h "$img_file.7z" | awk '{print $1}') or $(du --bytes "$img_file.7z" | awk '{print $1}') bytes" | tee -a "$log_file" @@ -93,10 +93,10 @@ zip -v "$img_file.zip" "$img_file" zip_retcode=$? zip_end=$(date +%s) zip_time=$(($zip_end - $zip_start)) -zip_img_size=$(du --bytes "$img_file") -zip_compressed_size=$(du --bytes "$img_file.zip") -zip_compression_ratio=$(($zip_img_size / $zip_compressed_size)) -echo -e "\n\n${GREEN}ZIP Finished!\n\tzip_img_size: $zip_img_size\n\zip_compressed_size: $zip_compressed_size\n\zip_compression_ratio: $zip_compression_ratio\n\tseconds elapssed: $zip_time\n\ystart: $zip_start\n\tend: $zip_end \n\tretcode: $zip_retcode${RESET}\n\n" +zip_img_size=$(du --bytes "$img_file" | awk '{print $1}') +zip_compressed_size=$(du --bytes "$img_file.zip" | awk '{print $1}') +zip_compression_ratio=$(($zip_compressed_size / $zip_img_size)) +echo -e "\n\n${GREEN}ZIP Finished!\n\tzip_img_size: $zip_img_size\n\tzip_compressed_size: $zip_compressed_size\n\tzip_compression_ratio: $zip_compression_ratio\n\tseconds elapssed: $zip_time\n\tstart: $zip_start\n\tend: $zip_end \n\tretcode: $zip_retcode${RESET}\n\n" # echo -e "Size of file $img_file is: $(du -h $img_file | awk '{print $1}') or $(du --bytes $img_file | awk '{print $1}') bytes taking $zip_time seconds to complete" | tee -a "$log_file" # echo -e "Size of the compressed file is $(du -h $img_file.zip | awk '{print $1}') or $(du --bytes $img_file.zip | awk '{print $1}') bytes" | tee -a "$log_file"