Clean up shell code
This commit is contained in:
2
.shellcheckrc
Normal file
2
.shellcheckrc
Normal file
@@ -0,0 +1,2 @@
|
||||
shell=bash
|
||||
external-sources=true
|
||||
@@ -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__
|
||||
|
||||
6
init.sh
6
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__
|
||||
|
||||
@@ -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} ... ";
|
||||
|
||||
Reference in New Issue
Block a user