minor changes

This commit is contained in:
allan 2025-05-26 15:54:49 +02:00
parent 1583862ddb
commit 1c29164a30
2 changed files with 7 additions and 7 deletions

View File

@ -101,7 +101,7 @@ Once done go back to \"dokuwiki-install\" and run the following as root or using
clear ; printf '%s\n' "${wikinotice[@]}"
#
# Cleaning up and saving hostname for use with postinstall
echo $1 > hostname
echo "$1" > hostname
#
rm -Rf dokuwiki-stable.tgz nginx-install
#

View File

@ -12,22 +12,22 @@ if [[ $(id -u) -ne 0 ]]; then echo "" && echo "Must be root or use sudo" && echo
# Are we in the right directory
#
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 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 (){ for i in {1..50}; do echo -n "$1"; done && printf "\n"; }
line () { printf -- '-%.0s' {1..50}; printf '\n'; }
hostname=$(cat hostname)
nginxconfig="/etc/nginx/conf.d"
#
# 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 "\nDokuwiki postinstall script V1.0${normal}\n\n"; }
title () { printf "\nDokuwiki postinstall script V1.0\n\n"; }
#
# If Nginx is not running then die
#
@ -35,7 +35,7 @@ service="nginx" ; servicedead
#
# Hardening DokuWiki
#
sed -i 's/# location /location /g' $nginxconfig/$hostname.conf
sed -i 's/# location /location /g' $nginxconfig/"$hostname".conf
#
# Restart Nginx in order for changes to take effect
#
@ -47,7 +47,7 @@ rm hostname
#
# All done
#
clear ; printf "\n" ; line '-' ; printf "All Done...\n" ; line '-' ; printf "\n"
clear ; printf "\n" ; line ; printf "All Done...\n" ; line ; printf "\n"
#
# End of script
#