fix image generation script

This commit is contained in:
generall
2024-02-14 21:25:53 +01:00
parent f2afa13b60
commit 914a88cdb0
27 changed files with 22 additions and 7 deletions
+10
View File
@@ -2,6 +2,8 @@
# directory of the current script
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
@@ -14,6 +16,14 @@ function get_value_from_md() {
local key=$1
local file=$2
local value=$(grep -m 1 "^$key:" "$file" | sed "s/^$key: //")
# remove comments from the value, starting with #
value=$(echo "$value" | sed 's/#.*//')
# remove leading and trailing spaces
value=$(echo "$value" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
echo "$value"
}
+9
View File
@@ -57,6 +57,15 @@ function check_file_exists_and_new() {
exit 0
fi
fi
abs_path_file=$(realpath "${file}")
abs_path_to_image=$(realpath "${PATH_TO_IMAGE}")
if [ "${abs_path_file}" == "${abs_path_to_image}" ]; then
echo "Source image and destination image are the same. Please provide a different destination"
exit 1
fi
}
check_file_exists_and_new "${IMG_DESTINATION}/social_preview.jpg"