From 056ac9efe971fb4b5fde7edb2710d61d3d213e28 Mon Sep 17 00:00:00 2001 From: timoxa0 Date: Sun, 11 Aug 2024 16:01:48 +0500 Subject: [PATCH] Implement comression script --- compress.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 compress.sh diff --git a/compress.sh b/compress.sh new file mode 100755 index 0000000..ba75b41 --- /dev/null +++ b/compress.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +source common.sh + +# Ensure that lon-tool installed +which lon-tool > /dev/null 2>&1 || { + log_err "lon-tool not found" + exit 1 +} + +# shellcheck disable=SC2162 +find ./raw/ -mindepth 1 -maxdepth 1 | read || { + log_err "Nothing to compress" + exit 1 +} + +# Settings +DATE=$(date +"%d-%m-%y") + +# Begin script +log "Start compressing images" +log "Current date: ${DATE}" + +for image in raw/*; do + full_image_path=$(realpath "$image") + image_name=$(basename "$full_image_path") + lni_name="${image_name/.img/""}" + full_lni_path=$(realpath "./out/${image_name/.img/".lni"}") + log "Compressing $lni_name" + lon-tool image create -n "$lni_name" -v "$DATE" "$full_image_path" "$full_lni_path" +done + +log "Stop compressing images" \ No newline at end of file