From 11c1daf4a194713276e7313477882ab80e5a2394 Mon Sep 17 00:00:00 2001 From: Clemens Schwaighofer Date: Wed, 28 Aug 2024 12:01:16 +0900 Subject: [PATCH] Update readme, remove wget need Do no longer use wget to download the file, use curl. Check that curl and jq exists. Update ReadMe file --- ReadMe.md | 28 ++++++++++++++++++++++++---- download-act_runner.sh | 2 +- download.sh | 2 +- init.sh | 13 +++++++++++-- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/ReadMe.md b/ReadMe.md index acabb6b..b337b43 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,14 +1,34 @@ -# Download and install gitea +# Scripts to download and install gitea and act_runner binary files -In `init.sh` set the `target_file` as to where the gitea binary is located (full path including binary name) +Helps to install and setup the gitea and act_runner binary + +## Things needed + +The application "curl" and "jq" must be installed. + +Both gitea and act_runner must be run a systemd control file named "gitea" and "act_runner" + +## Basic setup + +In `init.sh` set to the full path including the binary name: + +- `target_file` as to where the gitea binary is located +- `target_file_act_runner` as to where the gitea act_runner binary is located If the download folder should be not in the subfolder "download" change the `download_folder` variable to the path as to where the files hould be downloaded. Note that this folder must exist +## Architectures detected + Only arm64 and x86 64bit are auto detected +## Download and install: gitea + Run `download.sh` to download the latest file. Fill re-download as a different name if the same file is requested Run `install.sh ` to install the newest version -There is a simple "download-act_runner" script, that has the URL as to where the action runner can be -downloaded +## Download and install: act_runner + +Run `download-act_runner.sh` to download the latest file. Fill re-download as a different name if the same file is requested + +Run `install-act_runner.sh ` to install the newest version diff --git a/download-act_runner.sh b/download-act_runner.sh index 8710e11..a0b992e 100644 --- a/download-act_runner.sh +++ b/download-act_runner.sh @@ -9,7 +9,7 @@ curl -s https://gitea.com/api/v1/repos/gitea/act_runner/releases/latest |\ jq ".assets[].browser_download_url" |\ cut -d '"' -f 2 |\ grep "${arch}$" |\ - wget -P "${download_folder}" -i - + xargs curl -LJO --output-dir "${download_folder}" cd - || exit; # __END__ diff --git a/download.sh b/download.sh index 586c8b4..61c19ab 100755 --- a/download.sh +++ b/download.sh @@ -9,7 +9,7 @@ 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 - + xargs curl -LJO --output-dir "${download_folder}" cd - || exit; # __END__ diff --git a/init.sh b/init.sh index a5b67c5..840f74a 100644 --- a/init.sh +++ b/init.sh @@ -1,11 +1,20 @@ #!/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 -# possible add: arm64 +# 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