minor changes

This commit is contained in:
allan 2025-05-26 15:44:24 +02:00
parent 55aa37782e
commit 1583862ddb

View File

@ -12,15 +12,13 @@ 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="dokuwiki-install" && whereami=$(pwd |awk -F'/' '{print $NF}') scriptdir="dokuwiki-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"; }
nginxfiles="/etc/nginx/nginxsnippets" nginxfiles="/etc/nginx/nginxsnippets"
phpver=$(php -v |head -1 |awk -F'.' '{print $1"."$2}' |sed 's/PHP //') phpver=$(php -v |head -1 |awk -F'.' '{print $1"."$2}' |sed 's/PHP //') ; phpfpm="php$phpver-fpm"
phpfpm="php$phpver-fpm" ; phpclidir="/etc/php/$phpver/cli" ; phpfpmdir="/etc/php/$phpver/fpm" ; socket="php$phpver"
# #
# Function title # Function title
# #
@ -29,21 +27,21 @@ title () { printf "\nDokuwiki install script V1.0\n\n"; }
# Function usage # Function usage
# #
usage () { clear ; printf -- "\n" usage () { clear ; printf -- "\n"
printf -- "${bold}dokuwikiinstall${normal} \n\n" printf -- "dokuwikiinstall \n\n"
printf -- "${bold}Usage:${normal} \n" printf -- "Usage: \n"
printf -- "./dokuwikiinstall <domain> \n" printf -- "./dokuwikiinstall <domain> \n"
printf -- "${bold}Examples:${normal} \n" printf -- "Examples: \n"
printf -- "./dokuwikiinstall wiki.something.xyz\n\n"; } printf -- "./dokuwikiinstall wiki.something.xyz\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 "$1" ]]; then printf "${bold}Error! ${normal}Hostname Empty...\n\n" ; exit; fi; } if [[ -z "$1" ]]; then printf "Error! Hostname Empty...\n\n" ; exit; fi; }
# #
# If Nginx is not running then die # If Nginx is not running then die
# #