80 lines
2.1 KiB
Bash
Executable File
80 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
########################################################################
|
|
# First Created: 12032021 Author: Allan Desc: Gitea 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-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"; }
|
|
#
|
|
# 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="gitea" ; servicedead
|
|
#
|
|
# Adjusting Gitea configuration parameters
|
|
#
|
|
cp -Rp /etc/gitea/app.ini /etc/gitea/app.ini.orig
|
|
sed -i '/gitea-repositories/a MAX_FILES = 500' /etc/gitea/app.ini
|
|
sed -i '/gitea-repositories/a FILE_MAX_SIZE = 200' /etc/gitea/app.ini
|
|
sed -i 's/LEVEL = info/LEVEL = warn/' /etc/gitea/app.ini
|
|
sed -i 's/MODE = console/MODE = file/' /etc/gitea/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/gitea/app.ini
|
|
#
|
|
# Restart Gitea in order for changes to take effect
|
|
#
|
|
systemctl restart gitea
|
|
#
|
|
# All done
|
|
#
|
|
clear ; printf "\n" ; line '-' ; printf "All Done...\n" ; line '-' ; printf "\n"
|
|
#
|
|
# End of script
|
|
#
|