From ae3c4350b5739ccd39aa9309ea9219362a07728b Mon Sep 17 00:00:00 2001 From: Tanvir Date: Fri, 24 Nov 2023 01:14:38 +0600 Subject: [PATCH 1/2] Refactor start-venv.sh --- start-venv.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/start-venv.sh b/start-venv.sh index 33ac3216..1fd3a9af 100755 --- a/start-venv.sh +++ b/start-venv.sh @@ -1,8 +1,11 @@ -#! /usr/bin/env bash +#!/usr/bin/env bash -if [ ! -f venv/bin/activate ] ; then +VENVPATH="venv/bin/activate" + +if [ ! -f "$VENVPATH" ]; then python3 -m venv venv fi -source venv/bin/activate + +source "$VENVPATH" python3 -m pip install -r requirements.txt -python3 zeronet.py $1 $2 $3 $4 $5 $6 $7 $8 $9 +python3 zeronet.py "$@" From b89cd79d6a49acb47357cd3a610b7ca70b4e7b3a Mon Sep 17 00:00:00 2001 From: Tanvir Date: Fri, 24 Nov 2023 01:18:03 +0600 Subject: [PATCH 2/2] Refactor termux.sh --- termux.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/termux.sh b/termux.sh index 1eb365b1..c73eade8 100644 --- a/termux.sh +++ b/termux.sh @@ -1,12 +1,13 @@ - +#!/usr/bin/env bash # Script for running zeronet-conservancy in Termux on Android -if [[ -d zeronet-conservancy ]]; then - cd zeronet-conservancy - git pull --ff-only +REPO_DIR="zeronet-conservancy" +VENV_SCRIPT="start-venv.sh" + +if [[ -d "$REPO_DIR" ]]; then + (cd "$REPO_DIR" && git pull --ff-only) else - git clone https://github.com/zeronet-conservancy/zeronet-conservancy - cd zeronet-conservancy + git clone https://github.com/zeronet-conservancy/zeronet-conservancy "$REPO_DIR" fi pkg update -y @@ -16,5 +17,4 @@ echo "Starting tor..." tor --ControlPort 9051 --CookieAuthentication 1 >/dev/null & echo "Starting zeronet-conservancy..." -./start-venv.sh -cd .. +(cd "$REPO_DIR" && ./"$VENV_SCRIPT")