2
2
3
3
_option_static_ip () {
4
4
# 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
9
20
read -r response
10
21
case " $response " in
11
22
[nN][oO]|[nN])
@@ -19,7 +30,13 @@ It'll save a lot of start up time. This can be changed later.
19
30
20
31
_option_ipv6 () {
21
32
# 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
23
40
read -r response
24
41
case " $response " in
25
42
[nN][oO]|[nN])
@@ -33,14 +50,17 @@ _option_ipv6() {
33
50
34
51
_option_autohotspot () {
35
52
# ENABLE_AUTOHOTSPOT
36
- echo " Do you want to enable a WiFi hotspot on demand?
53
+ clear 1>&3
54
+ echo " ---------------------- AUTOHOTSPOT ----------------------
55
+
37
56
When enabled, this service spins up a WiFi hotspot
38
57
when the Phoniebox is unable to connect to a known
39
58
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
41
61
read -r response
42
62
case " $response " in
43
- [yY])
63
+ [yY][eE][sS]|[yY] )
44
64
ENABLE_AUTOHOTSPOT=true
45
65
;;
46
66
* )
@@ -51,7 +71,7 @@ WiFi. This way you can still access it.
51
71
echo " Do you want to set a custom Password? (default: ${AUTOHOTSPOT_PASSWORD} ) [y/N] " 1>&3
52
72
read -r response_pw_q
53
73
case " $response_pw_q " in
54
- [yY])
74
+ [yY][eE][sS]|[yY] )
55
75
while [ $( echo ${response_pw} | wc -m) -lt 8 ]
56
76
do
57
77
echo " Please type the new password (at least 8 character)." 1>&3
@@ -80,9 +100,13 @@ WiFi. This way you can still access it.
80
100
81
101
_option_bluetooth () {
82
102
# 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
86
110
read -r response
87
111
case " $response " in
88
112
[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
96
120
97
121
_option_samba () {
98
122
# 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
103
132
read -r response
104
133
case " $response " in
105
134
[nN][oO]|[nN])
@@ -114,10 +143,13 @@ the installation. If you are unsure, stick to YES!
114
143
115
144
_option_webapp () {
116
145
# 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
121
153
read -r response
122
154
case " $response " in
123
155
[nN][oO]|[nN])
@@ -132,14 +164,18 @@ to manage your Phoniebox!
132
164
133
165
_option_kiosk_mode () {
134
166
# 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
140
176
read -r response
141
177
case " $response " in
142
- [yY])
178
+ [yY][eE][sS]|[yY] )
143
179
ENABLE_KIOSK_MODE=true
144
180
;;
145
181
* )
@@ -150,12 +186,16 @@ xserver dependencies and not the entire RPi desktop environment.
150
186
151
187
_options_update_raspi_os () {
152
188
# 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
156
196
read -r response
157
197
case " $response " in
158
- [nN])
198
+ [nN][oO]|[nN] )
159
199
UPDATE_RASPI_OS=false
160
200
;;
161
201
* )
@@ -167,18 +207,25 @@ This shall be done eventually, but increases the installation time a lot.
167
207
_option_disable_onboard_audio () {
168
208
# Disable BCM on-chip audio (typically Headphones)
169
209
# 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} )
170
224
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
179
226
read -r response
180
227
case " $response " in
181
- [yY])
228
+ [yY][eE][sS]|[yY] )
182
229
DISABLE_ONBOARD_AUDIO=true
183
230
;;
184
231
* )
@@ -196,36 +243,37 @@ _option_webapp_devel_build() {
196
243
if [[ " $ENABLE_WEBAPP_PROD_DOWNLOAD " = " release-only" ]]; then
197
244
ENABLE_WEBAPP_PROD_DOWNLOAD=false
198
245
fi
199
-
200
246
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.
202
251
This means, you will need to build the web app locally.
203
252
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
205
255
read -r response
206
256
case " $response " in
207
- [nN])
257
+ [nN][oO]|[nN] )
208
258
ENABLE_INSTALL_NODE=false
209
259
;;
210
260
* )
211
261
;;
212
262
esac
213
-
214
263
# 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
216
265
$ cd ~/RPi-Jukebox-RFID/src/webapp && ./run_rebuild.sh -u
217
266
This must be done after reboot, due to memory restrictions.
218
267
Read the documentation regarding local Web App builds!"
219
- ENABLE_WEBAPP_PROD_DOWNLOAD=false
220
268
fi
221
269
fi
222
270
}
223
271
224
272
customize_options () {
225
273
echo " Customize Options starts"
226
274
227
- _option_static_ip
228
275
_option_ipv6
276
+ _option_static_ip
229
277
_option_autohotspot
230
278
_option_bluetooth
231
279
_option_disable_onboard_audio
0 commit comments