mirror of
https://github.com/openwrt-xiaomi/xmir-patcher.git
synced 2026-09-22 22:57:55 +03:00
run: Fix run.sh
This commit is contained in:
@@ -2,12 +2,55 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
python3 -m venv venv
|
if [ ! -f "./xmir_base/xmir_init.py" ]; then
|
||||||
|
echo "ERROR: XMiR: Current working directory not correct!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
source ./venv/bin/activate
|
PY3_PATH=`which python3`
|
||||||
|
if [ ! -e "$PY3_PATH" ]; then
|
||||||
|
echo "ERROR: XMiR: python3 binary not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
python3 -m pip install -r requirements.txt
|
if [ ! -e "$VIRTUAL_ENV" ] || ! type deactivate &> /dev/null ; then
|
||||||
|
python3 -m venv venv
|
||||||
|
if [ ! -e "./venv/bin/activate" ]; then
|
||||||
|
echo "ERROR: XMiR: python3 venv not initialized!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
source ./venv/bin/activate
|
||||||
|
PY3_PATH=`which python3`
|
||||||
|
if [ ! -e "$PY3_PATH" ]; then
|
||||||
|
echo "ERROR: XMiR: python3 venv binary not found!"
|
||||||
|
deactivate
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ ! -e "$VIRTUAL_ENV" ] || ! type deactivate &> /dev/null ; then
|
||||||
|
echo "ERROR: XMiR: python3 venv cannot activate!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
python3 menu.py "$1"
|
SSH2_PKG=`find ./venv -type d -wholename '*/site-packages/ssh2_python*' | wc -l`
|
||||||
|
if [ "$SSH2_PKG" = "0" ]; then
|
||||||
|
# install
|
||||||
|
python3 -m pip install -r requirements.txt
|
||||||
|
# check
|
||||||
|
SSH2_PKG=`find ./venv -type d -wholename '*/site-packages/ssh2_python*' | wc -l`
|
||||||
|
if [ "$SSH2_PKG" = "0" ]; then
|
||||||
|
echo "ERROR: XMiR: python3 package 'ssh2-python' not installed!"
|
||||||
|
deactivate
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
exit 0
|
export PYTHONUNBUFFERED=TRUE
|
||||||
|
|
||||||
|
if [ "$1" = "" ]; then
|
||||||
|
python3 menu.py
|
||||||
|
else
|
||||||
|
python3 "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#deactivate
|
||||||
|
|||||||
Reference in New Issue
Block a user