diff --git a/.github/workflows/check-code-with-shellcheck.yml b/.github/workflows/check-code-with-shellcheck.yml index 7f6c15aa82..9f1453b274 100644 --- a/.github/workflows/check-code-with-shellcheck.yml +++ b/.github/workflows/check-code-with-shellcheck.yml @@ -10,9 +10,9 @@ jobs: name: Github Actions runs-on: ubuntu-latest steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + - uses: actions/checkout@v6 - name: Run Shellcheck - uses: ludeeus/action-shellcheck@00b27aa7cb85167568cb48a3838b75f4265f2bca # master + uses: ludeeus/action-shellcheck@master with: check_together: 'yes' env: diff --git a/.github/workflows/install-smoke-test.yml b/.github/workflows/install-smoke-test.yml new file mode 100644 index 0000000000..864b64ebd6 --- /dev/null +++ b/.github/workflows/install-smoke-test.yml @@ -0,0 +1,135 @@ +name: 'install-smoke-test' + +# Manual / scheduled smoke test that runs nextcloud_install_production.sh +# end-to-end inside a privileged Ubuntu 26.04 container. Catches: +# - apt package availability changes between LTS releases +# - PHP/PG/Apache config breakage +# - Nextcloud download + occ install regressions +# - lib.sh sourcing / version-gate regressions +# +# Does NOT cover: +# - real LVM snapshot / lvextend behavior (loopback approximation) +# - hypervisor-specific kernel installs (Hyper-V, VMware, QEMU) +# - reboot path (stubbed) +# +# Manual trigger only — runtime ~25 min, ~3 GB RAM. + +on: + pull_request: + workflow_dispatch: + inputs: + ubuntu_image: + description: 'Ubuntu image to test against (e.g. ubuntu:26.04, ubuntu:24.04)' + default: 'ubuntu:26.04' + required: true + +permissions: + contents: read + +jobs: + install: + name: 'Run nextcloud_install_production.sh -p' + runs-on: ubuntu-latest + timeout-minutes: 45 + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + # Default checks out the ref that fired workflow_dispatch (so picking + # `upgrade-os-26.04` from the UI tests that branch). + ref: ${{ github.ref }} + + - name: Run install script in privileged container + env: + UBUNTU_IMAGE: ${{ inputs.ubuntu_image || 'ubuntu:26.04' }} + run: | + set -e + docker run --rm \ + --privileged \ + --user 0:0 \ + --name nc-install \ + -v "$PWD:/repo:ro" \ + -e DEBIAN_FRONTEND=noninteractive \ + -e SUDO_USER=root \ + -e RUNLEVEL=1 \ + -e TERM=dumb \ + -e LANG=C.UTF-8 \ + -e LC_ALL=C.UTF-8 \ + "$UBUNTU_IMAGE" \ + bash -c ' + set -e + # Diagnostics — confirm we are root inside the container + id + # Bare image bootstrap so the install script can run + apt-get update -qq + apt-get install -qqy --no-install-recommends \ + sudo curl ca-certificates lsb-release iproute2 \ + netcat-openbsd whiptail locales mount util-linux + # Generate the C.UTF-8 locale so ram_check can parse meminfo + locale-gen C.UTF-8 en_US.UTF-8 + update-locale LANG=C.UTF-8 LC_ALL=C.UTF-8 + # Override the default policy-rc.d that blocks service starts in + # apt postinst. Without this, postgresql installs but its cluster + # never gets started. + printf "#!/bin/sh\nexit 0\n" > /usr/sbin/policy-rc.d + chmod 0755 /usr/sbin/policy-rc.d + # Re-enable Install-Recommends. Ubuntu Docker images ship with + # APT::Install-Recommends "false" which prevents php-fpm from + # pulling in php-cli (needed for occ, etc.). + printf "APT::Install-Recommends \"true\";\nAPT::Install-Suggests \"false\";\n" \ + > /etc/apt/apt.conf.d/00recommends + # systemctl shim — container has no PID-1 systemd. Translate + # start/restart/stop to /etc/init.d/ or no-op. + printf "%s\n" \ + "#!/bin/bash" \ + "cmd=\${1:-}" \ + "svc=\${2:-}" \ + "svc=\${svc%.service}" \ + "case \"\$cmd\" in" \ + " start|stop|restart|reload|status)" \ + " if [ -x \"/etc/init.d/\$svc\" ]; then" \ + " /etc/init.d/\$svc \"\$cmd\"" \ + " else" \ + " echo \"[systemctl shim] no-op: \$cmd \$svc\" >&2" \ + " exit 0" \ + " fi" \ + " ;;" \ + " *)" \ + " echo \"[systemctl shim] no-op: \$*\" >&2" \ + " exit 0" \ + " ;;" \ + "esac" \ + > /usr/local/bin/systemctl + chmod +x /usr/local/bin/systemctl + # Pre-seed /var/scripts so fetch_lib.sh uses THIS branch'"'"'s lib.sh + # instead of downloading the stale copy from main. + # fetch_lib.sh skips the download when both files already exist. + mkdir -p /var/scripts + cp /repo/lib.sh /var/scripts/lib.sh + touch /var/scripts/nextcloud-startup-script.sh + # Loop device for /dev/sdb (script expects a second disk for ZFS). + # Best-effort: skip silently if losetup unavailable in this kernel. + # `loop` is built into the host kernel on GH runners, no modprobe needed. + set +e + truncate -s 6G /tmp/disk-sdb.img + LOOP=$(losetup -f 2>/dev/null) + if [ -n "$LOOP" ] && losetup -P "$LOOP" /tmp/disk-sdb.img 2>/dev/null; then + ln -sf "$LOOP" /dev/sdb + echo "Created /dev/sdb -> $LOOP" + else + echo "WARNING: could not create loop device; format-sdb step will fail" >&2 + fi + set -e + # Stub reboot so the script does not actually try to reboot. + # (printf instead of heredoc — closing heredoc tag cannot be indented + # inside a YAML run block.) + printf "#!/bin/sh\necho \"[reboot stubbed in CI: \$*]\" >&2\nexit 0\n" \ + > /usr/local/sbin/reboot + chmod +x /usr/local/sbin/reboot + ln -sf /usr/local/sbin/reboot /usr/local/sbin/shutdown + # Make a copy we can edit (script lives in read-only mount) + cp -a /repo /work + cd /work + # Run installer in provisioning mode (no prompts) + bash nextcloud_install_production.sh -p + ' diff --git a/.github/workflows/reviewdog.yml b/.github/workflows/reviewdog.yml index 24f65145d2..8aaa3a33cf 100644 --- a/.github/workflows/reviewdog.yml +++ b/.github/workflows/reviewdog.yml @@ -11,9 +11,9 @@ jobs: name: Shellcheck testing runs-on: ubuntu-latest steps: - - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + - uses: actions/checkout@v6 - name: shellcheck - uses: reviewdog/action-shellcheck@4c07458293ac342d477251099501a718ae5ef86e # v1 + uses: reviewdog/action-shellcheck@v1 with: github_token: ${{ secrets.github_token }} reporter: github-pr-review @@ -25,9 +25,9 @@ jobs: runs-on: ubuntu-latest steps: - name: spelling or typos - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6 + uses: actions/checkout@v6 - name: misspell - uses: reviewdog/action-misspell@d6429416b12b09b4e2768307d53bef58d172e962 # v1 + uses: reviewdog/action-misspell@v1 with: github_token: ${{ secrets.github_token }} locale: "US" diff --git a/README.md b/README.md index 534db1d42c..fbcb1b3e73 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,12 @@ Server installation. Simplified. :cloud: -------------------- ## Dependencies: -(Ubuntu Server 24.04 LTS *minimal* 64-bit) +(Ubuntu Server 26.04 LTS *minimal* 64-bit)
-(Linux Kernel: 6.8) +(Linux Kernel: 7.0) - Apache 2.4 -- PostgreSQL 16 -- PHP-FPM 8.3 +- PostgreSQL 18 +- PHP-FPM 8.5 - Redis Memcache (Ubuntu package) - PHP-igbinary (Ubuntu package) - PHP-smbclient (Ubuntu package) diff --git a/addons/redis-server-ubuntu.sh b/addons/redis-server-ubuntu.sh index e4467644bb..ecb8c0c968 100644 --- a/addons/redis-server-ubuntu.sh +++ b/addons/redis-server-ubuntu.sh @@ -16,9 +16,9 @@ debug_mode root_check # Check Ubuntu version -if ! version 18.04 "$DISTRO" 24.04.10 +if ! version 18.04 "$DISTRO" "$SUPPORTED_VERSION_MAX" then - msg_box "Your current Ubuntu version is $DISTRO but must be between 18.04 - 24.04.10 to run this script." + msg_box "Your current Ubuntu version is $DISTRO but must be between 18.04 - $SUPPORTED_VERSION_MAX to run this script." msg_box "Please contact us to get support for upgrading your server: https://www.hanssonit.se/#contact https://shop.hanssonit.se/" diff --git a/apps/adminneo.sh b/apps/adminneo.sh index e76587bae2..80003b1c22 100644 --- a/apps/adminneo.sh +++ b/apps/adminneo.sh @@ -92,8 +92,8 @@ fi print_text_in_color "$IGreen" "AdminNeo ${ADMINNEO_VERSION} successfully downloaded!" -# Only add TLS 1.3 on Ubuntu later than 22.04 -if version 22.04 "$DISTRO" 24.04.10 +# Only add TLS 1.3 on supported Ubuntu releases +if version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then TLS13="+TLSv1.3" fi diff --git a/apps/collabora_docker.sh b/apps/collabora_docker.sh index d8e54f1727..2d2b820a4a 100644 --- a/apps/collabora_docker.sh +++ b/apps/collabora_docker.sh @@ -135,8 +135,8 @@ a2enmod proxy_http a2enmod ssl a2enmod headers -# Only add TLS 1.3 on Ubuntu later than 22.04 -if version 22.04 "$DISTRO" 24.04.10 +# Only add TLS 1.3 on supported Ubuntu releases +if version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then TLS13="+TLSv1.3" fi diff --git a/apps/onlyoffice_docker.sh b/apps/onlyoffice_docker.sh index df5a1b1e21..cf66648c61 100644 --- a/apps/onlyoffice_docker.sh +++ b/apps/onlyoffice_docker.sh @@ -152,8 +152,8 @@ a2enmod proxy_http a2enmod ssl a2enmod headers -# Only add TLS 1.3 on Ubuntu later than 22.04 -if version 22.04 "$DISTRO" 24.04.10 +# Only add TLS 1.3 on supported Ubuntu releases +if version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then TLS13="+TLSv1.3" fi diff --git a/apps/pico_cms.sh b/apps/pico_cms.sh index 32fdc4418c..0a6ccdf4d6 100644 --- a/apps/pico_cms.sh +++ b/apps/pico_cms.sh @@ -214,8 +214,8 @@ a2enmod proxy_http a2enmod ssl a2enmod headers -# Only add TLS 1.3 on Ubuntu later than 22.04 -if version 22.04 "$DISTRO" 24.04.10 +# Only add TLS 1.3 on supported Ubuntu releases +if version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then TLS13="+TLSv1.3" fi diff --git a/apps/smbmount.sh b/apps/smbmount.sh index acad239450..9fd32281c4 100644 --- a/apps/smbmount.sh +++ b/apps/smbmount.sh @@ -350,14 +350,14 @@ We please you to do the math yourself if the number is high enough for your setu # Get installed php version check_php # Enable Inotify - if [ ! -f $PHP_MODS_DIR/inotify.ini ] + if [ ! -f "$PHP_MODS_DIR"/inotify.ini ] then - touch $PHP_MODS_DIR/inotify.ini + touch "$PHP_MODS_DIR"/inotify.ini fi - if ! grep -qFx extension=inotify.so $PHP_MODS_DIR/inotify.ini + if ! grep -qFx extension=inotify.so "$PHP_MODS_DIR"/inotify.ini then - echo "# PECL inotify" > $PHP_MODS_DIR/inotify.ini - echo "extension=inotify.so" >> $PHP_MODS_DIR/inotify.ini + echo "# PECL inotify" > "$PHP_MODS_DIR"/inotify.ini + echo "extension=inotify.so" >> "$PHP_MODS_DIR"/inotify.ini check_command phpenmod -v ALL inotify fi diff --git a/apps/talk.sh b/apps/talk.sh index 04b6ad657f..272a93460d 100644 --- a/apps/talk.sh +++ b/apps/talk.sh @@ -93,10 +93,10 @@ else removal_popup "$SCRIPT_NAME" fi -# Must be 24.04 -if ! version 22.04 "$DISTRO" 24.04.10 +# Must be on a supported Ubuntu release +if ! version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then - msg_box "Your current Ubuntu version is $DISTRO but must be between 22.04 - 24.04.10 to install Talk" + msg_box "Your current Ubuntu version is $DISTRO but must be between $SUPPORTED_VERSION_MIN - $SUPPORTED_VERSION_MAX to install Talk" msg_box "Please contact us to get support for upgrading your server: https://www.hanssonit.se/#contact https://shop.hanssonit.se/" @@ -444,8 +444,8 @@ mkdir -p /var/www/html/error echo "Hi there! :) If you see this page, the Apache2 proxy for $SCRIPT_NAME is up and running." > /var/www/html/error/404_proxy.html chown -R www-data:www-data /var/www/html/error -# Only add TLS 1.3 on Ubuntu later than 22.04 -if version 22.04 "$DISTRO" 24.04.10 +# Only add TLS 1.3 on supported Ubuntu releases +if version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then TLS13="+TLSv1.3" fi diff --git a/apps/tmbitwarden.sh b/apps/tmbitwarden.sh index 5868aa0296..beb7796930 100644 --- a/apps/tmbitwarden.sh +++ b/apps/tmbitwarden.sh @@ -240,8 +240,8 @@ a2enmod ssl a2enmod headers a2enmod remoteip -# Only add TLS 1.3 on Ubuntu later than 22.04 -if version 22.04 "$DISTRO" 24.04.10 +# Only add TLS 1.3 on supported Ubuntu releases +if version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then TLS13="+TLSv1.3" fi diff --git a/apps/vaultwarden.sh b/apps/vaultwarden.sh index 2ce550898b..b3f066be6c 100644 --- a/apps/vaultwarden.sh +++ b/apps/vaultwarden.sh @@ -122,8 +122,8 @@ a2enmod ssl a2enmod headers a2enmod remoteip -# Only add TLS 1.3 on Ubuntu later than 22.04 -if version 22.04 "$DISTRO" 24.04.10 +# Only add TLS 1.3 on supported Ubuntu releases +if version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then TLS13="+TLSv1.3" fi diff --git a/apps/webmin.sh b/apps/webmin.sh index 1f0078a321..5a075a5690 100644 --- a/apps/webmin.sh +++ b/apps/webmin.sh @@ -52,7 +52,6 @@ install_if_not libauthen-pam-perl install_if_not libpam-runtime install_if_not libio-pty-perl install_if_not apt-show-versions -install_if_not python2 install_if_not unzip install_if_not shared-mime-info install_if_not zip diff --git a/disk/change-to-zfs-mount-generator.sh b/disk/change-to-zfs-mount-generator.sh index bc6f7d652c..5b70f0ba49 100644 --- a/disk/change-to-zfs-mount-generator.sh +++ b/disk/change-to-zfs-mount-generator.sh @@ -18,7 +18,7 @@ source /var/scripts/fetch_lib.sh # Check if root root_check -# Needs to be Ubuntu 22.04 and Multiverse +# Needs a supported Ubuntu release (see lib.sh) and Multiverse check_distro_version check_multiverse diff --git a/disk/format-chosen.sh b/disk/format-chosen.sh index 054e5627f1..d23a7c1d9a 100644 --- a/disk/format-chosen.sh +++ b/disk/format-chosen.sh @@ -10,7 +10,7 @@ source /var/scripts/fetch_lib.sh # Check if root root_check -# Needs to be Ubuntu 22.04 and Multiverse +# Needs a supported Ubuntu release (see lib.sh) and Multiverse check_distro_version check_multiverse diff --git a/disk/format-sdb.sh b/disk/format-sdb.sh index 5a82f57be7..16156c17d1 100644 --- a/disk/format-sdb.sh +++ b/disk/format-sdb.sh @@ -10,7 +10,7 @@ source /var/scripts/fetch_lib.sh # Check if root root_check -# Needs to be Ubuntu 22.04 and Multiverse +# Needs a supported Ubuntu release (see lib.sh) and Multiverse check_distro_version check_multiverse diff --git a/lets-encrypt/activate-tls.sh b/lets-encrypt/activate-tls.sh index 4bda5aa8da..196170868a 100644 --- a/lets-encrypt/activate-tls.sh +++ b/lets-encrypt/activate-tls.sh @@ -115,21 +115,21 @@ fi # To get the correct version for the Apache conf file check_php -# Only add TLS 1.3 on Ubuntu later than 22.04 -if version 22.04 "$DISTRO" 24.04.10 +# Only add TLS 1.3 on supported Ubuntu releases +if version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then TLS13="+TLSv1.3" fi # Fix zero file sizes # See https://github.com/nextcloud/server/issues/3056 -if version 24.04 "$DISTRO" 26.04.10 +if version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then SETENVPROXY="SetEnv proxy-sendcl 1" fi # Install Brotli -if version 24.04 "$DISTRO" 26.04.10 +if version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then if ! [ -f /etc/apache2/conf-available/brotli.conf ] then diff --git a/lib.sh b/lib.sh index c6bf8d7f6a..b4db3d15c1 100644 --- a/lib.sh +++ b/lib.sh @@ -161,8 +161,14 @@ HTTP2_CONF="/etc/apache2/mods-available/http2.conf" GEOBLOCK_MOD_CONF="/etc/apache2/conf-available/geoblock.conf" GEOBLOCK_MOD="/etc/apache2/mods-available/maxminddb.load" GEOBLOCK_DIR="/usr/share/GeoIP" +# Supported Ubuntu range — single source of truth. Bump these on the next OS upgrade. +SUPPORTED_VERSION_MIN=24.04 +SUPPORTED_VERSION_MAX=26.04.10 +# Latest release without the trailing point version (e.g. 26.04.10 -> 26.04) +LATEST_VERSION="${SUPPORTED_VERSION_MAX%.*}" +SUPPORTED_CODENAMES=(noble resolute) # PHP-FPM -PHPVER=8.3 +PHPVER=8.5 PHP_FPM_DIR=/etc/php/$PHPVER/fpm PHP_INI=$PHP_FPM_DIR/php.ini PHP_POOL_DIR=$PHP_FPM_DIR/pool.d @@ -874,10 +880,10 @@ version(){ [[ $2 != "$h" && $2 != "$t" ]] } -if ! version 22.04 "$DISTRO" 24.04.10 +if ! version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then print_text_in_color "$IRed" "Your current Ubuntu version is $DISTRO but must be between \ -22.04 - 24.04.10 to run this script." +$SUPPORTED_VERSION_MIN - $SUPPORTED_VERSION_MAX to run this script." print_text_in_color "$ICyan" "Please contact us for support upgrading your server:" print_text_in_color "$ICyan" "https://www.hanssonit.se/#contact" print_text_in_color "$ICyan" "https://shop.hanssonit.se/" @@ -1233,19 +1239,14 @@ remove_from_trusted_domains() { } check_distro_version() { -# Support Ubuntu 22.04 jammy, and Ubuntu 24.04 noble. +# Supported Ubuntu codenames are listed in $SUPPORTED_CODENAMES (lib.sh). -# Check Ubuntu version -if [ "${CODENAME}" == "jammy" ] || [ "${CODENAME}" == "noble" ] -then - OS=1 -elif lsb_release -i | grep -ic "Ubuntu" &> /dev/null -then - OS=1 -elif uname -a | grep -ic "jammy" &> /dev/null || uname -a | grep -ic "noble" &> /dev/null -then - OS=1 -elif uname -v | grep -ic "Ubuntu" &> /dev/null +# Check Ubuntu version: codename match, or any Ubuntu identifier in lsb_release/uname. +local CODENAMES_RE +CODENAMES_RE="$(IFS='|'; echo "${SUPPORTED_CODENAMES[*]}")" +if [[ " ${SUPPORTED_CODENAMES[*]} " == *" $CODENAME "* ]] \ + || lsb_release -ds 2>/dev/null | grep -Eiq "ubuntu|$CODENAMES_RE" \ + || uname -a | grep -Eiq "ubuntu|$CODENAMES_RE" then OS=1 fi @@ -1259,8 +1260,8 @@ You can find the download link here: https://www.ubuntu.com/download/server" exit 1 fi -if ! version 22.04 "$DISTRO" 24.04.10; then - msg_box "Your current Ubuntu version is $DISTRO but must be between 22.04 - 24.04.10 to run this script." +if ! version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX"; then + msg_box "Your current Ubuntu version is $DISTRO but must be between $SUPPORTED_VERSION_MIN - $SUPPORTED_VERSION_MAX to run this script." msg_box "Please contact us to get support for upgrading your server: https://www.hanssonit.se/#contact https://shop.hanssonit.se/product/upgrade-ubuntu-os-between-major-versions/" @@ -1419,7 +1420,7 @@ version(){ [[ $2 != "$h" && $2 != "$t" ]] } -if version 22.04 "$DISTRO" 24.04.10 +if version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then print_text_in_color "$ICyan" "Testing if network is OK..." if site_200 github.com @@ -1444,7 +1445,7 @@ then fi fi else - msg_box "Your current Ubuntu version is $DISTRO but must be between 22.04 - 24.04.10 to run this script." + msg_box "Your current Ubuntu version is $DISTRO but must be between $SUPPORTED_VERSION_MIN - $SUPPORTED_VERSION_MAX to run this script." msg_box "Please contact us to get support for upgrading your server: https://www.hanssonit.se/#contact https://shop.hanssonit.se/" @@ -2242,7 +2243,16 @@ does_snapshot_exist() { check_php() { print_text_in_color "$ICyan" "Getting current PHP-version..." -GETPHP="$(php -v | grep -m 1 PHP | awk '{print $2}' | cut -d '-' -f1)" +# Extract MAJOR.MINOR (e.g. "8.5") from `php -v`. Works for any future PHP version +# without needing to extend a hardcoded list. +GETPHP="$(php -v 2>/dev/null | grep -m 1 -oE '^PHP [0-9]+\.[0-9]+' | awk '{print $2}')" + +# Fallback: pick the highest /etc/php/X.Y directory if `php -v` failed (e.g. CLI not installed yet) +if [ -z "$GETPHP" ] && [ -d /etc/php ] +then + GETPHP="$(find /etc/php -mindepth 1 -maxdepth 1 -type d -printf '%f\n' 2>/dev/null \ + | grep -E '^[0-9]+\.[0-9]+$' | sort -V | tail -n1)" +fi if [ -z "$GETPHP" ] then @@ -2250,43 +2260,7 @@ then exit 1 fi -if grep 7.0 <<< "$GETPHP" >/dev/null 2>&1 -then - export PHPVER=7.0 -elif grep 7.1 <<< "$GETPHP" >/dev/null 2>&1 -then - export PHPVER=7.1 -elif grep 7.2 <<< "$GETPHP" >/dev/null 2>&1 -then - export PHPVER=7.2 -elif grep 7.3 <<< "$GETPHP" >/dev/null 2>&1 -then - export PHPVER=7.3 -elif grep 7.4 <<< "$GETPHP" >/dev/null 2>&1 -then - export PHPVER=7.4 -elif grep 8.0 <<< "$GETPHP" >/dev/null 2>&1 -then - export PHPVER=8.0 -elif grep 8.1 <<< "$GETPHP" >/dev/null 2>&1 -then - export PHPVER=8.1 -elif grep 8.2 <<< "$GETPHP" >/dev/null 2>&1 -then - export PHPVER=8.2 -elif grep 8.3 <<< "$GETPHP" >/dev/null 2>&1 -then - export PHPVER=8.3 -elif grep 8.4 <<< "$GETPHP" >/dev/null 2>&1 -then - export PHPVER=8.4 -elif grep 8.5 <<< "$GETPHP" >/dev/null 2>&1 -then - export PHPVER=8.5 -elif grep 8.6 <<< "$GETPHP" >/dev/null 2>&1 -then - export PHPVER=8.6 -fi +export PHPVER="$GETPHP" # Export other PHP variables based on PHPVER export PHP_FPM_DIR=/etc/php/$PHPVER/fpm @@ -2339,14 +2313,14 @@ add_trusted_key_and_repo() { # $1 = whatever.asc # $2 = Key URL e.g. https://download.webmin.com # $3 = Deb URL e.g. https://download.webmin.com/download/repository - # $4 = "$CODENAME $CODENAME main" (e.g. jammy jammy main) + # $4 = "$CODENAME $CODENAME main" (e.g. noble noble main) # $5 = debpackage-name.list # This function is only supported in the currently supported release check_distro_version # Do the magic - if version 22.04 "$DISTRO" 24.04.10 + if version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then # New recommended way not using apt-key print_text_in_color "$ICyan" "Adding trusted key in /etc/apt/keyrings/$1..." diff --git a/nextcloud_install_production.sh b/nextcloud_install_production.sh index 1676fae702..728248b4da 100644 --- a/nextcloud_install_production.sh +++ b/nextcloud_install_production.sh @@ -63,9 +63,9 @@ is_process_running apt is_process_running dpkg # Check distribution and version -if ! version 24.04 "$DISTRO" 24.04.10 +if ! version "$LATEST_VERSION" "$DISTRO" "$SUPPORTED_VERSION_MAX" then - msg_box "This script can only be run on Ubuntu 24.04 (server)." + msg_box "This script can only be run on Ubuntu $LATEST_VERSION (server)." exit 1 fi @@ -221,19 +221,24 @@ fi # Check if it's a clean server stop_if_installed postgresql +# Stop if any versioned PostgreSQL is already installed (covers PG 9.x through 30) +for PG_VER in 9.{0..9} {10..30} +do + stop_if_installed postgresql-"$PG_VER" +done stop_if_installed apache2 stop_if_installed nginx stop_if_installed php stop_if_installed php-fpm stop_if_installed php-common -stop_if_installed php"$PHPVER"-fpm -stop_if_installed php7.0-fpm -stop_if_installed php7.1-fpm -stop_if_installed php7.2-fpm -stop_if_installed php7.3-fpm -stop_if_installed php8.0-fpm -stop_if_installed php8.1-fpm -stop_if_installed php8.2-fpm +# Stop if any php-fpm (current or older) is already installed — must be a clean server +for PHP_MAJOR in 7 8 +do + for PHP_MINOR in 0 1 2 3 4 5 6 7 8 9 + do + stop_if_installed php"$PHP_MAJOR.$PHP_MINOR"-fpm + done +done stop_if_installed mysql-common stop_if_installed mariadb-server @@ -442,7 +447,8 @@ fi install_if_not php"$PHPVER"-fpm install_if_not php"$PHPVER"-intl install_if_not php"$PHPVER"-ldap -install_if_not php"$PHPVER"-imap +# php-imap was deprecated in PHP 8.4 and removed in PHP 8.5 (no longer in Ubuntu). +# Nextcloud Mail uses bytestream/horde-imap-client (pure PHP) and does not need it. install_if_not php"$PHPVER"-gd install_if_not php"$PHPVER"-pgsql install_if_not php"$PHPVER"-curl @@ -1045,7 +1051,7 @@ fi # Fix Realtek on PN51 if asuspn51 then - if ! version 24.04 "$DISTRO" 24.04.10 + if ! version "$LATEST_VERSION" "$DISTRO" "$SUPPORTED_VERSION_MAX" then # Upgrade Realtek drivers print_text_in_color "$ICyan" "Upgrading Realtek firmware..." diff --git a/nextcloud_update.sh b/nextcloud_update.sh index e74d69611b..65c2d2885b 100644 --- a/nextcloud_update.sh +++ b/nextcloud_update.sh @@ -42,8 +42,8 @@ root_check is_process_running apt is_process_running dpkg -# Automatically restart services (Ubuntu 24.04) -if ! version 16.04.10 "$DISTRO" 22.04.10 +# Automatically restart services (latest Ubuntu LTS) +if version "$LATEST_VERSION" "$DISTRO" "$SUPPORTED_VERSION_MAX" then if [ ! -f /etc/needrestart/needrestart.conf ] then @@ -396,7 +396,7 @@ fi # Fix Realtek on PN51 if asuspn51 then - if ! version 24.04 "$DISTRO" 24.04.10 + if ! version "$LATEST_VERSION" "$DISTRO" "$SUPPORTED_VERSION_MAX" then # Upgrade Realtek drivers print_text_in_color "$ICyan" "Upgrading Realtek firmware..." diff --git a/not-supported/pi-hole.sh b/not-supported/pi-hole.sh index e823d70ab9..443c4c324f 100644 --- a/not-supported/pi-hole.sh +++ b/not-supported/pi-hole.sh @@ -325,8 +325,8 @@ a2enmod ssl a2enmod proxy a2enmod proxy_http -# Only add TLS 1.3 on Ubuntu later than 22.04 -if version 22.04 "$DISTRO" 24.04.10 +# Only add TLS 1.3 on supported Ubuntu releases +if version "$SUPPORTED_VERSION_MIN" "$DISTRO" "$SUPPORTED_VERSION_MAX" then TLS13="+TLSv1.3" fi diff --git a/vagrant/README.md b/vagrant/README.md index 4c326f05cc..87c947462c 100644 --- a/vagrant/README.md +++ b/vagrant/README.md @@ -1,5 +1,5 @@ # Nextcloud VM with vagrant -This subrepo contains all the Vagrant config to get an Ubuntu 24.04 VM with the latest version of Nextcloud installed. +This subrepo contains all the Vagrant config to get an Ubuntu 26.04 VM with the latest version of Nextcloud installed. **Please note that this is __not__ the preferred way to install Nextcloud. It's also untested in the current state.**