-
Notifications
You must be signed in to change notification settings - Fork 22
/
pigeon_modules_init.sh
executable file
·37 lines (30 loc) · 937 Bytes
/
pigeon_modules_init.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
#!/usr/bin/env bash
# This will run module-specific routines
# Receives the type of argument to run (ex: install, on_movie_end or on_picture_save).
echo "Starting Modules Script"
camera_name=pigeon
conf_file=/home/pi/pigeon/modules_enabled.conf
for d in /home/pi/pigeon/modules/*/ ; do
if [[ $1 == 'install' ]]
then
echo -n "Do you want install $d ? [y/N]"
read install
if [[ $install == "y" ]] || [[ $install == "Y" ]] || [[ $intall == "Yes" ]] || [[ $install == "yes" ]]
then
sudo chmod +x $d$1'.sh'
sudo $d$1'.sh'
echo $d >> $conf_file
fi
elif [[ $1 == "on_movie_end" ]] || [[ $1 == "on_picture_save" ]]
then
if grep -Fxq "$d" $conf_file
then
sudo chmod +x $d$1'.sh'
sudo $d$1'.sh' $2 $camera_name
echo "Finished $1 routine for $d"
fi
else
echo "$1 is not a recognized command"
fi
done
echo "Ended Modules Script"