Skip to content

Commit dfb9e93

Browse files
Cleanup installation messages (#2109)
* cleanup installation messages use clear for each new option added headers use correct urls in finish message fixed some typos and wording * fix usage with multiple ip addresses (ipv4/ipv6) use single call to get all information during installation show and read out only first ip in webui * fix typo in translation * fix order for gateway / interface * harmonize read answer option * fix FIN_MESSAGE * fix line break on OS check
1 parent babb237 commit dfb9e93

File tree

9 files changed

+125
-81
lines changed

9 files changed

+125
-81
lines changed

installation/includes/02_helpers.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ check_os_type() {
4545
local os_type
4646
os_type=$(uname -m)
4747

48-
echo "Checking OS type ... $os_type" | tee /dev/fd/3
48+
echo -e "\nChecking OS type '$os_type'" | tee /dev/fd/3
4949

5050
if [[ $os_type == "armv7l" || $os_type == "armv6l" ]]; then
5151
echo -e " ... OK!\n" | tee /dev/fd/3

installation/includes/03_welcome.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,18 @@ Depending on your hardware, this installation might last
1919
around 60 minutes (usually it's faster). It updates OS
2020
packages, installs Phoniebox dependencies and registers
2121
settings. Be patient and don't let your computer go to
22-
sleep. It might disconnect your SSH connection causing the
23-
interruption of the installation process.
22+
sleep. It might disconnect your SSH connection causing
23+
the interruption of the installation process.
24+
Consider starting the installation in a terminal
25+
multiplexer like 'screen' or 'tmux' to avoid this.
2426
2527
By the way, you can follow the installation details here
2628
in a separate SSH session:
2729
cd; tail -f ${INSTALLATION_LOGFILE}
2830
29-
Let's set up your Phoniebox now?! [Y/n]" 1>&3
30-
31-
read -rp "Do you want to install? [Y/n] " response
31+
Let's set up your Phoniebox.
32+
Do you want to start the installation? [Y/n]" 1>&3
33+
read -r response
3234
case "$response" in
3335
[nN][oO]|[nN])
3436
exit

installation/includes/05_finish.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env bash
22

33
finish() {
4-
echo -e "
5-
---
4+
local local_hostname=$(hostname)
5+
echo -e "####################### FINISHED ########################
66
77
Installation complete!
88
@@ -11,14 +11,13 @@ ${FIN_MESSAGE}
1111
In order to start, you need to reboot your Raspberry Pi.
1212
Your SSH connection will disconnect.
1313
14-
After the reboot, open either http://raspberrypi.local
15-
(for Mac / iOS) or http://[IP-ADDRESS] (for Android / Windows)
16-
in a browser to get started. Don't forget to upload files
17-
via Samba.
14+
After the reboot, you can access the WebApp in your browser at
15+
http://${local_hostname}.local or http://${CURRENT_IP_ADDRESS}
16+
Don't forget to upload files.
1817
1918
Do you want to reboot now? [Y/n]" 1>&3
2019

21-
read -rp "Do you want to reboot now? [Y/n] " response
20+
read -r response
2221
case "$response" in
2322
[nN][oO]|[nN])
2423
echo "Reboot aborted" | tee /dev/fd/3
@@ -41,14 +40,14 @@ Do you want to reboot now? [Y/n]" 1>&3
4140
exit_on_error () {
4241

4342
echo -e "\n****************************************" | tee /dev/fd/3
44-
echo -e "ERROR OCCURRED!
43+
echo "ERROR OCCURRED!
4544
A non-recoverable error occurred.
4645
Check install log for details:" | tee /dev/fd/3
4746
echo "$INSTALLATION_LOGFILE" | tee /dev/fd/3
48-
echo -e "****************************************" | tee /dev/fd/3
47+
echo "****************************************" | tee /dev/fd/3
4948
if [[ -n $1 ]]; then
5049
echo "$1" | tee /dev/fd/3
51-
echo -e "****************************************" | tee /dev/fd/3
50+
echo "****************************************" | tee /dev/fd/3
5251
fi
5352
echo "Abort!"
5453
exit 1

installation/routines/customize_options.sh

Lines changed: 95 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,21 @@
22

33
_option_static_ip() {
44
# ENABLE_STATIC_IP
5-
CURRENT_IP_ADDRESS=$(hostname -I)
6-
echo "Would you like to set a static IP (will be ${CURRENT_IP_ADDRESS})?
7-
It'll save a lot of start up time. This can be changed later.
8-
[Y/n] " 1>&3
5+
# Using the dynamically assigned IP address as it is the best guess to be free
6+
# Reference: https://unix.stackexchange.com/a/505385
7+
CURRENT_ROUTE=$(ip route get 8.8.8.8)
8+
CURRENT_GATEWAY=$(echo "${CURRENT_ROUTE}" | awk '{ print $3; exit }')
9+
CURRENT_INTERFACE=$(echo "${CURRENT_ROUTE}" | awk '{ print $5; exit }')
10+
CURRENT_IP_ADDRESS=$(echo "${CURRENT_ROUTE}" | awk '{ print $7; exit }')
11+
clear 1>&3
12+
echo "----------------------- STATIC IP -----------------------
13+
14+
Setting a static IP will save a lot of start up time.
15+
The static adress will be '${CURRENT_IP_ADDRESS}'
16+
from interface '${CURRENT_INTERFACE}'
17+
with the gateway '${CURRENT_GATEWAY}'.
18+
19+
Set a static IP? [Y/n]" 1>&3
920
read -r response
1021
case "$response" in
1122
[nN][oO]|[nN])
@@ -19,7 +30,13 @@ It'll save a lot of start up time. This can be changed later.
1930

2031
_option_ipv6() {
2132
# DISABLE_IPv6
22-
echo "Do you want to disable IPv6? [Y/n] " 1>&3
33+
clear 1>&3
34+
echo "------------------------- IP V6 -------------------------
35+
36+
IPv6 is only needed if you intend to use it.
37+
Otherwise it can be disabled.
38+
39+
Do you want to disable IPv6? [Y/n]" 1>&3
2340
read -r response
2441
case "$response" in
2542
[nN][oO]|[nN])
@@ -33,14 +50,17 @@ _option_ipv6() {
3350

3451
_option_autohotspot() {
3552
# ENABLE_AUTOHOTSPOT
36-
echo "Do you want to enable a WiFi hotspot on demand?
53+
clear 1>&3
54+
echo "---------------------- AUTOHOTSPOT ----------------------
55+
3756
When enabled, this service spins up a WiFi hotspot
3857
when the Phoniebox is unable to connect to a known
3958
WiFi. This way you can still access it.
40-
[y/N] " 1>&3
59+
60+
Do you want to enable an Autohotpot? [y/N]" 1>&3
4161
read -r response
4262
case "$response" in
43-
[yY])
63+
[yY][eE][sS]|[yY])
4464
ENABLE_AUTOHOTSPOT=true
4565
;;
4666
*)
@@ -51,7 +71,7 @@ WiFi. This way you can still access it.
5171
echo "Do you want to set a custom Password? (default: ${AUTOHOTSPOT_PASSWORD}) [y/N] " 1>&3
5272
read -r response_pw_q
5373
case "$response_pw_q" in
54-
[yY])
74+
[yY][eE][sS]|[yY])
5575
while [ $(echo ${response_pw}|wc -m) -lt 8 ]
5676
do
5777
echo "Please type the new password (at least 8 character)." 1>&3
@@ -80,9 +100,13 @@ WiFi. This way you can still access it.
80100

81101
_option_bluetooth() {
82102
# DISABLE_BLUETOOTH
83-
echo "Do you want to disable Bluetooth?
84-
Turn off Bluetooth if you do not plan to use it. It saves energy and start up time.
85-
[Y/n] " 1>&3
103+
clear 1>&3
104+
echo "----------------------- BLUETOOTH -----------------------
105+
106+
Turning off Bluetooth will save energy and
107+
start up time, if you do not plan to use it.
108+
109+
Do you want to disable Bluetooth? [Y/n]" 1>&3
86110
read -r response
87111
case "$response" in
88112
[nN][oO]|[nN])
@@ -96,10 +120,15 @@ Turn off Bluetooth if you do not plan to use it. It saves energy and start up ti
96120

97121
_option_samba() {
98122
# ENABLE_SAMBA
99-
echo "Samba will be installed. It is required to conveniently copy files to
100-
your Phoniebox via a network share. If you don't need it, feel free to skip
101-
the installation. If you are unsure, stick to YES!
102-
[Y/n] " 1>&3
123+
clear 1>&3
124+
echo "------------------------- SAMBA -------------------------
125+
126+
Samba is required to conveniently copy files
127+
to your Phoniebox via a network share.
128+
If you don't need it, feel free to skip the installation.
129+
If you are unsure, stick to YES!
130+
131+
Do you want to install Samba? [Y/n]" 1>&3
103132
read -r response
104133
case "$response" in
105134
[nN][oO]|[nN])
@@ -114,10 +143,13 @@ the installation. If you are unsure, stick to YES!
114143

115144
_option_webapp() {
116145
# ENABLE_WEBAPP
117-
echo "Would you like to install the web application?
118-
This is only required if you want to use a graphical interface
119-
to manage your Phoniebox!
120-
[Y/n] " 1>&3
146+
clear 1>&3
147+
echo "------------------------ WEBAPP -------------------------
148+
149+
This is only required if you want to use
150+
a graphical interface to manage your Phoniebox!
151+
152+
Would you like to install the web application? [Y/n]" 1>&3
121153
read -r response
122154
case "$response" in
123155
[nN][oO]|[nN])
@@ -132,14 +164,18 @@ to manage your Phoniebox!
132164

133165
_option_kiosk_mode() {
134166
# ENABLE_KIOSK_MODE
135-
echo "Would you like to enable the Kiosk Mode?
136-
If you have a screen attached to your RPi, this will launch the
137-
web application right after boot. It will only install the necessary
138-
xserver dependencies and not the entire RPi desktop environment.
139-
[y/N] " 1>&3
167+
clear 1>&3
168+
echo "----------------------- KIOSK MODE ----------------------
169+
170+
If you have a screen attached to your RPi,
171+
this will launch the web application right after boot.
172+
It will only install the necessary xserver dependencies
173+
and not the entire RPi desktop environment.
174+
175+
Would you like to enable the Kiosk Mode? [y/N]" 1>&3
140176
read -r response
141177
case "$response" in
142-
[yY])
178+
[yY][eE][sS]|[yY])
143179
ENABLE_KIOSK_MODE=true
144180
;;
145181
*)
@@ -150,12 +186,16 @@ xserver dependencies and not the entire RPi desktop environment.
150186

151187
_options_update_raspi_os() {
152188
# UPDATE_RASPI_OS
153-
echo "Would you like to update the operating system?
154-
This shall be done eventually, but increases the installation time a lot.
155-
[Y/n] " 1>&3
189+
clear 1>&3
190+
echo "----------------------- UPDATE OS -----------------------
191+
192+
This shall be done eventually,
193+
but increases the installation time a lot.
194+
195+
Would you like to update the operating system? [Y/n]" 1>&3
156196
read -r response
157197
case "$response" in
158-
[nN])
198+
[nN][oO]|[nN])
159199
UPDATE_RASPI_OS=false
160200
;;
161201
*)
@@ -167,18 +207,25 @@ This shall be done eventually, but increases the installation time a lot.
167207
_option_disable_onboard_audio() {
168208
# Disable BCM on-chip audio (typically Headphones)
169209
# not needed when external sound card is sued
210+
clear 1>&3
211+
echo "--------------------- ON-CHIP AUDIO ---------------------
212+
213+
If you are using an external sound card (e.g. USB,
214+
HifiBerry, PirateAudio, etc), we recommend to disable
215+
the on-chip audio. It will make the ALSA sound
216+
configuration easier.
217+
If you are planning to only use Bluetooth speakers,
218+
leave the on-chip audio enabled!
219+
(This will touch your boot configuration in
220+
${RPI_BOOT_CONFIG_FILE}.
221+
We will do our best not to mess anything up. However,
222+
a backup copy will be written to
223+
${DISABLE_ONBOARD_AUDIO_BACKUP} )
170224
171-
echo -e "Disable Pi's on-chip audio (headphone / jack output)?
172-
If you are using an external sound card (e.g. USB, HifiBerry, PirateAudio, etc),
173-
we recommend to disable the on-chip audio. It will make the ALSA sound configuration easier.
174-
If you are planning to only use Bluetooth speakers, leave the on-chip audio enabled!
175-
(This will touch your boot configuration in ${RPI_BOOT_CONFIG_FILE}.
176-
We will do our best not to mess anything up. However, a backup copy will be written to
177-
${DISABLE_ONBOARD_AUDIO_BACKUP} if things go pear-shaped.)
178-
[y/N] " 1>&3
225+
Disable Pi's on-chip audio (headphone / jack output)? [y/N]" 1>&3
179226
read -r response
180227
case "$response" in
181-
[yY])
228+
[yY][eE][sS]|[yY])
182229
DISABLE_ONBOARD_AUDIO=true
183230
;;
184231
*)
@@ -196,36 +243,37 @@ _option_webapp_devel_build() {
196243
if [[ "$ENABLE_WEBAPP_PROD_DOWNLOAD" = "release-only" ]]; then
197244
ENABLE_WEBAPP_PROD_DOWNLOAD=false
198245
fi
199-
200246
if [[ "$ENABLE_WEBAPP_PROD_DOWNLOAD" = false ]]; then
201-
echo -e "Your are installing from a non-release branch.
247+
clear 1>&3
248+
echo "--------------------- WEBAPP NODE ---------------------
249+
250+
You are installing from a non-release branch.
202251
This means, you will need to build the web app locally.
203252
For that you'll need Node.
204-
Do you want to install Node? [Y/n] " 1>&3
253+
254+
Do you want to install Node? [Y/n]" 1>&3
205255
read -r response
206256
case "$response" in
207-
[nN])
257+
[nN][oO]|[nN])
208258
ENABLE_INSTALL_NODE=false
209259
;;
210260
*)
211261
;;
212262
esac
213-
214263
# This message will be displayed at the end of the installation process
215-
FIN_MESSAGE="$FIN_MESSAGE\n\nATTENTION: You need to build the web app locally with
264+
FIN_MESSAGE="$FIN_MESSAGE\nATTENTION: You need to build the web app locally with
216265
$ cd ~/RPi-Jukebox-RFID/src/webapp && ./run_rebuild.sh -u
217266
This must be done after reboot, due to memory restrictions.
218267
Read the documentation regarding local Web App builds!"
219-
ENABLE_WEBAPP_PROD_DOWNLOAD=false
220268
fi
221269
fi
222270
}
223271

224272
customize_options() {
225273
echo "Customize Options starts"
226274

227-
_option_static_ip
228275
_option_ipv6
276+
_option_static_ip
229277
_option_autohotspot
230278
_option_bluetooth
231279
_option_disable_onboard_audio

installation/routines/install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
install() {
22
check_os_type
3+
clear 1>&3
34
customize_options
45
clear 1>&3
56
set_raspi_config

installation/routines/optimize_boot_time.sh

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,17 @@ _optimize_handle_network_connection() {
4040
echo " Skipping. Already set up!" | tee /dev/fd/3
4141
else
4242
# DHCP has not been configured
43-
# Reference: https://unix.stackexchange.com/a/307790/478030
44-
INTERFACE=$(route | grep '^default' | grep -o '[^ ]*$')
45-
46-
# Reference: https://serverfault.com/a/31179/431930
47-
GATEWAY=$(route -n | grep 'UG[ \t]' | awk '{print $2}')
48-
49-
# Using the dynamically assigned IP address as it is the best guess to be free
50-
# Reference: https://unix.stackexchange.com/a/48254/478030
51-
CURRENT_IP_ADDRESS=$(hostname -I)
52-
echo " * ${INTERFACE} is the default network interface" | tee /dev/fd/3
53-
echo " * ${GATEWAY} is the Router Gateway address" | tee /dev/fd/3
43+
echo " * ${CURRENT_INTERFACE} is the default network interface" | tee /dev/fd/3
44+
echo " * ${CURRENT_GATEWAY} is the Router Gateway address" | tee /dev/fd/3
5445
echo " * Using ${CURRENT_IP_ADDRESS} as the static IP for now" | tee /dev/fd/3
5546

5647
sudo tee -a $DHCP_CONF <<-EOF
5748
5849
## Jukebox DHCP Config
59-
interface ${INTERFACE}
50+
interface ${CURRENT_INTERFACE}
6051
static ip_address=${CURRENT_IP_ADDRESS}/24
61-
static routers=${GATEWAY}
62-
static domain_name_servers=${GATEWAY}
52+
static routers=${CURRENT_GATEWAY}
53+
static domain_name_servers=${CURRENT_GATEWAY}
6354
6455
EOF
6556

installation/routines/setup_mpd.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ setup_mpd() {
3737
local MPD_EXECUTE_INSTALL=true
3838

3939
if [[ -f ${MPD_CONF_PATH} || -f ${SYSTEMD_USR_PATH}/mpd.service ]]; then
40-
echo " It seems there is a MPD already installed."
41-
echo " Note: It is important that MPD runs as a user service!"
42-
echo " Would you like to overwrite your configuration? [Y/n] " | tee /dev/fd/3
40+
echo "It seems there is a MPD already installed.
41+
Note: It is important that MPD runs as a user service!
42+
Would you like to overwrite your configuration? [Y/n]" 1>&3
4343
read -r response
4444
case "$response" in
4545
[nN][oO]|[nN])

src/jukebox/components/hostif/linux/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ def get_ip_address():
193193
ip_address = p.stdout.strip().decode()
194194
else:
195195
ip_address = '127.0.0.1'
196+
197+
# only get first if multiple adresses are present (ipv4/ipv6)
198+
ip_address = ip_address.split(' ')[0]
196199
return ip_address
197200

198201

0 commit comments

Comments
 (0)