mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2026-11-02 08:10:02 -06:00
changes
This commit is contained in:
1 parent
f9dc6e0047
commit
a426c9d4d8
1 file changed
+19
-5
@@ -2,23 +2,37 @@
|
||||
set -euo pipefail
|
||||
|
||||
VENV_DIR="/opt/libreqos/venv"
|
||||
REQUIREMENTS="/opt/libreqos/src/requirements.txt"
|
||||
CONSTRAINTS="/opt/libreqos/src/deb-requirements-constraints.txt"
|
||||
REQUIREMENTS=""
|
||||
CONSTRAINTS=""
|
||||
|
||||
if [ "$(id -u)" -ne 0 ]; then
|
||||
echo "rebuild_python_venv.sh must be run as root." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$REQUIREMENTS" ]; then
|
||||
echo "LibreQoS Python requirements file not found: $REQUIREMENTS" >&2
|
||||
for candidate in /opt/libreqos/src/requirements.txt /opt/libreqos/requirements.txt; do
|
||||
if [ -f "$candidate" ]; then
|
||||
REQUIREMENTS="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$REQUIREMENTS" ]; then
|
||||
echo "LibreQoS Python requirements file not found in /opt/libreqos/src or /opt/libreqos." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for candidate in /opt/libreqos/src/deb-requirements-constraints.txt /opt/libreqos/deb-requirements-constraints.txt; do
|
||||
if [ -s "$candidate" ]; then
|
||||
CONSTRAINTS="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
python3 -m venv --clear "$VENV_DIR"
|
||||
"$VENV_DIR/bin/python" -m pip install --upgrade pip
|
||||
|
||||
if [ -s "$CONSTRAINTS" ]; then
|
||||
if [ -n "$CONSTRAINTS" ]; then
|
||||
"$VENV_DIR/bin/python" -m pip install --upgrade -c "$CONSTRAINTS" -r "$REQUIREMENTS"
|
||||
else
|
||||
"$VENV_DIR/bin/python" -m pip install --upgrade -r "$REQUIREMENTS"
|
||||
|
||||
Reference in new issue
Block a user