Skip to content

Commit

Permalink
add automatic gitea release detection,
Browse files Browse the repository at this point in the history
remove unused tests parameter
  • Loading branch information
uvulpos committed Nov 15, 2021
1 parent a2c6708 commit ff07796
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 39 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,26 @@ properly (e.x. LXC)
|Ubuntu| original supported |
|Debian| not supported ([but confirmed on debian 11](https://github.com/uvulpos/gitea-installer/issues/8)) |

## How to use it:
## Dependencies
1. curl `sudo apt install curl -y`
2. jq `sudo apt install jq -y`

1. Download this repo
## How to use it:
1. Install dependencies
```
sudo apt install curl jq -y
```
2. Download this repo
1. Cone via GitHub SSH `git clone git@github.com:uvulpos/gitea-installer.git`
1. Cone via GitHub HTTPS `git clone https://github.com/uvulpos/gitea-installer.git`
1. Cone via GitHub CLI `gh repo clone uvulpos/gitea-installer`
1. Download zip release [here](https://github.com/uvulpos/gitea-installer/releases) and extract it
2. Execute installer (this may take some time because I also update the server)
3. Execute installer (this may take some time because I also update the server)
1. Execute english version `bash ./gitea-installer-en.sh`
1. Execute german version `bash ./gitea-installer-de.sh`
3. At the end of my script, there is an url and login data for mysql database. Go to the website and enter the details
4. At the end of my script, there is an url and login data for mysql database. Go to the website and enter the details
to install it via gitea installer! Safe the credentials also at your desktop pc for backup!
4. Execute finish script to remove write privileges to certain files `bash after-install.sh`
5. Execute finish script to remove write privileges to certain files `bash after-install.sh`

## Important:

Expand Down
52 changes: 31 additions & 21 deletions gitea-installer-de.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
# variablen setzen
# are requirements satisfied
if ! command -v jq &> /dev/null
then
echo "---"
echo "⚠️ Benötigte Abhängigkeiten fehlen! ⚠️"
echo "Bitte installiere 'jq' um fortzufahren => sudo apt install jq -y"
echo "---"
exit
fi

if ! command -v curl &> /dev/null
then
echo "---"
echo "⚠️ Dependencies not satisfied! ⚠️"
echo "Bitte installiere 'curl' um fortzufahren => sudo apt install curl -y"
echo "---"
exit
fi


shell_arguments=$1
giteadownloader_default="https://dl.gitea.io/gitea/1.15/gitea-1.15-linux-amd64"
# variablen setzen
gitea_latest_version=${1:-$(curl --silent "https://api.github.com/repos/go-gitea/gitea/releases/latest" | jq -r '.tag_name' 2>&1 | sed -e 's|.*-||' -e 's|^v||')}
gitea_download_url_default="https://github.com/go-gitea/gitea/releases/download/v${gitea_latest_version}/gitea-${gitea_latest_version}-linux-amd64"
deineIP="$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)"
pwd="$(pwd)"
dbuser="giteauser"
dbpassword=$(date +%s | sha256sum | base64 | head -c 32)
dbtable="giteadb"

if [[ "$shell_arguments" == "--github-ci-test" ]]; then
run_ci_tests=1
else
run_ci_tests=0
fi

echo ""
echo ""
echo " Gitea installer"
Expand All @@ -26,20 +39,17 @@ echo ""

sleep 3s

if [[ run_ci_tests == 1 ]]; then

giteadownloader="${giteadownloader_default}"

else

echo "Bitte gib den Downloadlink zur jeweiligen Version an. Alternativ nutze ich folgenden Link: ${giteadownloader_default}"
read -p "-> " giteadownloader
if [[ -z ${giteadownloader} ]]; then
giteadownloader="${giteadownloader_default}"
fi
echo "Du hast folgenden Link gewaehlt: ${giteadownloader}"
# specify your version
echo "Bitte gib den Downloadlink zur jeweiligen Version an."
echo "Alternativ wird Version ${gitea_latest_version} (amd64) verwendet: ${gitea_download_url_default}"
echo "Such bitte deine benötigte Version heraus: https://github.com/go-gitea/gitea/releases"

read -p "-> " giteadownloader
if [[ -z ${giteadownloader} ]]; then
giteadownloader="${gitea_download_url_default}"
fi
echo "Du hast folgenden Link gewaehlt: ${giteadownloader}"


echo ""
echo ""
Expand Down
44 changes: 31 additions & 13 deletions gitea-installer-en.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
# are requirements satisfied
if ! command -v jq &> /dev/null
then
echo "---"
echo "⚠️ Dependencies not satisfied! ⚠️"
echo "Please install 'jq' to continue => sudo apt install jq -y"
echo "---"
exit
fi

if ! command -v curl &> /dev/null
then
echo "---"
echo "⚠️ Dependencies not satisfied! ⚠️"
echo "Please install 'curl' to continue => sudo apt install curl -y"
echo "---"
exit
fi


# variablen setzen

shell_arguments=$1
giteadownloader_default="https://dl.gitea.io/gitea/1.15/gitea-1.15-linux-amd64"
gitea_latest_version=${1:-$(curl --silent "https://api.github.com/repos/go-gitea/gitea/releases/latest" | jq -r '.tag_name' 2>&1 | sed -e 's|.*-||' -e 's|^v||')}
gitea_download_url_default="https://github.com/go-gitea/gitea/releases/download/v${gitea_latest_version}/gitea-${gitea_latest_version}-linux-amd64"
deineIP="$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)"
pwd="$(pwd)"
dbuser="giteauser"
Expand All @@ -26,20 +47,17 @@ echo ""

sleep 3s

if [[ run_ci_tests == 1 ]]; then

giteadownloader="${giteadownloader_default}"

else

echo "Define your downloadpath. Otherwise I use: ${giteadownloader_default}"
read -p "-> " giteadownloader
if [[ -z ${giteadownloader} ]]; then
giteadownloader="${giteadownloader_default}"
fi
echo "You choose: ${giteadownloader}"
# specify your version
echo "Please insert your needed download-url"
echo "Alternatively version ${gitea_latest_version} for (amd64) is used: ${gitea_download_url_default}"
echo "Check out the available versions at: https://github.com/go-gitea/gitea/releases"

read -p "-> " giteadownloader
if [[ -z ${giteadownloader} ]]; then
giteadownloader="${gitea_download_url_default}"
fi
echo "You choose: ${giteadownloader}"



echo ""
Expand Down

0 comments on commit ff07796

Please sign in to comment.