-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall_script.sh
More file actions
executable file
·98 lines (91 loc) · 2.83 KB
/
install_script.sh
File metadata and controls
executable file
·98 lines (91 loc) · 2.83 KB
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
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
#upgrade system
apt-get update
apt-get install -y gunicorn3 redis-server libcups2-dev apache2 php libapache2-mod-php python-cups cups git vim pypy3 pypy3-dev libsdl1.2-dev libsdl-mixer1.2-dev libsdl-image1.2-dev libsdl-ttf2.0-dev libportmidi-dev python3-dev
apt-get remove -y python3-pygame python3-pil
apt autoremove -y
sudo -u pi wget https://bootstrap.pypa.io/get-pip.py
sudo -u pi pypy3 get-pip.py --user
sudo -u pi python3 get-pip.py --user
rm -f get-pip.py
chown root.gpio /dev/gpiomem
chmod g+rw /dev/gpiomem
#install software
cd /home/pi/
sudo -u pi git clone --depth=1 https://github.com/pierrehpezier/photobooth
sudo -u pi pypy3 -m pip incordova.plugin.http.setHeader('www.example.com', 'Header', 'Value');stall -r photobooth/src/requirements.txt --user
sudo -u pi python3 -m pip install -r photobooth/src/requirements.txt --user
sudo -u pi pypy3 -m pip install -r photobooth/server/requirements.txt --user
sudo -u pi python3 -m pip install -r photobooth/server/requirements.txt --user
git clone --depth=1 https://github.com/mikelothar/show-all-images-in-a-folder-with-php.git
cp -r show-all-images-in-a-folder-with-php/* /var/www/html/
chown -R www-data:www-data /var/www/html
chown -R pi:pi /var/www/html/img
rm -fr /var/www/html/img/* show-all-images-in-a-folder-with-php
systemctl enable apache2
systemctl start apache2
#update printer
sudo systemctl enable cups
sudo systemctl start cups
sudo adduser pi lpadmin
#enable picamera
grep start_x /boot/config.txt >/dev/null
if [ $? -ne 0 ]
then
echo start_x=1 >> /boot/config.txt
else
sed -i -e 's/^start_x=0/start_x=1/' /boot/config.txt
fi
grep gpu_mem /boot/config.txt >/dev/null
if [ $? -ne 0 ]
then
echo gpu_mem=128>> /boot/config.txt
else
sed -i -e 's/^gpu_mem=64/gpu_mem=128/' /boot/config.txt
fi
#start photomaton at reboot
cat << EOF > /lib/systemd/system/photobooth.service
[Service]
Type=simple
ExecStart=/home/pi/photobooth/src/photomaton
User=pi
Restart=on-failure
TimeoutStopSec=3
SuccessExitStatus=0
[Install]
WantedBy=multi-user.target
EOF
cat << EOF > /lib/systemd/system/redis.service
[Service]
Type=simple
ExecStart=/usr/bin/redis-server
User=pi
Restart=on-failure
TimeoutStopSec=3
SuccessExitStatus=0
[Install]
WantedBy=multi-user.target
EOF
cat << EOF > /lib/systemd/system/adminserver.service
[Service]
Type=simple
ExecStart=gunicorn3 server --certfile /home/pi/photobooth/pki/issued/cert.pem --keyfile /home/pi/photobooth/pki/issued/key.pem --bind 0.0.0.0:8000 --pythonpath /home/pi/photobooth/server/
User=pi
Restart=on-failure
TimeoutStopSec=3
SuccessExitStatus=0
[Install]
WantedBy=multi-user.target
EOF
systemctl enable photobooth
systemctl enable redis
systemctl enable adminserver
#enable printer
adduser pi lpadmin
systemctl enable cups
systemctl start cups
echo 'Install the printer!! see http://localhost:631/'