-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_and_manage.sh
More file actions
executable file
Β·33 lines (28 loc) Β· 970 Bytes
/
build_and_manage.sh
File metadata and controls
executable file
Β·33 lines (28 loc) Β· 970 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Log everything to file
exec > >(tee -a /tmp/build_and_reboot.log) 2>&1
echo "π Starting build at $(date)"
# Check for password env var
if [ -z "$robot_pass" ]; then
echo "β 'robot_pass' environment variable not set!"
exit 1
fi
source /opt/ros/humble/setup.bash &&
source /home/hello-robot/smarthome_ws/install/setup.bash &&
source /home/hello-robot/ament_ws/install/setup.bash &&
source /usr/share/colcon_cd/function/colcon_cd.sh &&
# Run helper script
python3 /home/hello-robot/smarthome_ws/src/smart-home-robot/external/helper_scripts/file_management.py
# Go to workspace
cd /home/hello-robot/smarthome_ws || { echo "β Workspace not found!"; exit 1; }
# Build and reboot
echo "π§ Running colcon build..."
if colcon build --symlink-install; then
echo "β
Build finished successfully."
echo "π Rebooting in 5 seconds..."
sleep 5
echo "$robot_pass" | sudo -S reboot
else
echo "β Build failed. Skipping reboot."
exit 1
fi