2023-03-10 05:47:49 +00:00
|
|
|
#!/bin/bash
|
2023-03-18 13:54:46 +00:00
|
|
|
TMP_DIR="/tmp"
|
|
|
|
yad --form --field="Pretty name" "" --field="Name" "" --field="Releases" "" --field="Editions" "" --field="URL" "" --field="ISO" "" --field="Hash" "" > ${TMP_DIR}/template.tmp
|
2023-03-10 05:47:49 +00:00
|
|
|
|
|
|
|
|
2023-03-18 13:54:46 +00:00
|
|
|
PRETTY_NAME="$(cat ${TMP_DIR}/template.tmp | cut -d'|' -f1)"
|
|
|
|
NAME="$(cat ${TMP_DIR}/template.tmp | cut -d'|' -f2)"
|
|
|
|
RELEASES="$(cat ${TMP_DIR}/template.tmp | cut -d'|' -f3)"
|
|
|
|
EDITIONS="$(cat ${TMP_DIR}/template.tmp | cut -d'|' -f4)"
|
|
|
|
URL="$(cat ${TMP_DIR}/template.tmp | cut -d'|' -f5)"
|
|
|
|
ISO="$(cat ${TMP_DIR}/template.tmp | cut -d'|' -f6)"
|
|
|
|
HASH="$(cat ${TMP_DIR}/template.tmp | cut -d'|' -f7)"
|
2023-03-14 12:44:52 +00:00
|
|
|
echo " $NAME) PRETTY_NAME=$PRETTY_NAME;;
|
2023-03-18 13:54:46 +00:00
|
|
|
" > ${TMP_DIR}/newvm.tmp
|
2023-03-14 12:44:52 +00:00
|
|
|
echo " $NAME \\
|
2023-03-18 13:54:46 +00:00
|
|
|
" >> ${TMP_DIR}/newvm.tmp
|
2023-03-14 12:44:52 +00:00
|
|
|
echo "function releases_$NAME() {
|
|
|
|
echo $RELEASES
|
|
|
|
}
|
2023-03-18 13:54:46 +00:00
|
|
|
" >> ${TMP_DIR}/newvm.tmp
|
2023-03-14 12:44:52 +00:00
|
|
|
echo "function editions_$NAME() {
|
|
|
|
echo $EDITIONS
|
|
|
|
}
|
2023-03-18 13:54:46 +00:00
|
|
|
" >> ${TMP_DIR}/newvm.tmp
|
2023-03-14 12:44:52 +00:00
|
|
|
echo "function get_$NAME() {
|
|
|
|
local EDITION="${1:-}"
|
|
|
|
local HASH=""
|
|
|
|
local ISO="$ISO"
|
|
|
|
local URL="$URL"
|
2023-03-21 01:39:03 +00:00
|
|
|
HASH="$HASH"
|
2023-03-14 12:44:52 +00:00
|
|
|
echo "${URL}/${ISO} ${HASH}"
|
|
|
|
}
|
2023-03-18 13:54:46 +00:00
|
|
|
" >> ${TMP_DIR}/newvm.tmp
|
2023-03-14 12:44:52 +00:00
|
|
|
echo "template.tmp content:
|
|
|
|
"
|
2023-03-18 13:54:46 +00:00
|
|
|
cat ${TMP_DIR}/template.tmp
|
2023-03-14 12:44:52 +00:00
|
|
|
echo "newvm.tmp content:
|
|
|
|
"
|
2023-03-18 13:54:46 +00:00
|
|
|
cat ${TMP_DIR}/newvm.tmp
|