Fix installer bugs: broken root checks, PHP version mismatches, dead paths

- Replace $EUID with $(id -u) for root checks across all bin/*.sh and
  install.sh: dash (Debian's /bin/sh) never sets $EUID, so the check was
  silently broken everywhere.
- lemp.sh: make apt-get upgrade non-interactive (--yes), align the Redis
  PHP module and php-fpm restart with $PHP_VERSION instead of a hardcoded
  8.1, and template the nginx PHP-FPM socket path via a PHP_FPM_SOCK
  placeholder substituted at install time.
- nginx-phpmyadmin.conf: fix docroot to match the actual phpMyAdmin
  symlink location created by lemp.sh.
- mysql-db.sh: inline the root check instead of sourcing the
  nonexistent bin/checkroot.sh.
- webhook.sh: fix chowm typo (chown).
- urbackup.sh: copy the systemd unit from assets/ instead of a relative
  path to a file that doesn't exist in the repo.
- _addUserSite.sh: fix invalid `$var=value` assignment and an empty
  if-block that was a POSIX sh syntax error.

Also carries over pending fixes to deploy-drupal.sh (drush now
invoked via vendor/bin/drush) and gitbarrerepos.sh (comment cleanup).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-04 09:28:08 +02:00
co-authored by Claude Sonnet 5
parent 5b11d25859
commit 7ff4df1173
23 changed files with 40 additions and 34 deletions
+6 -4
View File
@@ -10,7 +10,7 @@ echo -e '\033[35m
\033[0m'
echo -e "\033[35;1mLEMP server (Nginx Mysql Php-fpm) \033[0m"
if [ "$EUID" -ne 0 ]; then
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root"
exit
fi
@@ -42,7 +42,7 @@ sleep 3
apt-get --yes install ca-certificates apt-transport-https software-properties-common curl lsb-release
curl -sSL https://packages.sury.org/php/README.txt | bash -x
apt-get update && apt-get upgrade
apt-get update && apt-get --yes upgrade
echo -e "\033[35;1mInstalling PHP \033[0m"
sleep 3
@@ -103,6 +103,7 @@ sleep 3
apt-get --yes install nginx
mv /etc/nginx/sites-available/default /etc/nginx/sites-available/default.ori
cp "$_assets"/default.nginxconf /etc/nginx/sites-available/default
sed -i "s/PHP_FPM_SOCK/php${PHP_VERSION}-fpm.sock/g" /etc/nginx/sites-available/default
systemctl enable nginx
systemctl restart nginx
@@ -163,6 +164,7 @@ if [ "$installmysql" = "yes" ]; then
apt-get --yes install phpmyadmin
ln -s /usr/share/phpmyadmin /var/www/html/
cp "$_assets"/nginx-phpmyadmin.conf /etc/nginx/sites-available/phpmyadmin.conf
sed -i "s/PHP_FPM_SOCK/php${PHP_VERSION}-fpm.sock/g" /etc/nginx/sites-available/phpmyadmin.conf
echo -e "\033[92;1mphpMyAdmin installed\033[Om"
echo -e "\033[92;1mYou can access it at yourip/phpmyadmin\033[Om"
@@ -192,7 +194,7 @@ echo -e '\033[35m
\033[0m'
echo -e "\033[35;1mInstalling Redis \033[0m"
sleep 3
apt-get --yes install redis-server php8.1-redis
apt-get --yes install redis-server php${PHP_VERSION}-redis
# TODO set maxmemory=2gb
# TODO set maxmemory-policy=volatile-lru
@@ -206,7 +208,7 @@ apt-get --yes install redis-server php8.1-redis
systemctl enable redis-server
systemctl restart redis-server
systemctl restart php8.1-fpm
systemctl restart php${PHP_VERSION}-fpm
echo -e "\033[92;1mRedis installed\033[Om"
echo -e '\033[35m