minor changes
This commit is contained in:
parent
c440935b5c
commit
e65d700a48
@ -91,7 +91,7 @@ inputcheck "$hostname" "$giteapwd"
|
|||||||
# Check if a Nginx conf file with the hostname allready exists
|
# Check if a Nginx conf file with the hostname allready exists
|
||||||
#
|
#
|
||||||
hostcheck=$(grep -r --exclude="giteainstall" --exclude="postinstall" --exclude="README.md" $hostname /etc/nginx/ *)
|
hostcheck=$(grep -r --exclude="giteainstall" --exclude="postinstall" --exclude="README.md" $hostname /etc/nginx/ *)
|
||||||
if [ ! -z "$hostcheck" ]; then printf "Found a configuration file already containing $hostname in /ect/nginx/* going to abort...\n" ; exit ; fi
|
if [ ! -z "$hostcheck" ]; then printf "Found a configuration file already containing " ; printf "%s" "$hostname" ; printf " in /ect/nginx/* going to abort...\n" ; exit ; fi
|
||||||
#
|
#
|
||||||
# Download gitea only if gitea does not allready exists in /etc/gitea
|
# Download gitea only if gitea does not allready exists in /etc/gitea
|
||||||
#
|
#
|
||||||
|
30
postinstall
30
postinstall
@ -12,23 +12,23 @@ if [[ $(id -u) -ne 0 ]]; then echo "" && echo "Must be root or use sudo" && echo
|
|||||||
# Are we in the right directory
|
# Are we in the right directory
|
||||||
#
|
#
|
||||||
scriptdir="gitea-multi-install" && whereami=$(pwd |awk -F'/' '{print $NF}')
|
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
|
if [ "$whereami" != "$scriptdir" ]; then printf "\nWrong directory! Script must be run from %s\n\n" "$scriptdir"; exit 1; fi
|
||||||
#
|
#
|
||||||
# Define variables and functions
|
# Define variables and functions
|
||||||
#
|
#
|
||||||
line (){ for i in {1..50}; do echo -n "$1"; done && printf "\n"; }
|
line () { printf -- '-%.0s' {1..50}; printf '\n'; }
|
||||||
giteauser=$(head -1 giteainfo)
|
giteauser=$(head -1 giteainfo)
|
||||||
giteaport=$(head -2 giteainfo |sed '1d')
|
giteaport=$(head -2 giteainfo |sed '1d')
|
||||||
hostname=$(tail -1 giteainfo)
|
hostname=$(tail -1 giteainfo)
|
||||||
#
|
#
|
||||||
# Function to check if a service is already running or not
|
# Function to check if a service is already running or not
|
||||||
#
|
#
|
||||||
serviceno () { printf "\n$service is not running cannot continue...\n\n"; }
|
serviceno () { printf "\n%s" $service ; printf " is not running cannot continue...\n\n"; }
|
||||||
servicedead () { status=$(systemctl is-active $service); if [[ "$status" != "active" ]]; then serviceno ; exit; fi; }
|
servicedead () { status=$(systemctl is-active $service); if [[ "$status" != "active" ]]; then serviceno ; exit; fi; }
|
||||||
#
|
#
|
||||||
# Function title
|
# Function title
|
||||||
#
|
#
|
||||||
title () { printf "\nGitea postinstall script V1.0${normal}\n\n"; }
|
title () { printf "\nGitea postinstall script V1.0\n\n"; }
|
||||||
#
|
#
|
||||||
# If Gitea is not running then die
|
# If Gitea is not running then die
|
||||||
#
|
#
|
||||||
@ -36,17 +36,17 @@ service="$giteauser" ; servicedead
|
|||||||
#
|
#
|
||||||
# Change the port Gitea is using in the Nginx configuration and minor tweaks
|
# 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 -s -i "s/3000/$giteaport/" /etc/nginx/conf.d/"$hostname"
|
||||||
sed -i 's/# Optional //' /etc/nginx/conf.d/$hostname
|
sed -i 's/# Optional //' /etc/nginx/conf.d/"$hostname"
|
||||||
#
|
#
|
||||||
# Adjusting Gitea configuration parameters
|
# Adjusting Gitea configuration parameters
|
||||||
#
|
#
|
||||||
cp -Rp /etc/$giteauser/app.ini /etc/$giteauser/app.ini.orig
|
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 -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 MAX_FILES = 500' /etc/"$giteauser"/app.ini
|
||||||
sed -i '/gitea-repositories/a FILE_MAX_SIZE = 200' /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/LEVEL = info/LEVEL = warn/' /etc/"$giteauser"/app.ini
|
||||||
sed -i 's/MODE = console/MODE = file/' /etc/$giteauser/app.ini
|
sed -i 's/MODE = console/MODE = file/' /etc/"$giteauser"/app.ini
|
||||||
#
|
#
|
||||||
# Gitea post configuration values
|
# Gitea post configuration values
|
||||||
#
|
#
|
||||||
@ -72,11 +72,11 @@ SHOW_FOOTER_VERSION = false
|
|||||||
SHOW_FOOTER_TEMPLATE_LOAD_TIME = false
|
SHOW_FOOTER_TEMPLATE_LOAD_TIME = false
|
||||||
ENABLE_FEED = false
|
ENABLE_FEED = false
|
||||||
"
|
"
|
||||||
printf '%s\n' "${giteaconfig[@]}" |sed '$d' >> /etc/$giteauser/app.ini
|
printf '%s\n' "${giteaconfig[@]}" |sed '$d' >> /etc/"$giteauser"/app.ini
|
||||||
#
|
#
|
||||||
# Restart Nginx and Gitea in order for changes to take effect
|
# Restart Nginx and Gitea in order for changes to take effect
|
||||||
#
|
#
|
||||||
systemctl restart nginx ; systemctl restart $giteauser
|
systemctl restart nginx ; systemctl restart "$giteauser"
|
||||||
#
|
#
|
||||||
# Cleaning up
|
# Cleaning up
|
||||||
#
|
#
|
||||||
@ -84,7 +84,7 @@ rm -Rf giteainfo
|
|||||||
#
|
#
|
||||||
# All done
|
# All done
|
||||||
#
|
#
|
||||||
clear ; printf "\n" ; line '-' ; printf "All Done...\n" ; line '-' ; printf "\n"
|
clear ; printf "\n" ; line ; printf "All Done...\n" ; line ; printf "\n"
|
||||||
#
|
#
|
||||||
# End of script
|
# End of script
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user