You've already forked gitea-ubuntu
logic changes
This commit is contained in:
46
giteainstall
46
giteainstall
@@ -10,6 +10,24 @@
|
||||
#
|
||||
if [[ $(id -u) -ne 0 ]]; then echo "" && echo "Must be root or use sudo" && echo "" ; exit ; fi
|
||||
|
||||
#
|
||||
# Check if required services are running or not
|
||||
#
|
||||
for svc in nginx mariadb; do systemctl is-active --quiet "$svc" || { printf "\n%s is not running, cannot continue...\n\n" "${svc^}" ; exit 1 ; }; done
|
||||
|
||||
#
|
||||
# Check MariaDB authentication method (socket or not)
|
||||
#
|
||||
if mysql -u root -e ";" 2>/dev/null; then
|
||||
socket="SOCKET DETECTED — no need for -a or -m"
|
||||
socketusage="SOCKET DETECTED — this flag is not needed"
|
||||
socketauth="yes"
|
||||
else
|
||||
socket="NO SOCKET DETECTED — you must use -a and -m"
|
||||
socketusage="NO SOCKET DETECTED — these flags are required"
|
||||
socketauth="no"
|
||||
fi
|
||||
|
||||
#
|
||||
# Define variables and functions
|
||||
#
|
||||
@@ -33,12 +51,6 @@ usage () {
|
||||
printf -- " sudo ./giteainstall -n git.example.com -p giteadbpwd -a admin -m adminpwd\n\n"
|
||||
}
|
||||
|
||||
#
|
||||
# Function to check if a service is already running or not
|
||||
#
|
||||
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; }
|
||||
|
||||
#
|
||||
# Function inputcheck
|
||||
#
|
||||
@@ -47,24 +59,6 @@ inputcheck () {
|
||||
[[ -z "$dbpass" ]] && { usage; echo "Error! Database password empty."; exit 1; }
|
||||
}
|
||||
|
||||
#
|
||||
# If Nginx and MariaDB is not running then die
|
||||
#
|
||||
service="mariadb" ; servicedead ; service="nginx" ; servicedead
|
||||
|
||||
#
|
||||
# Check MariaDB authentication method (socket or not)
|
||||
#
|
||||
if mysql -u root -e ";" 2>/dev/null; then
|
||||
socket="SOCKET DETECTED — no need for -a or -m"
|
||||
socketusage="SOCKET DETECTED — this flag is not needed"
|
||||
socketauth="yes"
|
||||
else
|
||||
socket="NO SOCKET DETECTED — you must use -a and -m"
|
||||
socketusage="NO SOCKET DETECTED — these flags are required"
|
||||
socketauth="no"
|
||||
fi
|
||||
|
||||
#
|
||||
# Let's go
|
||||
#
|
||||
@@ -169,7 +163,7 @@ esac
|
||||
# Create a Gitea Nginx configuration file
|
||||
#
|
||||
cp "$nginxsnippets/hostfiles/gitea.80.conf" /etc/nginx/conf.d/"$hostname".conf
|
||||
sed -i "s/DOMAIN/$hostname/g" /etc/nginx/conf.d/"$hostname".conf
|
||||
sed -i -- "s/DOMAIN/$hostname/g" /etc/nginx/conf.d/"$hostname".conf
|
||||
|
||||
#
|
||||
# Restarting Nginx for changes to take effect
|
||||
@@ -290,8 +284,8 @@ postnotice=$(cat <<EOF
|
||||
NEXT STEP: Go to http://$hostname and complete the initial configuration.
|
||||
-------------------------------------------------------------------------------------
|
||||
|
||||
Database Name : gitea
|
||||
Database User : gitea
|
||||
Database Name : gitea
|
||||
Database Password: $dbpass
|
||||
|
||||
-------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user