From f1e1516919643b32da62c53f9913e3ebe85309d5 Mon Sep 17 00:00:00 2001 From: Kelly Date: Tue, 17 Mar 2026 16:18:46 -0700 Subject: [PATCH] Update bootstrap.sh --- bootstrap.sh | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index ad1d651..0100138 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -3,13 +3,25 @@ set -e BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" cd "$BASE_DIR" -python3 -m venv "$BASE_DIR/venv" + +if [[ ! -d "$BASE_DIR/venv" ]]; then + python3 -m venv "$BASE_DIR/venv" +fi + source "$BASE_DIR/venv/bin/activate" "$BASE_DIR/venv/bin/pip" install -r "$BASE_DIR/requirements.txt" -cp -r "$BASE_DIR/etc/data/." "$BASE_DIR/data/" -cp "$BASE_DIR/etc/config.template" "$BASE_DIR/config.ini" -replace="s|type = serial|type = tcp|g" -sed -i '' "$replace" "$BASE_DIR/config.ini" -replace="s|# hostname = meshtastic.local|hostname = localhost|g" -sed -i '' "$replace" "$BASE_DIR/config.ini" + +mkdir -p "$BASE_DIR/data" +cp -Rn "$BASE_DIR/etc/data/." "$BASE_DIR/data/" + +if [[ ! -f "$BASE_DIR/config.ini" ]]; then + cp "$BASE_DIR/etc/config.template" "$BASE_DIR/config.ini" + replace="s|type = serial|type = tcp|g" + sed -i '' "$replace" "$BASE_DIR/config.ini" + replace="s|# hostname = meshtastic.local|hostname = localhost|g" + sed -i '' "$replace" "$BASE_DIR/config.ini" +else + echo "config.ini already exists, leaving it unchanged." +fi + deactivate