minor changes

This commit is contained in:
2025-10-29 12:07:04 +01:00
parent b7841af796
commit f4e2a2e1d8

View File

@@ -18,7 +18,7 @@ hostname="$1"
# #
# Get php-fpm version # Get php-fpm version
# #
phpfpm=$(systemctl list-units --type=service --all | awk '/php[0-9]+\.[0-9]+-fpm/ {print $1; exit}' | sed 's/\.service//') phpfpm=$(systemctl list-unit-files --type=service | awk '/php[0-9]+\.[0-9]+-fpm/ {sub(".service",""); print; exit}')
if [[ -z "$phpfpm" ]]; then printf "\nUnable to detect php-fpm version. Is PHP-FPM installed?\n\n" ; exit 1 ; fi if [[ -z "$phpfpm" ]]; then printf "\nUnable to detect php-fpm version. Is PHP-FPM installed?\n\n" ; exit 1 ; fi
# #
@@ -59,7 +59,10 @@ checkservice() {
# #
# Function input check # Function input check
# #
inputcheck () { if [[ -z "$1" ]]; then usage ; printf "ERROR: DOMAIN CANNOT BE EMPTY!\n\n" ; exit; fi; } inputcheck () {
if [[ -z "$1" ]]; then usage ; printf "ERROR: DOMAIN CANNOT BE EMPTY!\n\n" ; exit 1; fi
if [[ "$1" =~ [[:space:]/] ]]; then printf "ERROR: DOMAIN INVALID (no spaces or slashes allowed)\n\n"; exit 1; fi
}
# #
# If Nginx or PHP-Fpm is not running then die. # If Nginx or PHP-Fpm is not running then die.
@@ -110,7 +113,7 @@ cat > /tmp/dokuwiki-postinstall <<EOF
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# Dokiwiki Postinstall Script # DokiWiki Postinstall Script
# #
# #
@@ -121,7 +124,7 @@ if [[ $(id -u) -ne 0 ]]; then echo "" && echo "Must be root or use sudo" && echo
# #
# Hardening of Dokuwiki # Hardening of Dokuwiki
# #
sed -i 's/# location /location /g' /etc/nginx/conf.d/"$hostname".conf sed -i 's/^[[:space:]]*#\s*location /location /g' /etc/nginx/conf.d/"$hostname".conf
# #
# Restart Nginx for changes to take effect # Restart Nginx for changes to take effect