minor changes
This commit is contained in:
parent
3d9f12ee3a
commit
b70cd2dba8
25
giteainstall
25
giteainstall
@ -12,12 +12,11 @@ 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-install" && whereami=$(pwd |awk -F'/' '{print $NF}')
|
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 ; 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
|
||||||
#
|
#
|
||||||
red='\033[0;31m' ; bred='\033[1;31m' ; green='\033[0;92m' ; blue='\033[0;36m' ; bold='\033[1m' ; normal='\033[0m'
|
line () { printf -- '-%.0s' {1..50}; printf '\n'; }
|
||||||
line (){ for i in {1..50}; do echo -n "$1"; done && printf "\n"; }
|
|
||||||
giteaversion=$(tail -1 version)
|
giteaversion=$(tail -1 version)
|
||||||
nginxfiles="/etc/nginx/nginxsnippets"
|
nginxfiles="/etc/nginx/nginxsnippets"
|
||||||
#
|
#
|
||||||
@ -28,24 +27,24 @@ title () { printf "\nGitea install script V1.0\n\n"; }
|
|||||||
# Function usage
|
# Function usage
|
||||||
#
|
#
|
||||||
usage () { clear ; printf -- "\n"
|
usage () { clear ; printf -- "\n"
|
||||||
printf -- "${bold}giteainstall${normal} \n\n"
|
printf -- "giteainstall \n\n"
|
||||||
printf -- "${bold}Usage:${normal} \n"
|
printf -- "Usage: \n"
|
||||||
printf -- "./giteainstall [-n] <gitea domain> \n"
|
printf -- "./giteainstall [-n] <gitea domain> \n"
|
||||||
printf -- " [-p] <gitea database password> \n"
|
printf -- " [-p] <gitea database password> \n"
|
||||||
printf -- " [-help] <this screen> \n\n"
|
printf -- " [-help] <this screen> \n\n"
|
||||||
printf -- "${bold}Examples:${normal} \n"
|
printf -- "Examples: \n"
|
||||||
printf -- "./giteainstall -n git.something.xyz -p giteadatabsepwd\n\n"; }
|
printf -- "./giteainstall -n git.something.xyz -p giteadatabsepwd\n\n"; }
|
||||||
#
|
#
|
||||||
# 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 input check
|
# Function input check
|
||||||
#
|
#
|
||||||
inputcheck () {
|
inputcheck () {
|
||||||
if [[ -z "$hostname" ]]; then usage ; printf "${bold}Error! ${normal}Hostname Empty...\n\n" ; exit; fi
|
if [[ -z "$hostname" ]]; then usage ; printf "Error! Hostname Empty...\n\n" ; exit; fi
|
||||||
if [[ -z "$giteapwd" ]]; then usage ; printf "${bold}Error! ${normal}Database Password Empty...\n\n" ; exit; fi; }
|
if [[ -z "$giteapwd" ]]; then usage ; printf "Error! Database Password Empty...\n\n" ; exit; fi; }
|
||||||
#
|
#
|
||||||
# If Nginx and MariaDB is not running then die
|
# If Nginx and MariaDB is not running then die
|
||||||
#
|
#
|
||||||
@ -54,10 +53,14 @@ service="mariadb" ; servicedead ; service="nginx" ; servicedead
|
|||||||
# Display title
|
# Display title
|
||||||
#
|
#
|
||||||
clear ; title
|
clear ; title
|
||||||
|
|
||||||
#
|
#
|
||||||
# Configure command line options
|
# Configure command line options
|
||||||
#
|
#
|
||||||
if [[ ! $@ =~ ^\-.+ ]]; then usage; fi
|
|
||||||
|
# Removed due to SC2199 and not really needed start
|
||||||
|
# if [[ ! $@ =~ ^\-.+ ]]; then usage; fi
|
||||||
|
# Removed due to SC2199 and not really needed stop
|
||||||
|
|
||||||
while getopts "n:p:h:" option; do
|
while getopts "n:p:h:" option; do
|
||||||
case $option in
|
case $option in
|
||||||
@ -72,7 +75,7 @@ while getopts "n:p:h:" option; do
|
|||||||
usage ; exit;;
|
usage ; exit;;
|
||||||
|
|
||||||
\?) # invalid option
|
\?) # invalid option
|
||||||
printf "Type $0 -help for help\n\n" ; exit;;
|
printf "\nType sudo " ; printf "%s" "$0" ; printf " -help for help\n\n" ; exit;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
#
|
#
|
||||||
|
@ -13,22 +13,22 @@ 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-install" && whereami=$(pwd |awk -F'/' '{print $NF}')
|
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
|
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 () { printf -- '-%.0s' {1..50}; printf '\n'; }
|
||||||
nginxconfig=$(ls -la |grep "conf" |awk '{print $9}')
|
nginxconfig=$(ls -la |grep "conf" |awk '{print $9}')
|
||||||
line (){ for i in {1..50}; do echo -n "$1"; done && printf "\n"; }
|
|
||||||
#
|
#
|
||||||
# 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
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user