You've already forked gitea-multi-install
initial commit
This commit is contained in:
90
postinstall
Executable file
90
postinstall
Executable file
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
|
||||
#######################################################################################
|
||||
# First Created: 25012024 Author: Allan Desc: Gitea multi instance postinstall script #
|
||||
#######################################################################################
|
||||
|
||||
#
|
||||
# Are we root
|
||||
#
|
||||
if [[ $(id -u) -ne 0 ]]; then echo "" && echo "Must be root or use sudo" && echo ""; exit 1; fi
|
||||
#
|
||||
# Are we in the right directory
|
||||
#
|
||||
scriptdir="gitea-multi-install" && whereami=$(pwd |awk -F'/' '{print $NF}')
|
||||
if [ $whereami != $scriptdir ]; then printf "\nWrong directory! Script must be run from $scriptdir\n\n"; exit 1; fi
|
||||
#
|
||||
# Define variables and functions
|
||||
#
|
||||
line (){ for i in {1..50}; do echo -n "$1"; done && printf "\n"; }
|
||||
giteauser=$(head -1 giteainfo)
|
||||
giteaport=$(head -2 giteainfo |sed '1d')
|
||||
hostname=$(tail -1 giteainfo)
|
||||
#
|
||||
# Function to check if a service is already running or not
|
||||
#
|
||||
serviceno () { printf "\n$service is not running cannot continue...\n\n"; }
|
||||
servicedead () { status=$(systemctl is-active $service); if [[ "$status" != "active" ]]; then serviceno ; exit; fi; }
|
||||
#
|
||||
# Function title
|
||||
#
|
||||
title () { printf "\nGitea postinstall script V1.0${normal}\n\n"; }
|
||||
#
|
||||
# If Gitea is not running then die
|
||||
#
|
||||
service="$giteauser" ; servicedead
|
||||
#
|
||||
# Change the port Gitea is using in the Nginx configuration and minor tweaks
|
||||
#
|
||||
sed -s -i "s/3000/$giteaport/" /etc/nginx/conf.d/$hostname
|
||||
sed -i 's/# Optional //' /etc/nginx/conf.d/$hostname
|
||||
#
|
||||
# Adjusting Gitea configuration parameters
|
||||
#
|
||||
cp -Rp /etc/$giteauser/app.ini /etc/$giteauser/app.ini.orig
|
||||
sed -s -i "s/HTTP_PORT = 3000/HTTP_PORT = $giteaport/" /etc/$giteauser/app.ini
|
||||
sed -i '/gitea-repositories/a MAX_FILES = 500' /etc/$giteauser/app.ini
|
||||
sed -i '/gitea-repositories/a FILE_MAX_SIZE = 200' /etc/$giteauser/app.ini
|
||||
sed -i 's/LEVEL = info/LEVEL = warn/' /etc/$giteauser/app.ini
|
||||
sed -i 's/MODE = console/MODE = file/' /etc/$giteauser/app.ini
|
||||
#
|
||||
# Gitea post configuration values
|
||||
#
|
||||
giteaconfig="
|
||||
[ui.admin]
|
||||
USER_PAGING_NUM = 50
|
||||
REPO_PAGING_NUM = 50
|
||||
NOTICE_PAGING_NUM = 25
|
||||
ORG_PAGING_NUM = 25
|
||||
|
||||
[ui.user]
|
||||
USER_PAGING_NUM = 50
|
||||
REPO_PAGING_NUM = 50
|
||||
NOTICE_PAGING_NUM = 25
|
||||
ORG_PAGING_NUM = 25
|
||||
|
||||
[ui]
|
||||
THEMES = gitea,arc-green
|
||||
|
||||
[other]
|
||||
SHOW_FOOTER_BRANDING = false
|
||||
SHOW_FOOTER_VERSION = false
|
||||
SHOW_FOOTER_TEMPLATE_LOAD_TIME = false
|
||||
ENABLE_FEED = false
|
||||
"
|
||||
printf '%s\n' "${giteaconfig[@]}" |sed '$d' >> /etc/$giteauser/app.ini
|
||||
#
|
||||
# Restart Nginx and Gitea in order for changes to take effect
|
||||
#
|
||||
systemctl restart nginx ; systemctl restart $giteauser
|
||||
#
|
||||
# Cleaning up
|
||||
#
|
||||
rm -Rf giteainfo
|
||||
#
|
||||
# All done
|
||||
#
|
||||
clear ; printf "\n" ; line '-' ; printf "All Done...\n" ; line '-' ; printf "\n"
|
||||
#
|
||||
# End of script
|
||||
#
|
Reference in New Issue
Block a user