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
|
||||
#
|
||||
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
|
||||
#
|
||||
red='\033[0;31m' ; bred='\033[1;31m' ; green='\033[0;92m' ; blue='\033[0;36m' ; bold='\033[1m' ; normal='\033[0m'
|
||||
line (){ for i in {1..50}; do echo -n "$1"; done && printf "\n"; }
|
||||
line () { printf -- '-%.0s' {1..50}; printf '\n'; }
|
||||
giteaversion=$(tail -1 version)
|
||||
nginxfiles="/etc/nginx/nginxsnippets"
|
||||
#
|
||||
@ -28,24 +27,24 @@ title () { printf "\nGitea install script V1.0\n\n"; }
|
||||
# Function usage
|
||||
#
|
||||
usage () { clear ; printf -- "\n"
|
||||
printf -- "${bold}giteainstall${normal} \n\n"
|
||||
printf -- "${bold}Usage:${normal} \n"
|
||||
printf -- "giteainstall \n\n"
|
||||
printf -- "Usage: \n"
|
||||
printf -- "./giteainstall [-n] <gitea domain> \n"
|
||||
printf -- " [-p] <gitea database password> \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"; }
|
||||
#
|
||||
# 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; }
|
||||
#
|
||||
# Function input check
|
||||
#
|
||||
inputcheck () {
|
||||
if [[ -z "$hostname" ]]; then usage ; printf "${bold}Error! ${normal}Hostname Empty...\n\n" ; exit; fi
|
||||
if [[ -z "$giteapwd" ]]; then usage ; printf "${bold}Error! ${normal}Database Password Empty...\n\n" ; exit; fi; }
|
||||
if [[ -z "$hostname" ]]; then usage ; printf "Error! Hostname 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
|
||||
#
|
||||
@ -54,10 +53,14 @@ service="mariadb" ; servicedead ; service="nginx" ; servicedead
|
||||
# Display title
|
||||
#
|
||||
clear ; title
|
||||
|
||||
#
|
||||
# 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
|
||||
case $option in
|
||||
@ -72,7 +75,7 @@ while getopts "n:p:h:" option; do
|
||||
usage ; exit;;
|
||||
|
||||
\?) # 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
|
||||
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
|
||||
#
|
||||
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
|
||||
#
|
||||
line () { printf -- '-%.0s' {1..50}; printf '\n'; }
|
||||
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
|
||||
#
|
||||
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; }
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user