-
Notifications
You must be signed in to change notification settings - Fork 0
/
reset.sh
executable file
·37 lines (30 loc) · 933 Bytes
/
reset.sh
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
34
35
36
37
#!/bin/bash
# Check if the script is run as root
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "Not running as root"
exit
fi
# Change directory to script directory
cd "$(dirname "$0")"
# Set PYTHONPATH
export PYTHONPATH="$(dirname "$0")"
# Check for virtual environment
if [ ! -d ".venv" ]; then
echo "Environment not initialized, please run setup.sh first"
exit
fi
# Ask for confirmation
echo "WARNING! You are about to delete all existing sensor data and video footage!"
echo "This action cannot be undone. It isn't recommended to automatically run this script."
read -p "Are you sure to continue? (y/n) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
exit
fi
# Activate the virtual environment
source .venv/bin/activate
# Run init.py for all directories that contain it (exclude template)
for init in $(find . -name "init.py" ! -path "./template/*"); do
echo "Running $init"
python3 "$init"
done