From 1c29164a30a56c67ca94ff981baa38c99722d73d Mon Sep 17 00:00:00 2001 From: allan Date: Mon, 26 May 2025 15:54:49 +0200 Subject: [PATCH] minor changes --- dokuwikiinstall | 2 +- postinstall | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dokuwikiinstall b/dokuwikiinstall index c1a342e..986e0b8 100755 --- a/dokuwikiinstall +++ b/dokuwikiinstall @@ -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 # diff --git a/postinstall b/postinstall index 82debf8..595441c 100755 --- a/postinstall +++ b/postinstall @@ -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 #