forked from andreknieriem/photobooth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-raspbian.sh
executable file
·148 lines (116 loc) · 4.53 KB
/
install-raspbian.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
#!/bin/bash
# Stop on the first sign of trouble
set -e
# Show all commands
# set -x
function info {
echo -e "\033[0;36m${1}\033[0m"
}
function error {
echo -e "\033[0;31m${1}\033[0m"
}
if [ $UID != 0 ]; then
error "ERROR: Only root is allowed to execute the installer. Forgot sudo?"
exit 1
fi
if [ ! -f /proc/device-tree/model ]; then
error "ERROR: This installer is only intended to run on a Raspberry Pi."
exit 2
fi
PI_MODEL=$(tr -d '\0' </proc/device-tree/model)
if [[ $PI_MODEL != Raspberry* ]]; then
error "ERROR: This installer is only intended to run on a Raspberry Pi."
exit 3
fi
echo "
@@@@@@@@@@@@@@@@@@@
@@. .@@
%@@@@@@. @@ @@@@@@@@@ @@
@@@ @@* @@. .@@
&@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@&
@@@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@
@@ @@
@@ @@@@@@@@@@@@@. *@@ @@@@@ @@
@@ @@@@ @@@@ @@
@@@@@@@@@@@@@@@@@@@@@ #@@@@@@@# @@@@@@@@@@@@@@@@@@@@@
@@ @@@ @@@@( (@@@@ @@@ @@
@@ &@@ .@@% %@@. @@& @@
@@ @@ @@ @@ @@ @@
@@ %@@ @@* /@@ @@% @@
@@ @@% @@ @@ %@@ @@
@@ *@@ @@& &@@ @@* @@
@@ @@ @@* *@@ @@ @@
@@ @@ @@@ @@@ @@ @@
@@%%%%%%%%%%%%%%%@@% @@@@@&%&@@@@@ %@@%%%%%%%%%%%%%%%@@
@@@@@@@@@@@@@@@@@@@@@@ *&@&* @@@@@@@@@@@@@@@@@@@@@@
@@ ,@@@@& &@@@@, @@
@@ (@@@@@@@@@( @@
@@ @@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
"
info "### The Photobooth installer for your Raspberry Pi."
info "### First we update your system. That's not worth mentioning."
apt update
apt dist-upgrade -y
info "### Photobooth needs some software to run."
apt install -y libapache2-mod-php php-gd gphoto2 unclutter
cd /var/www/
rm -rf html
mkdir html
echo -e "\033[0;33m### Do you like to install from git? This will take more"
read -p "### time and is recommended only for brave users. [y/N] " -n 1 -r
echo -e "\033[0m"
if [[ $REPLY =~ ^[Yy]$ ]]
then
info "### Your wish is my command!"
info "### We have to make sure that git is installed."
apt install -y git
info "### Also a packet manager is needed."
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
apt update
apt install -y yarn
info "### Now we are going to install Photobooth."
git clone https://github.com/andreknieriem/photobooth html
cd /var/www/html
LATEST_VERSION=$( git describe --tags `git rev-list --tags --max-count=1` )
info "### We ar installing version $LATEST_VERSION".
git checkout $LATEST_VERSION
git submodule update --init
info "### Get yourself a hot beverage. The following step can take up to 15 minutes."
yarn install
yarn build
else
info "### Downloading the latest build."
info "### Installing a little helper tool to determine the correct url."
apt install -y jq
info "### Downloading the latest release and extracting it."
curl -s https://api.github.com/repos/andreknieriem/photobooth/releases/latest |
jq '.assets[].browser_download_url | select(endswith(".tar.gz"))' |
xargs curl -L --output /tmp/photobooth-latest.tar.gz
tar -xzvf /tmp/photobooth-latest.tar.gz -C /var/www/html/
fi
info "### Setting permissions."
chown -R www-data:www-data /var/www/
gpasswd -a www-data plugdev
gpasswd -a www-data lp
info "### Disable camera automount"
chmod -x /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
info "### You probably like to start the browser on every start."
cat >> /etc/xdg/lxsession/LXDE-pi/autostart <<EOF
@xset s off
@xset -dpms
@xset s noblank
@chromium-browser --incognito --kiosk http://localhost/
@unclutter -idle 3
EOF
info "### Congratulations you finished the install process."
info "### Have fun with your booth, but first restart your Pi."
echo -e "\033[0;33m"
read -p "### Do you like to reboot now? [y/N] " -n 1 -r
echo -e "\033[0m"
if [[ $REPLY =~ ^[Yy]$ ]]
then
info "### Your Raspberry Pi will reboot now."
shutdown -r now
fi