fix: install script for Debian 13 (Python 3.13) compatibility
- 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:
58
install
58
install
@@ -206,33 +206,59 @@ wo_dir_init() {
|
||||
wo_install_dep() {
|
||||
local wo_linux_distro
|
||||
wo_linux_distro=$(lsb_release -is)
|
||||
wo_python_venv=$(apt-cache policy python3.12-venv 2>&1 | grep -q Installed)
|
||||
local python_ver
|
||||
python_ver=$(python3 -c "import sys; print(sys.version_info[1])")
|
||||
local wo_distro_codename
|
||||
wo_distro_codename=$(lsb_release -sc)
|
||||
|
||||
# base packages available on all supported distros
|
||||
local base_deps="build-essential curl gzip gcc python3-dev python3-pip python3-apt \
|
||||
ca-certificates sqlite3 git tar software-properties-common pigz apt-transport-https \
|
||||
gnupg2 cron ccze rsync tree ufw tzdata zstd libapt-pkg-dev bash-completion"
|
||||
|
||||
# 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
|
||||
# install dependencies
|
||||
add-apt-repository ppa:git-core/ppa -y
|
||||
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
|
||||
# install dependencies
|
||||
apt-get --option=Dpkg::options::=--force-confmiss --option=Dpkg::options::=--force-confold --assume-yes install \
|
||||
build-essential curl gzip dirmngr sudo python3-pip python3-apt python3-venv gcc python3-dev ca-certificates sqlite3 git tar \
|
||||
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
|
||||
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
|
||||
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
|
||||
fi
|
||||
|
||||
locale-gen en
|
||||
# enable unattended upgades
|
||||
# enable unattended upgrades
|
||||
if [ -f /usr/share/unattended-upgrades/20auto-upgrades ]; then
|
||||
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
|
||||
}
|
||||
|
||||
wo_download_gpg_keys() {
|
||||
@@ -481,8 +507,8 @@ wo_install() {
|
||||
if [ -d /usr/local/lib/python3."$python_ver"/dist-packages ]; then
|
||||
cd /usr/local/lib/python3."$python_ver"/dist-packages || exit 1
|
||||
fi
|
||||
if [ "$wo_distro_codename" != "bookworm" ]; then
|
||||
pip uninstall -yq wo wordops ee
|
||||
if [ "$wo_distro_codename" != "bookworm" ] && [ "$wo_distro_codename" != "trixie" ]; then
|
||||
pip uninstall -yq wo wordops ee 2>/dev/null || true
|
||||
fi
|
||||
|
||||
cd || exit 1
|
||||
|
||||
Reference in New Issue
Block a user