Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d32ddb1734 | |||
|
|
324b577134 | ||
|
|
11c1daf4a1 |
28
ReadMe.md
28
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
|
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
|
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 `download.sh` to download the latest file. Fill re-download as a different name if the same file is requested
|
||||||
|
|
||||||
Run `install.sh <version>` to install the newest version
|
Run `install.sh <version>` 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
|
## Download and install: act_runner
|
||||||
downloaded
|
|
||||||
|
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 <version>` to install the newest version
|
||||||
|
|||||||
14
download-act_runner.sh
Normal file → Executable file
14
download-act_runner.sh
Normal file → Executable file
@@ -4,12 +4,24 @@ 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" |\
|
||||||
cut -d '"' -f 2 |\
|
cut -d '"' -f 2 |\
|
||||||
grep "${arch}$" |\
|
grep "${arch}$" |\
|
||||||
wget -P "${download_folder}" -i -
|
xargs curl -LJO --output-dir "${download_folder}"
|
||||||
cd - || exit;
|
cd - || exit;
|
||||||
|
|
||||||
# __END__
|
# __END__
|
||||||
|
|||||||
18
download.sh
18
download.sh
@@ -4,12 +4,22 @@ 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}$");
|
||||||
wget -P "${download_folder}" -i -
|
|
||||||
|
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}"
|
||||||
cd - || exit;
|
cd - || exit;
|
||||||
|
|
||||||
# __END__
|
# __END__
|
||||||
|
|||||||
25
init.sh
25
init.sh
@@ -1,11 +1,20 @@
|
|||||||
#!/usr/bin/env 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=""
|
CPU_ARCH=""
|
||||||
# get the architecture
|
# get the architecture
|
||||||
_cpu_arch=$(uname -m);
|
_cpu_arch=$(uname -m);
|
||||||
# weg get like x86_64 or x86_32 (NO), aarch64, etc
|
# weg get like x86_64 or x86_32 (NO), aarch64, etc
|
||||||
# we ONLY allow x86_64 or aarch64
|
# we ONLY allow x86_64 or aarch64/arm64
|
||||||
# possible add: arm64
|
|
||||||
if [ "${_cpu_arch}" = "x86_64" ]; then
|
if [ "${_cpu_arch}" = "x86_64" ]; then
|
||||||
CPU_ARCH="amd64";
|
CPU_ARCH="amd64";
|
||||||
elif [ "${_cpu_arch}" = "aarch64" ] || [ "${_cpu_arch}" = "arm64" ]; then
|
elif [ "${_cpu_arch}" = "aarch64" ] || [ "${_cpu_arch}" = "arm64" ]; then
|
||||||
@@ -21,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_act_runner}. 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