Files
kali-arm/common.d/compress_img.sh
Ben Wilson 228ccb1ce5 Merge branch 'master' into consistency
# Conflicts:
#	.gitignore
#	banana-pi.sh
#	banana-pro.sh
#	beaglebone-black.sh
#	chromebook-exynos.sh
#	chromebook-nyan.sh
#	common.d/builder.txt.example
#	common.d/compress_img.sh
#	common.d/variables.sh
#	cubieboard2.sh
#	cubietruck.sh
#	cubox-i4pro.sh
#	cubox.sh
#	gateworks-newport.sh
#	gateworks-ventana.sh
#	mini-x.sh
#	nanopc-t.sh
#	nanopi-neo-plus2-minimal.sh
#	nanopi-neo-plus2.sh
#	nanopi2.sh
#	odroid-c.sh
#	odroid-c2.sh
#	odroid-u2.sh
#	odroid-xu3.sh
#	pinebook-pro.sh
#	pinebook.sh
#	riotboard.sh
#	rpi-64bit-minimal.sh
#	rpi-64bit.sh
#	rpi.sh
#	rpi0w-minimal.sh
#	rpi0w-p4wnp1-aloa.sh
#	rpi0w-pitail.sh
#	rpi0w.sh
#	rpi1.sh
#	trimslice.sh
#	usb-armory-mki.sh
#	usb-armory-mkii.sh
#	utilite-pro.sh
2021-09-18 05:55:38 +01:00

16 lines
533 B
Bash

#!/usr/bin/env bash
log "compress image" green
if [ "${compress:=}" = xz ]; then
log "Compressing file: $(tput sgr0) ${imagename:=}.img" green
if [ "$(arch)" == 'x86_64' ] || [ "$(arch)" == 'aarch64' ]; then
limit_cpu pixz -p "${num_cores:=}" "${image_dir:=}"/"${imagename}".img # -p Nº cpu cores use
else
xz --memlimit-compress=50% -T "$num_cores" "${image_dir}"/"${imagename}".img # -T Nº cpu cores use
fi
chmod 0644 "${image_dir}"/"${imagename}".img.xz
else
chmod 0644 "${image_dir}"/"${imagename}".img
fi