fix: install script for Debian 13 (Python 3.13) compatibility
Some checks failed
CI / test WordOps (ubuntu-22.04) (push) Has been cancelled
CI / test WordOps (ubuntu-24.04) (push) Has been cancelled

- Split apt-get deps by distro version to avoid missing package failures
  (python3-distutils-extra removed in 3.12+, ntp replaced by systemd-timesyncd)
- Dynamically detect Python version for python3.XX-venv package
- Guard bare `pip` call with trixie exclusion and error suppression
- Check unattended-upgrades file exists before copying
- Fix 3 missing closing parentheses in site_backup.py format strings
- Update remaining Nginx references in comments and help text

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-09 06:48:13 +01:00
parent fa5bf17eb8
commit 9c4e71a43c

70
install
View File

@@ -206,32 +206,58 @@ wo_dir_init() {
wo_install_dep() { wo_install_dep() {
local wo_linux_distro local wo_linux_distro
wo_linux_distro=$(lsb_release -is) wo_linux_distro=$(lsb_release -is)
wo_python_venv=$(apt-cache policy python3.12-venv 2>&1 | grep -q Installed) local python_ver
if [ "$wo_linux_distro" == "Ubuntu" ]; then python_ver=$(python3 -c "import sys; print(sys.version_info[1])")
# install dependencies local wo_distro_codename
add-apt-repository ppa:git-core/ppa -y wo_distro_codename=$(lsb_release -sc)
apt-get --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \
build-essential curl gzip python3-pip python3-apt python3-venv gcc python3-dev sqlite3 git tar software-properties-common pigz \
gnupg2 cron ccze rsync apt-transport-https tree haveged ufw unattended-upgrades tzdata ntp zstd idn \
python3-distutils-extra libapt-pkg-dev bash-completion >/dev/null 2>&1
if $wo_python_venv; then
apt install -yy python3.12-venv >/dev/null 2>&1
fi
else # base packages available on all supported distros
# install dependencies local base_deps="build-essential curl gzip gcc python3-dev python3-pip python3-apt \
apt-get --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \ ca-certificates sqlite3 git tar software-properties-common pigz apt-transport-https \
build-essential curl gzip dirmngr sudo python3-pip python3-apt python3-venv gcc python3-dev ca-certificates sqlite3 git tar \ gnupg2 cron ccze rsync tree ufw tzdata zstd libapt-pkg-dev bash-completion"
software-properties-common pigz apt-transport-https gnupg2 cron ccze rsync tree haveged ufw unattended-upgrades tzdata ntp zstd idn \
python3-distutils-extra libapt-pkg-dev bash-completion >/dev/null 2>&1 # distro-specific packages
local extra_deps=""
case "$wo_distro_codename" in
trixie)
# Debian 13: ntp replaced by systemd-timesyncd, distutils removed
extra_deps="dirmngr sudo python3-full systemd-timesyncd"
;;
bookworm)
extra_deps="dirmngr sudo python3-distutils-extra haveged unattended-upgrades ntp idn"
;;
noble)
extra_deps="python3-distutils-extra haveged unattended-upgrades ntp idn"
;;
*)
extra_deps="dirmngr sudo python3-distutils-extra haveged unattended-upgrades ntp idn"
;;
esac
if [ "$wo_linux_distro" == "Ubuntu" ]; then
add-apt-repository ppa:git-core/ppa -y
fi
# install dependencies
apt-get --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold \
--assume-yes install $base_deps $extra_deps >/dev/null 2>&1
# install versioned python3-venv package
apt-get --assume-yes install "python3.${python_ver}-venv" >/dev/null 2>&1 || \
apt-get --assume-yes install python3-venv >/dev/null 2>&1
if [ "$wo_linux_distro" != "Ubuntu" ]; then
# add php repository gpg key # add php repository gpg key
curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb curl -sSLo /tmp/debsuryorg-archive-keyring.deb https://packages.sury.org/debsuryorg-archive-keyring.deb
dpkg -i /tmp/debsuryorg-archive-keyring.deb && rm -f /tmp/debsuryorg-archive-keyring.deb dpkg -i /tmp/debsuryorg-archive-keyring.deb && rm -f /tmp/debsuryorg-archive-keyring.deb
fi fi
locale-gen en locale-gen en
# enable unattended upgades # enable unattended upgrades
if [ ! -f /etc/apt/apt.conf.d/20auto-upgrades ]; then if [ -f /usr/share/unattended-upgrades/20auto-upgrades ]; then
cp -f /usr/share/unattended-upgrades/20auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades if [ ! -f /etc/apt/apt.conf.d/20auto-upgrades ]; then
cp -f /usr/share/unattended-upgrades/20auto-upgrades /etc/apt/apt.conf.d/20auto-upgrades
fi
fi fi
} }
@@ -481,8 +507,8 @@ wo_install() {
if [ -d /usr/local/lib/python3."$python_ver"/dist-packages ]; then if [ -d /usr/local/lib/python3."$python_ver"/dist-packages ]; then
cd /usr/local/lib/python3."$python_ver"/dist-packages || exit 1 cd /usr/local/lib/python3."$python_ver"/dist-packages || exit 1
fi fi
if [ "$wo_distro_codename" != "bookworm" ]; then if [ "$wo_distro_codename" != "bookworm" ] && [ "$wo_distro_codename" != "trixie" ]; then
pip uninstall -yq wo wordops ee pip uninstall -yq wo wordops ee 2>/dev/null || true
fi fi
cd || exit 1 cd || exit 1