fixes to imagen
This commit is contained in:
+3
-19
@@ -145,28 +145,12 @@ for ver in "${NODE[@]}"; do
|
||||
done
|
||||
|
||||
case "$(uname -m)" in
|
||||
'aarch64')
|
||||
scripts=(
|
||||
yq
|
||||
)
|
||||
;;
|
||||
'x86_64')
|
||||
scripts=(
|
||||
yq
|
||||
)
|
||||
;;
|
||||
'armv7l')
|
||||
scripts=(
|
||||
yq
|
||||
)
|
||||
;;
|
||||
aarch64|x86_64|armv7l) ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
|
||||
for SCRIPT in "${scripts[@]}"; do
|
||||
printf "\n\t🧨 Executing %s.sh 🧨\t\n" "${SCRIPT}"
|
||||
bash "/imagegeneration/installers/${SCRIPT}.sh"
|
||||
done
|
||||
printf "\n\t🧨 Executing yq.sh 🧨\t\n"
|
||||
bash "/imagegeneration/installers/yq.sh"
|
||||
|
||||
printf "\n\t🐋 Cleaning image 🐋\t\n"
|
||||
apt-get clean
|
||||
|
||||
+12
-16
@@ -27,20 +27,16 @@ download_with_retries() {
|
||||
|
||||
get_hash_from_remote_file() {
|
||||
local url=$1
|
||||
local keywords=("$2" "$3")
|
||||
local delimiter=${4:-' '}
|
||||
local word_number=${5:-1}
|
||||
local matching_line
|
||||
matching_line=$(curl -fsSL "$url" | sed 's/ */ /g' | tr -d '`')
|
||||
for keyword in "${keywords[@]}"; do
|
||||
matching_line=$(echo "$matching_line" | grep "$keyword" || true)
|
||||
done
|
||||
matching_line=$(echo "$matching_line" | head -n1)
|
||||
if [ -z "$matching_line" ]; then
|
||||
echo "Keywords (${keywords[*]}) not found in the file with hashes." >&2
|
||||
local keyword=$2
|
||||
local delimiter=${3:-' '}
|
||||
local word_number=${4:-1}
|
||||
local line
|
||||
line=$(curl -fsSL "$url" | sed 's/ */ /g' | tr -d '`' | grep "$keyword" | head -n1 || true)
|
||||
if [ -z "$line" ]; then
|
||||
echo "Keyword ($keyword) not found in the file with hashes." >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "$matching_line" | cut -d "$delimiter" -f "$word_number" | tr -d -c '[:alnum:]'
|
||||
echo "$line" | cut -d "$delimiter" -f "$word_number" | tr -d -c '[:alnum:]'
|
||||
}
|
||||
|
||||
use_checksum_comparison() {
|
||||
@@ -63,9 +59,9 @@ use_checksum_comparison() {
|
||||
|
||||
yq_arch() {
|
||||
case "$(uname -m)" in
|
||||
'aarch64') echo 'arm64' ;;
|
||||
'x86_64') echo 'amd64' ;;
|
||||
'armv7l') echo 'arm' ;;
|
||||
aarch64) echo arm64 ;;
|
||||
x86_64) echo amd64 ;;
|
||||
armv7l) echo arm ;;
|
||||
*) exit 1 ;;
|
||||
esac
|
||||
}
|
||||
@@ -73,6 +69,6 @@ yq_arch() {
|
||||
base_url="https://github.com/mikefarah/yq/releases/latest/download"
|
||||
filename="yq_linux_$(yq_arch)"
|
||||
download_with_retries "${base_url}/${filename}" "/tmp" "yq"
|
||||
external_hash=$(get_hash_from_remote_file "${base_url}/checksums" "${filename} " "" " " "19")
|
||||
external_hash=$(get_hash_from_remote_file "${base_url}/checksums" "${filename} " " " "19")
|
||||
use_checksum_comparison "/tmp/yq" "${external_hash}"
|
||||
sudo install /tmp/yq /usr/bin/yq
|
||||
|
||||
Reference in New Issue
Block a user