fix: save install dir before cd and use absolute path for setup.py
Some checks failed
CI / test WordOps (ubuntu-22.04) (push) Has been cancelled
CI / test WordOps (ubuntu-24.04) (push) Has been cancelled

wo_install() does cd to HOME before checking for setup.py, so
./setup.py was always checking /root/setup.py (doesn't exist) instead
of /root/WPIQ/setup.py. Save pwd at script start and reference it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-09 08:19:17 +01:00
parent 15e70efa01
commit 418d0fdda2

20
install
View File

@@ -552,9 +552,10 @@ wo_install() {
fi fi
fi fi
if [ -f ./setup.py ]; then if [ -f "$wo_install_dir/setup.py" ]; then
/opt/wo/bin/pip install --force-reinstall --no-cache-dir --no-deps . 2>/dev/null cd "$wo_install_dir" || exit 1
/opt/wo/bin/pip install . --upgrade-strategy=eager /opt/wo/bin/pip install --force-reinstall --no-cache-dir --no-deps .
cd || exit 1
elif [ "$wo_branch" = "master" ]; then elif [ "$wo_branch" = "master" ]; then
/opt/wo/bin/pip install -U wordops --upgrade-strategy=eager /opt/wo/bin/pip install -U wordops --upgrade-strategy=eager
else else
@@ -581,10 +582,10 @@ wo_travis_install() {
wo_distro_codename=$(lsb_release -sc) wo_distro_codename=$(lsb_release -sc)
local wo_linux_distro local wo_linux_distro
wo_linux_distro=$(lsb_release -is) wo_linux_distro=$(lsb_release -is)
if [ -d ./dist ]; then if [ -d "$wo_install_dir/dist" ]; then
rm -rf dist rm -rf "$wo_install_dir/dist"
fi fi
if [ -f ./setup.py ]; then if [ -f "$wo_install_dir/setup.py" ]; then
if [ -d /opt/wo/lib/python3."$python_ver"/site-packages/apt ]; then if [ -d /opt/wo/lib/python3."$python_ver"/site-packages/apt ]; then
source /opt/wo/bin/activate source /opt/wo/bin/activate
/opt/wo/bin/pip uninstall -yq setuptools /opt/wo/bin/pip uninstall -yq setuptools
@@ -816,8 +817,8 @@ wo_init() {
bash -c "echo -e \"[user]\n\tname = $USER_OR_WORDOPS\n\temail = root@$HOSTNAME.local\" > $HOME/.gitconfig" bash -c "echo -e \"[user]\n\tname = $USER_OR_WORDOPS\n\temail = root@$HOSTNAME.local\" > $HOME/.gitconfig"
} }
fi fi
if [ -f ./setup.py ]; then if [ -f "$wo_install_dir/setup.py" ]; then
wo_version_new=$(grep "version='" setup.py | awk -F "'" '{print $2}' 2>&1) wo_version_new=$(grep "version='" "$wo_install_dir/setup.py" | awk -F "'" '{print $2}' 2>&1)
else else
wo_version_new=$(curl -m 5 --retry 3 -sL https://api.github.com/repos/WordOps/WordOps/releases/latest 2>&1 | jq -r '.tag_name') wo_version_new=$(curl -m 5 --retry 3 -sL https://api.github.com/repos/WordOps/WordOps/releases/latest 2>&1 | jq -r '.tag_name')
fi fi
@@ -845,6 +846,9 @@ wo_git_secure_path() {
# 4 - WO MAIN SETUP # 4 - WO MAIN SETUP
### ###
# save the directory from which the install was launched
readonly wo_install_dir="$(pwd)"
# create required directories # create required directories
wo_dir_init wo_dir_init
# install lsb_release, curl, gpg and display header # install lsb_release, curl, gpg and display header