Fixed some formating, and updated the git url to use the shorthand url method

This commit is contained in:
Llewellyn van der Merwe 2022-08-04 22:20:13 +02:00
parent 370bc19ed7
commit 6ff9913276
Signed by: Llewellyn
GPG Key ID: A9201372263741E7
1 changed files with 100 additions and 103 deletions

View File

@ -3,7 +3,7 @@
# Program name
PROGRAM_NAME="Octojpack"
PROGRAM_CODE="octojpack"
PROGRAM_VERSION="1.0.1"
PROGRAM_VERSION="1.0.2"
PROGRAM_V="1.0"
PROGRAM_URL="https://git.vdm.dev/octoleo/${PROGRAM_CODE}"
@ -309,15 +309,14 @@ function setFiles() {
# little information of progress
_echo "[info] Loading the Files..."
# make sure its reset
echo -e '\t<files folder="src">' > "${VDM_FILES_XML}"
echo "" > "${VDM_README_FILES_MD}"
echo -e '\t<files folder="src">' >"${VDM_FILES_XML}"
echo "" >"${VDM_README_FILES_MD}"
# check for errors
local has_error=false
local has_files=false
# loop over the repos
local i=0
for owner in $(echo "${VDM_CONFIG_DATA}" | jq -r '.files[].owner');
do
for owner in $(echo "${VDM_CONFIG_DATA}" | jq -r '.files[].owner'); do
# get the config values needed
# shellcheck disable=SC2015
[ -n "${owner}" ] && VDM_OWNER="${owner}" || continue
@ -384,9 +383,9 @@ function setFiles() {
# check if this is the package version ID
if [ -n "${VDM_PACKAGE_VERSION_ID}" ] &&
[ -z "${VDM_PACKAGE_VERSION}" ] &&
[ "${VDM_PACKAGE_VERSION_ID}" = "${VDM_ID}" ] ; then
[ "${VDM_PACKAGE_VERSION_ID}" = "${VDM_ID}" ]; then
# set the package version
VDM_PACKAGE_VERSION="${VDM_ZIP_NAME}";
VDM_PACKAGE_VERSION="${VDM_ZIP_NAME}"
export VDM_PACKAGE_VERSION
fi
# we have a file
@ -398,7 +397,7 @@ function setFiles() {
clearFileEnv
done
# make sure to close the files
echo -e '\t</files>' >> "${VDM_FILES_XML}"
echo -e '\t</files>' >>"${VDM_FILES_XML}"
# check if we found a file
$has_files || return 13
# success
@ -502,8 +501,7 @@ function getFileByRelease() {
}
# we may have multiple assets (but we only load the first ZIP file we get)
# because we can only have the ${VDM_ID} only once in the xml file
for asset_zip_file_name in $(echo "${VDM_API_BUCKET}" | jq -r '.assets[].name');
do
for asset_zip_file_name in $(echo "${VDM_API_BUCKET}" | jq -r '.assets[].name'); do
# make sure we did not already get a file
$has_files && {
# increment
@ -589,7 +587,7 @@ function setFileToREADME() {
echo -n "(https://${VDM_URL}/${VDM_OWNER}/${VDM_REPO})"
echo " [${zip_name}](${zip_url})"
echo "> ${message}"
} >> "${VDM_README_FILES_MD}"
} >>"${VDM_README_FILES_MD}"
}
# set the File Details to XML
@ -609,7 +607,7 @@ function setFileToXML() {
echo -n "${VDM_TYPE_VAL}" &&
echo -n '"'
echo ">$zip_name</file>"
} >> "${VDM_FILES_XML}"
} >>"${VDM_FILES_XML}"
}
# make API call
@ -655,13 +653,12 @@ function setLanguages() {
# little information of progress
_echo "[info] Loading the Languages..."
# make sure its reset
echo -e '\t<languages folder="languages">' > "${VDM_LANGUAGES_XML}"
echo -e '\t<languages folder="languages">' >"${VDM_LANGUAGES_XML}"
# check for errors
local has_error
# loop over the repos
i=0
for vdm_lang_tag in $(echo "${VDM_CONFIG_DATA}" | jq -r '.languages[].tag');
do
for vdm_lang_tag in $(echo "${VDM_CONFIG_DATA}" | jq -r '.languages[].tag'); do
# check for errors
has_error=false
# get the config values needed
@ -692,10 +689,10 @@ function setLanguages() {
fi
# add value to language file
if [ -f "${language_file_path}" ]; then
echo "${language_string}" >> "${language_file_path}"
echo "${language_string}" >>"${language_file_path}"
else
# first time
echo "${language_string}" > "${language_file_path}"
echo "${language_string}" >"${language_file_path}"
# add to xml
setLanguageXml "${vdm_lang_tag}" "${vdm_lang_tag}/${language_file_name}"
fi
@ -708,7 +705,7 @@ function setLanguages() {
clearLangEnv
done
# make sure its reset
echo -e '\t</languages>' >> "${VDM_LANGUAGES_XML}"
echo -e '\t</languages>' >>"${VDM_LANGUAGES_XML}"
}
# just to clear all file ENVs
@ -729,7 +726,7 @@ function setLanguageXml() {
echo -n '">'
echo -n "${2}"
echo '</language>'
} >> "${VDM_LANGUAGES_XML}"
} >>"${VDM_LANGUAGES_XML}"
}
# set the Package XML Details
@ -824,7 +821,7 @@ function setPackageXml() {
cat "${VDM_FILES_XML}"
# close the extension xml
echo '</extension>'
} > "${VDM_PACKAGE_XML}"
} >"${VDM_PACKAGE_XML}"
# remove file no longer needed
rm "${VDM_LANGUAGES_XML}"
rm "${VDM_FILES_XML}"
@ -865,7 +862,7 @@ function setReadMe() {
echo "### License"
echo "> ${VDM_LICENSE}"
echo ""
} > "${VDM_README_MD}"
} >"${VDM_README_MD}"
# remove the Readme files build
rm "${VDM_README_FILES_MD:?}"
}
@ -931,7 +928,7 @@ function setRepository() {
# check if the repository exist on our gitea instance
local update_repo
# shellcheck disable=SC2015
if git ls-remote "ssh://git@${VDM_PACKAGE_URL}:${VDM_PACKAGE_OWNER}/${VDM_PACKAGE_REPO}.git" -q >/dev/null 2>&1; then
if git ls-remote "ssh://git@${VDM_PACKAGE_URL}/${VDM_PACKAGE_OWNER}/${VDM_PACKAGE_REPO}.git" -q >/dev/null 2>&1; then
getExistingRepository || return 23
update_repo=true
else
@ -990,7 +987,7 @@ function getExistingRepository() {
# little information of progress
_echo "[info] Getting (${VDM_PACKAGE_OWNER}/${VDM_PACKAGE_REPO}) repository"
# clone the existing repository
git clone "ssh://git@${VDM_PACKAGE_URL}:${VDM_PACKAGE_OWNER}/${VDM_PACKAGE_REPO}.git" >/dev/null 2>&1 || return 23
git clone "ssh://git@${VDM_PACKAGE_URL}/${VDM_PACKAGE_OWNER}/${VDM_PACKAGE_REPO}.git" >/dev/null 2>&1 || return 23
# success
return 0
}
@ -1016,7 +1013,7 @@ function setGitRepository() {
# little information of progress
_echo "[info] Adding remote branch to (${VDM_PACKAGE_OWNER}/${VDM_PACKAGE_REPO}) repository"
# add the remote branch
git remote add origin "ssh://git@${VDM_PACKAGE_URL}:${VDM_PACKAGE_OWNER}/${VDM_PACKAGE_REPO}.git" >/dev/null 2>&1 || return 29
git remote add origin "ssh://git@${VDM_PACKAGE_URL}/${VDM_PACKAGE_OWNER}/${VDM_PACKAGE_REPO}.git" >/dev/null 2>&1 || return 29
#success
return 0
}