diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 0000000..b14745b --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1,2 @@ +shell=bash +external-sources=true diff --git a/download.sh b/download.sh index b434299..586c8b4 100755 --- a/download.sh +++ b/download.sh @@ -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__ diff --git a/init.sh b/init.sh index 86d5e75..5960f74 100644 --- a/init.sh +++ b/init.sh @@ -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__ diff --git a/install.sh b/install.sh index 13fca46..7d5da33 100755 --- a/install.sh +++ b/install.sh @@ -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} ... ";