Skip to content

Commit b142c1e

Browse files
committed
move launch_brickpi3_troubleshooter.sh to $HOME
1 parent 815c76c commit b142c1e

4 files changed

Lines changed: 40 additions & 36 deletions

File tree

Software/Python/brickpi3/scripts/install_trixie.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,16 @@ if [ "$INSTALL_GUI" -eq 1 ]; then
102102
# Desktop integration for Troubleshooter
103103
SRC_DIR="$SCRIPT_DIR/../troubleshooting"
104104
DESKTOP_FILE="$SRC_DIR/BrickPi3_Troubleshooter.desktop"
105-
LAUNCH_SCRIPT="$SRC_DIR/launch_troubleshooter.sh"
105+
LAUNCH_SCRIPT="$SRC_DIR/launch_brickpi3_troubleshooter.sh"
106106
DESKTOP_TARGET="$HOME/Desktop/BrickPi3_Troubleshooter.desktop"
107107

108108

109109
if [ -f "$LAUNCH_SCRIPT" ]; then
110-
echo "Copying launch_troubleshooter.sh to $HOME..."
111-
LAUNCH_SCRIPT_COPY="$HOME/launch_troubleshooter.sh"
110+
echo "Copying launch_brickpi3_troubleshooter.sh to $HOME..."
111+
LAUNCH_SCRIPT_COPY="$HOME/launch_brickpi3_troubleshooter.sh"
112112
cp "$LAUNCH_SCRIPT" "$LAUNCH_SCRIPT_COPY"
113+
# Patch the placeholder with the actual venv path used by this install
114+
sed -i "s|@@VENV_DIR@@|$VENV_DIR|" "$LAUNCH_SCRIPT_COPY"
113115
chmod +x "$LAUNCH_SCRIPT_COPY"
114116
else
115117
echo "Troubleshooter launch script not found at $LAUNCH_SCRIPT"
@@ -119,7 +121,7 @@ if [ "$INSTALL_GUI" -eq 1 ]; then
119121
echo "Copying and patching Troubleshooter desktop file to Desktop..."
120122
TMP_PATCHED_DESKTOP="/tmp/BrickPi3_Troubleshooter.desktop"
121123
cp "$DESKTOP_FILE" "$TMP_PATCHED_DESKTOP"
122-
LAUNCH_PATH="$HOME/launch_troubleshooter.sh"
124+
LAUNCH_PATH="$HOME/launch_brickpi3_troubleshooter.sh"
123125
# Escape spaces for .desktop Exec line
124126
LAUNCH_PATH_ESCAPED="${LAUNCH_PATH// /\\ }"
125127
sed -i "s|^Exec=.*$|Exec=\"$LAUNCH_PATH_ESCAPED\"|" "$TMP_PATCHED_DESKTOP"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[Desktop Entry]
22
Type=Application
33
Name=BrickPi3 Troubleshooter
4-
Exec=/bin/bash -c '"$(dirname "$(readlink -f "%k")")/launch_troubleshooter.sh"'
4+
Exec=/bin/bash -c '"$(dirname "$(readlink -f "%k")")/launch_brickpi3_troubleshooter.sh"'
55
Icon=BrickPi3.png
66
Terminal=true
77
Categories=Utility;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash
2+
# BrickPi3 Troubleshooter Launcher
3+
# This script is copied to $HOME by install_trixie.sh, which patches VENV_DIR below.
4+
5+
# Virtual environment to use — patched by install_trixie.sh at install time
6+
VENV_DIR="@@VENV_DIR@@"
7+
8+
# Activate the venv if not already active
9+
if [ -z "$VIRTUAL_ENV" ]; then
10+
if [ -d "$VENV_DIR" ]; then
11+
# shellcheck disable=SC1090
12+
source "$VENV_DIR/bin/activate"
13+
export VENV_INFO="Activated virtual environment: $VENV_DIR"
14+
echo "[INFO] $VENV_INFO"
15+
else
16+
echo "[ERROR] Virtual environment not found at $VENV_DIR"
17+
exit 1
18+
fi
19+
else
20+
export VENV_INFO="Using already-active virtual environment: $VIRTUAL_ENV"
21+
echo "[INFO] $VENV_INFO"
22+
fi
23+
24+
# Locate troubleshooter_gui.py via the installed brickpi3 package
25+
TROUBLESHOOTER_GUI="$(python3 -c "import brickpi3, os; print(os.path.join(os.path.dirname(brickpi3.__file__), 'troubleshooting', 'troubleshooter_gui.py'))")"
26+
27+
if [ ! -f "$TROUBLESHOOTER_GUI" ]; then
28+
echo "[ERROR] troubleshooter_gui.py not found via brickpi3 package (looked at: $TROUBLESHOOTER_GUI)"
29+
exit 1
30+
fi
31+
32+
echo "[INFO] Launching: $TROUBLESHOOTER_GUI"
33+
python3 "$TROUBLESHOOTER_GUI"

Software/Python/brickpi3/troubleshooting/launch_troubleshooter.sh

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)