-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathraspberrypi
More file actions
180 lines (132 loc) · 5.07 KB
/
raspberrypi
File metadata and controls
180 lines (132 loc) · 5.07 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
#!/bin/bash
log() {
if [[ $2 != "" ]]; then
printf "\n[ERRO] $1\n"
cat <<EOF
The program has stopped due to the above error
If you believe this is a bug, please report it.
If you are having issues please ask for help from Geckoboard support
Press any key to exit
EOF
# Give the user time to see this message
read
exit 127
else
printf "\n[INFO] $1\n"
fi
}
upgrade_system() {
sudo apt -qq upgrade -y
sudo apt -qq autoremove -y > /dev/null
}
install_color_emoji() {
NOTOEMOJI_ZIPFILE=noto_color_emoji.zip
FONT_STORE=$HOME/.local/share/fonts
NOTOEMOJI_DIR=noto_color_emoji
curl -o $NOTOEMOJI_ZIPFILE https://noto-website-2.storage.googleapis.com/pkgs/NotoColorEmoji-unhinted.zip
unzip $NOTOEMOJI_ZIPFILE -d $NOTOEMOJI_DIR
mkdir -p $FONT_STORE
mv $NOTOEMOJI_DIR/*.ttf $FONT_STORE/
rm -r $NOTOEMOJI_DIR || true
rm $NOTOEMOJI_ZIPFILE || true
}
check_raspberrypi() {
if ! `lsb_release -a | grep -Eq "Raspbian|Debian"`; then
log "this device appears not to be running raspbian os" 1
fi
if ! `uname -m | grep -Eq "armv|aarch64"` ; then
log "this device doesn't appear to be a raspberry pi" 1
fi
if ! [[ "$DESKTOP_SESSION" == "rpd-labwc" ]]; then
log "this device isn't running a supported desktop environment", 1
fi
}
CHROME_PWDSTORE_SWITCH=""
install_kiosk_script() {
GECKOBOARD_KIOSK_FILE=$HOME/.local/geckoboard_kiosk_mode
LABWC_CONFIG_PATH=$HOME/.config/labwc
LABWC_AUTOSTART=$LABWC_CONFIG_PATH/autostart
cat > $GECKOBOARD_KIOSK_FILE <<EOF
#!/bin/bash
# Ensure that if we have a power cut or bad shutdown that
# the chromium preferences are reset to a "good" state so we
# don't get the restore previous session dialog
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' $HOME/.config/chromium/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' $HOME/.config/chromium/Default/Preferences
# Disable any installed extentions and the default browser check and error dialogs
chromium \
$CHROME_PWDSTORE_SWITCH \
--kiosk \
--disable-extensions \
--no-default-browser-check \
https://app.geckoboard.com/tv
EOF
mkdir -p $LABWC_CONFIG_PATH
chmod +x $GECKOBOARD_KIOSK_FILE
if grep -Fxq "$GECKOBOARD_KIOSK_FILE" $LABWC_AUTOSTART; then
echo "[SKIP] kiosk mode already setup"
else
echo "$GECKOBOARD_KIOSK_FILE &" >> $LABWC_AUTOSTART
fi
}
# Display logo and intro to user
# ASCII display generated at https://www.ascii-art-generator.org/
cat <<EOF
_____ ______ _____ _ ______ ____ ____ _____ _____
/ ____| ____/ ____| |/ / __ \| _ \ / __ \ /\ | __ \| __ \
| | __| |__ | | ' / | | | |_| | | | | / \ | |__| | | | |
| | |_ | __| | | < | | | _ <| | | |/ /\ \ | _ /| | | |
| |__| | |___ |____| ' \ |__| | |_| | |__| / ____ \| | \ \| |__| |
\_____|______\_____|_|\_\____/|____/ \____/_/ \_\_| \_\_____/
We will guide you through setting up your device optimized to display Geckoboard.
Along the way you will have the option to not do some things for which you can just press enter
The questions which will be asked will be just require either y for Yes or n for No
by default the answer will assume No (y/N) declared by the capital N in these cases you can just press enter
We will do the following;
- Upgrade your raspbian OS with the latest updates
- Ensure Chromium is installed and the latest version available
- Install color emoji support
- Install Microsoft core fonts
- Install a script which will start chromium at Geckoboard on each startup
This process should only take a few minutes
If you are ready press any key to start
EOF
read
check_raspberrypi
log "getting latest packages"
sudo apt update -y
printf "do you want to install latest updates (it might take 10+ mins) [y/N]:"
read upgr
if [[ $upgr == "y" ]]; then
log "updating os packages"
upgrade_system
fi
log "installing latest chromium browser"
sudo apt install -y chromium > /dev/null
log "installing mscore fonts"
sudo apt install -y ttf-mscorefonts-installer > /dev/null
log "installing color emoji support"
install_color_emoji > /dev/null
log "setting up Geckoboard kiosk mode"
printf "\nTo prevent default keyring requesting password input when opening Chrome\n"
printf "We're going to instruct Chrome to store passwords unencrypted in its own store\n"
printf "This would be the same as setting no password in your keyring\n"
printf "If you intend to store the passwords in Chrome for websites\n"
printf "It would be highly recommended not to use the unencrypted password store\n\n"
printf "Do you want to use unencrypted password store for Chrome? [y/N]:"
read disableKeyring
if [[ "$disableKeyring" == "y" ]]; then
CHROME_PWDSTORE_SWITCH="--password-store=basic"
fi
install_kiosk_script
cat <<EOF
************ Setup complete ***********
Check out the send to TV support article on how to pair your device with Geckoboard
Now you are ready to reboot the raspberry pi.
When raspberry pi next starts up it should display the TV pin code
http://bit.ly/gbontvdoc
You'll be empowering your team to be the best in no time
When you are ready press any key to reboot.
EOF
read
sudo reboot