Add gitea donwload file version info, missing installs are no longer forced exit
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
This commit is contained in:
12
download-act_runner.sh
Normal file → Executable file
12
download-act_runner.sh
Normal file → Executable file
@@ -4,6 +4,18 @@ BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
|||||||
# shellcheck source=init.sh
|
# shellcheck source=init.sh
|
||||||
. "${BASE_FOLDER}init.sh";
|
. "${BASE_FOLDER}init.sh";
|
||||||
|
|
||||||
|
download_file=$(curl -s https://gitea.com/api/v1/repos/gitea/act_runner/releases/latest |\
|
||||||
|
jq ".assets[].browser_download_url" |\
|
||||||
|
cut -d '"' -f 2 |\
|
||||||
|
grep "${arch}$");
|
||||||
|
version=$(echo "${download_file}" | cut -d "/" -f 8);
|
||||||
|
file=$(echo "${download_file}" | cut -d "/" -f 9);
|
||||||
|
if [ -f "${download_folder}/${file}" ]; then
|
||||||
|
echo "[!] File ${file} has already been downloaded";
|
||||||
|
exit;
|
||||||
|
fi;
|
||||||
|
echo "act_runner version to download: ${version}";
|
||||||
|
|
||||||
cd "${download_folder}" || exit;
|
cd "${download_folder}" || exit;
|
||||||
curl -s https://gitea.com/api/v1/repos/gitea/act_runner/releases/latest |\
|
curl -s https://gitea.com/api/v1/repos/gitea/act_runner/releases/latest |\
|
||||||
jq ".assets[].browser_download_url" |\
|
jq ".assets[].browser_download_url" |\
|
||||||
|
|||||||
16
download.sh
16
download.sh
@@ -4,11 +4,21 @@ BASE_FOLDER=$(dirname "$(readlink -f "$0")")"/";
|
|||||||
# shellcheck source=init.sh
|
# shellcheck source=init.sh
|
||||||
. "${BASE_FOLDER}init.sh";
|
. "${BASE_FOLDER}init.sh";
|
||||||
|
|
||||||
cd "${download_folder}" || exit;
|
download_file=$(curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest |\
|
||||||
curl -s https://api.github.com/repos/go-gitea/gitea/releases/latest |\
|
|
||||||
grep browser_download_url |\
|
grep browser_download_url |\
|
||||||
cut -d '"' -f 4 |\
|
cut -d '"' -f 4 |\
|
||||||
grep "${arch}$" |\
|
grep "${arch}$");
|
||||||
|
|
||||||
|
version=$(echo "${download_file}" | cut -d "/" -f 8);
|
||||||
|
file=$(echo "${download_file}" | cut -d "/" -f 9);
|
||||||
|
if [ -f "${download_folder}/${file}" ]; then
|
||||||
|
echo "[!] File ${file} has already been downloaded";
|
||||||
|
exit;
|
||||||
|
fi;
|
||||||
|
echo "gitea version to download: ${version}";
|
||||||
|
|
||||||
|
cd "${download_folder}" || exit;
|
||||||
|
echo "${download_file}" |\
|
||||||
xargs curl -LJO --output-dir "${download_folder}"
|
xargs curl -LJO --output-dir "${download_folder}"
|
||||||
cd - || exit;
|
cd - || exit;
|
||||||
|
|
||||||
|
|||||||
12
init.sh
12
init.sh
@@ -30,16 +30,18 @@ if [ ! -d "${download_folder}" ]; then
|
|||||||
exit;
|
exit;
|
||||||
fi;
|
fi;
|
||||||
target_file="/usr/local/bin/gitea";
|
target_file="/usr/local/bin/gitea";
|
||||||
|
gitea_exists=1;
|
||||||
if [ ! -f "${target_file}" ]; then
|
if [ ! -f "${target_file}" ]; then
|
||||||
echo "There is no gitea target file at ${target_file}. Is gitea installed?";
|
echo "[!] There is no gitea target file at ${target_file}. Is gitea installed?";
|
||||||
exit;
|
gitea_exists=0;
|
||||||
fi;
|
fi;
|
||||||
target_file_act_runner="/usr/local/bin/act_runner";
|
target_file_act_runner="/usr/local/bin/act_runner";
|
||||||
|
act_runner_exists=1
|
||||||
if [ ! -f "${target_file_act_runner}" ]; then
|
if [ ! -f "${target_file_act_runner}" ]; then
|
||||||
echo "There is no gitea action runner target file at ${target_file}. Is gitea action runner installed?";
|
echo "[!] There is no gitea action runner target file at ${target_file}. Is gitea action runner installed?";
|
||||||
exit;
|
act_runner_exists=0
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
export arch target_file;
|
export arch target_file gitea_exists act_runner_exists;
|
||||||
|
|
||||||
# __END__
|
# __END__
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ echo -e "Update gitea action runner to ${1} ... ";
|
|||||||
systemctl stop act_runner;
|
systemctl stop act_runner;
|
||||||
cp "${download_folder}act_runner-${1}-${arch}" "${target_file_act_runner}";
|
cp "${download_folder}act_runner-${1}-${arch}" "${target_file_act_runner}";
|
||||||
chmod +x "${target_file_act_runner}";
|
chmod +x "${target_file_act_runner}";
|
||||||
systemctl start gitea;
|
systemctl start act_runner;
|
||||||
echo "[DONE]";
|
echo "[DONE]";
|
||||||
|
|
||||||
# __END__
|
# __END__
|
||||||
|
|||||||
Reference in New Issue
Block a user