BashRC Install Script Fixes

This commit is contained in:
2026-01-10 21:56:17 +00:00
parent 8dfc7c2241
commit 89cc3f403c
2 changed files with 8 additions and 63 deletions

View File

@@ -56,7 +56,7 @@ for arg in "$@"; do
echo " - ~/ardupilot_gazebo (ArduPilot Gazebo plugin)"
echo " - Project venv/ directory"
echo " - Project activate.sh"
echo " - ArduPilot configuration from ~/.bashrc"
echo " - ~/.ardupilot_env (ArduPilot environment file)"
echo ""
echo "What is NOT removed:"
echo " - ROS 2 (use: sudo apt remove 'ros-*')"
@@ -139,30 +139,7 @@ remove_activate() {
fi
}
# =============================================================================
# REMOVE BASHRC CONFIGURATION
# =============================================================================
remove_bashrc_config() {
BASHRC_MARKER="# === RDC Simulation ArduPilot ==="
OLD_MARKER="# === ArduPilot SITL ==="
if grep -q "$BASHRC_MARKER" ~/.bashrc 2>/dev/null || grep -q "$OLD_MARKER" ~/.bashrc 2>/dev/null; then
echo "[INFO] Removing ArduPilot configuration from ~/.bashrc"
# Create backup
cp ~/.bashrc ~/.bashrc.backup.$(date +%Y%m%d_%H%M%S)
# Remove the configuration block (everything from marker to next blank line or EOF)
# This handles both old and new markers
sed -i "/$BASHRC_MARKER/,/^$/d" ~/.bashrc 2>/dev/null || true
sed -i "/$OLD_MARKER/,/^$/d" ~/.bashrc 2>/dev/null || true
echo "[OK] ArduPilot configuration removed from ~/.bashrc"
echo "[INFO] Backup saved to ~/.bashrc.backup.*"
else
echo "[SKIP] No ArduPilot configuration found in ~/.bashrc"
fi
}
# =============================================================================
# REMOVE ARDUPILOT ENV FILE
@@ -188,7 +165,6 @@ if [ "$REMOVE_ALL" = true ]; then
remove_ardupilot_gazebo
remove_venv
remove_activate
remove_bashrc_config
remove_ardupilot_env
elif [ "$REMOVE_ARDUPILOT" = true ]; then
@@ -196,7 +172,6 @@ elif [ "$REMOVE_ARDUPILOT" = true ]; then
echo ""
remove_ardupilot
remove_ardupilot_gazebo
remove_bashrc_config
remove_ardupilot_env
else
@@ -231,8 +206,7 @@ else
remove_activate
fi
if ask_yes_no "Remove ArduPilot configuration from ~/.bashrc?"; then
remove_bashrc_config
if ask_yes_no "Remove ArduPilot environment file (~/.ardupilot_env)?"; then
remove_ardupilot_env
fi
fi