-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreadme
More file actions
259 lines (234 loc) · 8.92 KB
/
readme
File metadata and controls
259 lines (234 loc) · 8.92 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
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
Signage software
This software allows displaying information on raspberrypi powered screens
the raspberrypi runs chromium full screen and connects to the server
below a dump of our internal wiki with installation docs (in french, sorry)
Installation de la plateforme d'écrans afficheurs
installation du serveur
installation de paquets
aptitude install vim-nox sudo screen mtr
aptitude install ntp
modifier /etc/ntp.conf pour utiliser le serveur de l'ujf ntp.ujf-grenoble.fr
installation des services
postgresql
apache2
php5
aptitude install postgresql
aptitude install apache2
aptitude install libapache2-mod-php5
aptitude install php5-gd php5-imagick php5-ldap php5-pgsql php5-curl
configuration des mises à jour automatiques
TODO
installation des sources de l'appli
# aptitude install git
# cd /var/www
# rm -rf *
# git clone [clone from github] .
initialisation de la base de données
# su - postgres
postgres@ecrans$ cd /var/www/sql
postgres@ecrans$ createdb signage
postgres@ecrans$ psql signage
signage=# \i signage.sql
signage=# \q
postgres@ecrans$ exit
création du répertoire de cache des images
root@ecrans:/var/www# mkdir cache
root@ecrans:/var/www# chown www-data:www-data cache
ajout des programmes à exécuter pour la maintenance journalière dans /etc/crontab
# update apod
10 0 * * * www-data cd /var/www/lib/feeds && TERM=cron php apod.php
installation de youtube-dl (pour telecharger les videos youtube)
<verbatpython-setuptoolsim> aptitude install python-setuptools python-pip git clone https://github.com/rg3/youtube-dl.git
installation du client
Installation du linux pour RaspberryPi?
La distribution utilisée s'appelle Raspbian
http://elinux.org/RaspberryPiBoard
Procedure d'installation
Installation de l'image raspberrypi
-> installer raspbian, avec les options minimales (serveur ssh / outils systemes)
http://www.raspbian.org/RaspbianInstaller
mirror : ftp.igh.cnrs.fr
directory : /pub/os/linux/raspbian/raspbian
le partitionnement est automatique
Durant l'installation, il est demandé plusieurs fois si on est sur de pas vouloir installer de noyau. répondre oui, c'est tout a fait normal, le noyau se trouve ailleurs. il n'y a pas non plus de boot loader.
Fichier de configuration pour la video
dans le fichier /boot/config/txt
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16
# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720
# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1
# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1
# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2
# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4
# uncomment for composite PAL
sdtv_mode=2
#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800
# for more options see http://elinux.org/RPi_config.txt
installation d'outils standard
aptitude install vim-nox mtr htop
à partir de là, on peut se connecter en ssh a la raspberry pi, c'est plus pratique
supprimer le fichier =/lib/udev/rules.d/75-persistent-net-generator.rules=
supprimer le fichier =/etc/udev/rules.d/70-persistent-net.rules
ajouter un fichier /etc/dhcp/dhclient-exit-hooks.d/hostname
#!/bin/sh
# Filename: /etc/dhcp3/dhclient-exit-hooks.d/hostname
# Purpose: Used by dhclient-script to set the hostname of the system
# to match the DNS information for the host as provided by
# DHCP.
# Depends: dhcp3-client (should be in the base install)
# hostname (for hostname, again, should be in the base)
# bind9-host (for host)
# coreutils (for cut and echo)
#
if [ "$reason" != BOUND ] && [ "$reason" != RENEW ] \
&& [ "$reason" != REBIND ] && [ "$reason" != REBOOT ]
then
return
fi
echo dhclient-exit-hooks.d/hostname: Dynamic IP address = $new_ip_address
hostname=$(host $new_ip_address | cut -d ' ' -f 5 | cut -d '.' -f 1)
echo $hostname > /etc/hostname
hostname $hostname
echo dhclient-exit-hooks.d/hostname: Dynamic Hostname = $hostname
# And that _should_ just about do it...
qui permets de récupérer automatiquement le bon nom de machine dans le hostname
installation d'une couche graphique basique
aptitude install xinit mesa-utils libosmesa6
aptitude install dbus dbus-x11
configurer X pour que tout le monde puisse l'utiliser
dpkg-reconfigure x11-common
sélectionner l'option anybody
upgrades automatiques
aptitude install unattended-upgrades
créer un fichier /etc/apt/apt.conf.d/02periodic contenant
APT::Periodic::Enable "1";
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::AutocleanInterval "5";
APT::Periodic::Unattended-Upgrade "1";
dans /etc/apt/apt.conf.d/50unattended-upgrades changer
// l'installation se fait au reboot de 6h
Unattended-Upgrade::InstallOnShutdown "true";
// toujours envoyer un mail
Unattended-Upgrade::Mail "root";
// étant donné qu'on reboot a 6h du matin...
Unattended-Upgrade::Automatic-Reboot "false";
Installation de chromium
l'application est basée sur un navigateur web (dans le cas précis, chromium)
# aptitude install chromium
ceci va installer toutes les dépendances nécessaires pour chromium, y compris X-Window
Installation d'unclutter
Unclutter est un outil permettant de cacher la souris quand elle ne sert pas
# aptitude install unclutter
installation du player multimedia
aptitude install fonts-freefont-ttf
omxplayer_0.2.5~git20130326~5b369233_armhf.deb
Configuration
/etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
setterm -blank 0 -powersave off -powerdown 0
su - sign /home/sign/init.sh &
exit 0
Utilisateur spécifique
pour raisons de sécurité, l'affichage est réalisé sous le compte d'un utilisateur non privilégié sign
adduser sign
mot de passe généré aléatoirement xxxxxxxxx (normalement n'a pas d'utilité)
/etc/crontab
reboot automatique a 6 heures du matin, les navigateurs ont quelques problemes de gestion de mémoire...
note: les autres scripts sont lancés a partir de 5hxx du matin, ca permets entre autres d'avoir téléchargé les mises a jour juste avant le reboot
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 5 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 5 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 5 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
00 6 * * * root /sbin/reboot
00 22 * * * sign DISPLAY=:0.0 /usr/bin/xset dpms force off
Fichiers de configuration
/home/sign/init.sh
#!/bin/bash
/usr/bin/xinit -- /usr/bin/X -s 0 -dpms &
puis
# chown sign:sign init.sh
# chmod u+x init.sh
/home/sign/.xinitrc
#!/bin/bash
export DISPLAY=:0.0
LOG=/home/sign/logs
URL="http://ecrans.obs.ujf-grenoble.fr/screen/"
LOGGER=/usr/bin/logger
SLEEP=/bin/sleep
SETTERM=/usr/bin/setterm
XSET=/usr/bin/xset
CHROMIUM=/usr/bin/chromium
USER_DIR="--user-data-dir=/home/sign/chrome"
DEBUG="--remote-debugging-port=9222"
WINDOW="--window-size=1920,1080 --window-position=0,0"
OPTIONS="--disable-webgl"
UNCLUTTER=/usr/bin/unclutter
${LOGGER} "starting chromium"
${LOGGER} "setting X to not turn off"
${XSET} s 0 >> ${LOG} 2>&1
${XSET} s noblank >> ${LOG} 2>&1
${XSET} dpms force on >> ${LOG} 2>&1
${LOGGER} "starting unclutter"
${UNCLUTTER} >> ${LOG} 2>&1 &
#
# run chrome in a loop (for when it gets killed by OOMK
#
while true; do
echo "================================================================" >> ${LOG}
date >> ${LOG}
rm -rf /home/sign/.config/chromium/Singleton*
${CHROMIUM} ${DEBUG} ${WINDOW} ${OPTIONS} --app="${URL}" >> ${LOG} 2>&1
echo "" >> ${LOG}
echo ">>>>> CRASH DETECTED <<<<<" >> ${LOG}
done
puis
# chown sign:sign .xinitrc
on peut rebooter la raspberry pi avec
# reboot