Clean up shell code

This commit is contained in:
Clemens Schwaighofer
2024-08-28 10:12:59 +09:00
parent bfeef66b0b
commit aca80a9775
4 changed files with 11 additions and 3 deletions

2
.shellcheckrc Normal file
View File

@@ -0,0 +1,2 @@
shell=bash
external-sources=true

View File

@@ -1,14 +1,15 @@
#!/usr/bin/env bash
BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
# shellcheck source=init.sh
. "${BASE_FOLDER}init.sh";
cd "${download_folder}";
cd "${download_folder}" || exit;
curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest |\
grep browser_download_url |\
cut -d '"' -f 4 |\
grep "${arch}$" |\
wget -P "${download_folder}" -i -
cd -;
cd - || exit;
# __END__

View File

@@ -1,3 +1,5 @@
#!/usr/bin/env bash
CPU_ARCH=""
# get the architecture
_cpu_arch=$(uname -m);
@@ -6,7 +8,7 @@ _cpu_arch=$(uname -m);
# possible add: arm64
if [ "${_cpu_arch}" = "x86_64" ]; then
CPU_ARCH="amd64";
elif [ "${_cpu_arch}" = "aarch64" ]; then
elif [ "${_cpu_arch}" = "aarch64" ] || [ "${_cpu_arch}" = "arm64" ]; then
CPU_ARCH="arm64";
else
echo "Not supported architecture: ${_cpu_arch}";
@@ -20,4 +22,6 @@ if [ ! -d "${download_folder}" ]; then
fi;
target_file="/usr/local/bin/gitea";
export arch target_file;
# __END__

View File

@@ -1,6 +1,7 @@
#!/usr/bin/env bash
BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
# shellcheck source=init.sh
. "${BASE_FOLDER}init.sh";
echo -e "Update gitea to ${1} ... ";