fix restart of act runner after update when downloading gitea or act runner it will show the version that is downlaoded. if the same version is downloaded again and alrady exists, download will be skipped
48 lines
1.2 KiB
Bash
48 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# check needed binaries
|
|
if [ -z "$(command -v curl)" ]; then
|
|
echo "Missing curl application, aborting";
|
|
exit;
|
|
fi;
|
|
if [ -z "$(command -v jq)" ]; then
|
|
echo "Missing jq application, aborting";
|
|
exit;
|
|
fi;
|
|
|
|
CPU_ARCH=""
|
|
# get the architecture
|
|
_cpu_arch=$(uname -m);
|
|
# weg get like x86_64 or x86_32 (NO), aarch64, etc
|
|
# we ONLY allow x86_64 or aarch64/arm64
|
|
if [ "${_cpu_arch}" = "x86_64" ]; then
|
|
CPU_ARCH="amd64";
|
|
elif [ "${_cpu_arch}" = "aarch64" ] || [ "${_cpu_arch}" = "arm64" ]; then
|
|
CPU_ARCH="arm64";
|
|
else
|
|
echo "Not supported architecture: ${_cpu_arch}";
|
|
exit;
|
|
fi;
|
|
arch="linux-${CPU_ARCH}";
|
|
download_folder="${BASE_FOLDER}download/";
|
|
if [ ! -d "${download_folder}" ]; then
|
|
echo "Download folder ${download_folder} missing";
|
|
exit;
|
|
fi;
|
|
target_file="/usr/local/bin/gitea";
|
|
gitea_exists=1;
|
|
if [ ! -f "${target_file}" ]; then
|
|
echo "[!] There is no gitea target file at ${target_file}. Is gitea installed?";
|
|
gitea_exists=0;
|
|
fi;
|
|
target_file_act_runner="/usr/local/bin/act_runner";
|
|
act_runner_exists=1
|
|
if [ ! -f "${target_file_act_runner}" ]; then
|
|
echo "[!] There is no gitea action runner target file at ${target_file}. Is gitea action runner installed?";
|
|
act_runner_exists=0
|
|
fi;
|
|
|
|
export arch target_file gitea_exists act_runner_exists;
|
|
|
|
# __END__
|