-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpartybooth_setup.sh
188 lines (165 loc) · 6.53 KB
/
partybooth_setup.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#!/bin/bash
# This script is intended to run on a RPi3 with Raspbian (Jessie) installed
# (https://www.raspberrypi.org/downloads/raspbian/)
#
# Photobooth Software: A.Dahlem, 2016 (https://twitter.com/alexdahlem)
# RPI Conversion: cmar0ck, 2017 (https://github.com/cmar0ck)
##################################################
# TODO: Fix Gallery upload #
##################################################
echo
echo "###############################"
echo "# BASIC PREPARATIONS #"
echo "###############################"
echo
read -p "Update repos + upgrade system? Continue (y/n)?" choice
case "$choice" in
y|Y ) sudo apt update && sudo apt dist-upgrade -y && sudo apt-get autoremove -y;;
n|N ) echo "cancelling...";;
* ) echo "invalid input";;
esac
echo
echo
echo "###############################"
echo "# INSTALL COMMON SOFTWARE #"
echo "###############################"
echo
echo "Installing apache2 + php5"
sudo apt install -y apache2 apache2-utils libapache2-mod-php5 php5 php-pear php5-xcache php5-curl php5-gd
echo
echo "Installing Firefox"
sudo apt install -y firefox-esr
echo
echo "Installing xdotool"
sudo apt install -y xdotool
echo
echo "Installing xbindkeys"
sudo apt install -y xbindkeys xbindkeys-config
xbindkeys --defaults > $HOME/.xbindkeysrc
echo "" | sudo tee -a ~/.xbindkeysrc
echo "Enabling shutdown on pressing 'END' key"
echo '"sudo shutdown -h now"' | sudo tee -a ~/.xbindkeysrc
echo " m:0x0 + c:115" | sudo tee -a ~/.xbindkeysrc
echo " End" | sudo tee -a ~/.xbindkeysrc
echo "@xbindkeys" | sudo tee -a ~/.config/lxsession/LXDE-pi/autostart
echo
echo "Installing Adafruit Retrogame tool (maps GPIO inputs to key presses)"
echo
echo "Make sure you have your buttons connected to the following GPIO positions (all on the RIGHT / EVENLY NUMBERED side of the header in the UPPER HALF)"
echo
echo "Take Picture (Key '1'): PIN12(GPIO18), PIN14(GND)"
echo "Shutdown Pi (Key 'END'): PIN18(GPIO24), PIN20(GND)"
echo
echo "If you want to add a reset button just solder it to the 'Run' headers on the RPi3 board (use with caution!)."
echo
echo "Note: It doesn't matter which configuration template you choose when the Retrogame installer starts, this script is going to apply the settings for you automatically."
echo
read -p "IMPORTANT: Do NOT rebooot the system directly after Retrogame installation is done! (First complete the rest of this setup script!)" key
echo
cd
curl -O https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/retrogame.sh
sudo bash retrogame.sh
echo "# Here's the pin configuration for the Partybooth project (following BCM numbering convention)" | sudo tee /boot/retrogame.cfg
echo "# (left is the key to map, right its corresponding pin number):" | sudo tee -a /boot/retrogame.cfg
echo "" | sudo tee -a /boot/retrogame.cfg
echo "END 24 # Shutdown Partybooth" | sudo tee -a /boot/retrogame.cfg
echo "1 18 # Take Photo" | sudo tee -a /boot/retrogame.cfg
echo "" | sudo tee -a /boot/retrogame.cfg
rm retrogame.sh
echo
echo "###############################"
echo "# INSTALL OPTIONAL SOFTWARE #"
echo "###############################"
echo
read -p "Install TightVNC Server? Continue (y/n)?" choice
case "$choice" in
y|Y ) sudo apt install -y tightvncserver;
vncserver;;
n|N ) echo "cancelling...";;
* ) echo "invalid input";;
esac
echo
echo
echo "###############################"
echo "# EDIT CONFIG FILES #"
echo "###############################"
echo
read -p "Enable RPi cam module hardware interface (and adjust other settings)? Continue (y/n)?" choice
case "$choice" in
y|Y ) read -p "Set '5 Interfacing options -> P1 Camera -> Enabled' in the following program" key;
sudo raspi-config;;
# Alternatively:
#echo "" | sudo tee -a /boot/config.txt;
#echo "# Enabling Cam" | sudo tee -a /boot/config.txt;
#echo "start_x=1" | sudo tee -a /boot/config.txt;
#echo "disable_camera_led=1" | sudo tee -a /boot/config.txt;;
n|N ) echo "cancelling...";;
* ) echo "invalid input";;
esac
echo
read -p "Enable custom V4L2 cam driver on boot (required to access RPi cam module in browser)? Continue (y/n)?" choice
case "$choice" in
y|Y ) echo "Adding cronjob...";
(sudo crontab -l 2>/dev/null; echo "@reboot sudo modprobe bcm2835-v4l2") | sudo crontab - ;
echo "DONE (Don't forget to reboot for the changes to take effect.)";
echo;
echo "Note: It might be useful to add a cooling fan to your RPi3 as it tends to get increasingly hot when accessing the bcm2835-v4l2 from a browser.";
echo;;
n|N ) echo "cancelling...";;
* ) echo "invalid input";;
esac
echo
read -p "Boot directly to Firefox (in fullscreen mode)? Continue (y/n)?" choice
case "$choice" in
y|Y ) touch /home/pi/ff.sh;
echo 'firefox -foreground -no-remote -new-window localhost & xdotool search --sync --onlyvisible --class "Firefox" windowactivate key F11 & xdotool search --sync --onlyvisible --class "Firefox" windowactivate key F5' | tee -a /home/pi/ff.sh;
sudo chmod a+x /home/pi/ff.sh;
echo "@sh /home/pi/ff.sh" | sudo tee -a ~/.config/lxsession/LXDE-pi/autostart;
echo;
echo "DONE (Don't forget to reboot for the changes to take effect.)";
echo;;
n|N ) echo "cancelling...";;
* ) echo "invalid input";;
esac
echo
read -p "Disable RPi warning overlays ('Power Issue' / 'Overheating' icons, etc)? Continue (y/n)?" choice
case "$choice" in
y|Y ) echo "" | sudo tee -a /boot/config.txt;
echo "# Disabling warning overlays"; | sudo tee -a /boot/config.txt;
echo "avoid_warnings=1" | sudo tee -a /boot/config.txt;
echo;
echo "DONE";;
n|N ) echo "cancelling...";;
* ) echo "invalid input";;
esac
echo
read -p "Enable USB tethering (to use mobile phone's internet connection)? Continue (y/n)?" choice
case "$choice" in
y|Y ) echo "" | sudo tee -a /etc/network/interfaces;
echo "# Enabling USB tethering" | sudo tee -a /etc/network/interfaces;
echo "allow-hotplug usb0" | sudo tee -a /etc/network/interfaces;
echo "iface usb0 inet dhcp" | sudo tee -a /etc/network/interfaces;
echo;
echo "DONE";;
n|N ) echo "cancelling...";;
* ) echo "invalid input";;
esac
echo
echo
echo "###############################"
echo "# FIREFOX SPECIFICS #"
echo "###############################"
echo
echo "Make Firefox start 'quietly' (so that it doesn't display naggy WebRTC confirmations, etc):"
echo
echo "Type 'about:config' in the address bar then set: "
echo
echo "1. 'media.navigator.permission.disabled' -> 'true'"
echo
echo "2. 'browser.sessionstore.resume_from_crash' -> 'false'"
echo
echo "3. Install this addon: https://addons.mozilla.org/en-US/firefox/addon/disable-webrtc-overlay/"
echo
echo
echo "ALL DONE!"
echo