Browse Source

Spectro installer, plus other minor fixes

Phillip Burgess 5 months ago
parent
commit
fb2b5ccf27
4 changed files with 224 additions and 260 deletions
  1. 1
    2
      pi-eyes.sh
  2. 1
    2
      rgb-matrix.sh
  3. 0
    220
      rgb-matrix.sh.bak
  4. 222
    36
      spectro.sh

+ 1
- 2
pi-eyes.sh View File

@@ -133,7 +133,6 @@ reconfig2() {
133 133
 	else
134 134
 		# Not found; append to line (silently)
135 135
                 sed -i "s/$/ $3/g" $1 >/dev/null
136
-
137 136
 	fi
138 137
 }
139 138
 
@@ -226,7 +225,7 @@ if [ $SCREEN_SELECT -ne 4 ]; then
226 225
 		sed -i "s/^.*fbx2.*$/\/boot\/Pi_Eyes\/fbx2 $SCREEN_OPT \&/g" /etc/rc.local >/dev/null
227 226
 	else
228 227
 		# Insert fbx2 into rc.local before final 'exit 0'
229
-	sed -i "s/^exit 0/\/boot\/Pi_Eyes\/fbx2 $SCREEN_OPT \&\\nexit 0/g" /etc/rc.local >/dev/null
228
+		sed -i "s/^exit 0/\/boot\/Pi_Eyes\/fbx2 $SCREEN_OPT \&\\nexit 0/g" /etc/rc.local >/dev/null
230 229
 	fi
231 230
 
232 231
 	RADIUS=${RADIUS_VALUES[($SCREEN_SELECT-1)]}

+ 1
- 2
rgb-matrix.sh View File

@@ -47,7 +47,6 @@ QUALITY_MOD=0
47 47
 # Given a list of strings representing options, display each option
48 48
 # preceded by a number (1 to N), display a prompt, check input until
49 49
 # a valid number within the selection range is entered.
50
-# Can we pass an array?
51 50
 selectN() {
52 51
 	args=("${@}")
53 52
 	if [[ ${args[0]} = "0" ]]; then
@@ -283,4 +282,4 @@ if [[ ! "$REPLY" =~ ^(yes|y|Y)$ ]]; then
283 282
 fi
284 283
 echo "Reboot started..."
285 284
 reboot
286
-exit 0
285
+sleep infinity

+ 0
- 220
rgb-matrix.sh.bak View File

@@ -1,220 +0,0 @@
1
-#!/bin/bash
2
-
3
-# INSTALLER SCRIPT FOR ADAFRUIT RGB MATRIX BONNET OR HAT
4
-
5
-# hzeller/rpi-rgb-led-matrix sees lots of active development!
6
-# That's cool and all, BUT, to avoid tutorial breakage,
7
-# we reference a specific commit (update this as needed):
8
-GITUSER=https://github.com/hzeller
9
-REPO=rpi-rgb-led-matrix
10
-COMMIT=58830f7bb5dfb47fc24f1fd26cd7c4e3a20f13f7
11
-
12
-if [ $(id -u) -ne 0 ]; then
13
-	echo "Installer must be run as root."
14
-	echo "Try 'sudo bash $0'"
15
-	exit 1
16
-fi
17
-
18
-clear
19
-
20
-echo "This script installs software for the Adafruit"
21
-echo "RGB Matrix Bonnet or HAT for Raspberry Pi."
22
-echo "Steps include:"
23
-echo "- Update package index files (apt-get update)"
24
-echo "- Install prerequisite software"
25
-echo "- Install RGB matrix driver software"
26
-echo "- Configure boot options"
27
-echo "Run time ~10 minutes. Some options require reboot."
28
-echo "EXISTING INSTALLATION, IF ANY, WILL BE OVERWRITTEN."
29
-echo
30
-echo -n "CONTINUE? [y/N] "
31
-read
32
-if [[ ! "$REPLY" =~ ^(yes|y|Y)$ ]]; then
33
-	echo "Canceled."
34
-	exit 0
35
-fi
36
-
37
-# FEATURE PROMPTS ----------------------------------------------------------
38
-# Installation doesn't begin until after all user input is taken.
39
-
40
-INTERFACE_TYPE=0
41
-INSTALL_RTC=0
42
-QUALITY_MOD=0
43
-
44
-# Given a list of strings representing options, display each option
45
-# preceded by a number (1 to N), display a prompt, check input until
46
-# a valid number within the selection range is entered.
47
-# Can we pass an array?
48
-selectN() {
49
-	args=("${@}")
50
-	for ((i=0; i<$#; i++)); do
51
-		echo $((i+1)). ${args[$i]}
52
-	done
53
-	echo
54
-	REPLY=""
55
-	while :
56
-	do
57
-		echo -n "SELECT 1-$#: "
58
-		read
59
-		if [[ $REPLY -ge 1 ]] && [[ $REPLY -le $# ]]; then
60
-			return $REPLY
61
-		fi
62
-	done
63
-}
64
-
65
-OPTION_NAMES=(NO YES)
66
-
67
-INTERFACES=( \
68
-  "Adafruit RGB Matrix Bonnet" \
69
-  "Adafruit RGB Matrix HAT + RTC" \
70
-)
71
-
72
-QUALITY_OPTS=( \
73
-  "Quality (disables sound, requires soldering)" \
74
-  "Convenience (sound on, no soldering)" \
75
-)
76
-
77
-echo
78
-echo "Select interface board type:"
79
-selectN "${INTERFACES[@]}"
80
-INTERFACE_TYPE=$?
81
-
82
-if [ $INTERFACE_TYPE -eq 2 ]; then
83
-	# For matrix HAT, ask about RTC install
84
-	echo
85
-	echo -n "Install realtime clock support? [y/N] "
86
-	read
87
-	if [[ "$REPLY" =~ (yes|y|Y)$ ]]; then
88
-		INSTALL_RTC=1
89
-	fi
90
-fi
91
-
92
-echo
93
-echo "Now you must choose between QUALITY and CONVENIENCE."
94
-echo
95
-echo "QUALITY: best output from the LED matrix requires"
96
-echo "commandeering hardware normally used for sound, plus"
97
-echo "some soldering.  If you choose this option, there will"
98
-echo "be NO sound from the audio jack or HDMI (USB audio"
99
-echo "adapters will work and sound best anyway), AND you"
100
-echo "must SOLDER a wire between GPIO4 and GPIO18 on the"
101
-echo "Bonnet or HAT board."
102
-echo
103
-echo "CONVENIENCE: sound works normally, no extra soldering."
104
-echo "Images on the LED matrix are not quite as steady, but"
105
-echo "maybe OK for most uses.  If eager to get started, use"
106
-echo "'CONVENIENCE' for now, you can make the change and"
107
-echo "reinstall using this script later!"
108
-echo
109
-echo "What is thy bidding?"
110
-selectN "${QUALITY_OPTS[@]}"
111
-QUALITY_MOD=$?
112
-
113
-# VERIFY SELECTIONS BEFORE CONTINUING --------------------------------------
114
-
115
-echo
116
-echo "Interface board type: ${INTERFACES[$INTERFACE_TYPE-1]}"
117
-if [ $INTERFACE_TYPE -eq 2 ]; then
118
-	echo "Install RTC support: ${OPTION_NAMES[$INSTALL_RTC]}"
119
-fi
120
-echo "Optimize: ${QUALITY_OPTS[$QUALITY_MOD-1]}"
121
-if [ $QUALITY_MOD -eq 1 ]; then
122
-	echo "Reminder: you must SOLDER a wire between GPIO4"
123
-	echo "and GPIO18, and internal sound is DISABLED!"
124
-fi
125
-echo
126
-echo -n "CONTINUE? [y/N] "
127
-read
128
-if [[ ! "$REPLY" =~ ^(yes|y|Y)$ ]]; then
129
-	echo "Canceled."
130
-	exit 0
131
-fi
132
-
133
-# START INSTALL ------------------------------------------------------------
134
-# All selections are validated at this point...
135
-
136
-# Given a filename, a regex pattern to match and a replacement string,
137
-# perform replacement if found, else append replacement to end of file.
138
-# (# $1 = filename, $2 = pattern to match, $3 = replacement)
139
-reconfig() {
140
-	grep $2 $1 >/dev/null
141
-	if [ $? -eq 0 ]; then
142
-		# Pattern found; replace in file
143
-		sed -i "s/$2/$3/g" $1 >/dev/null
144
-	else
145
-		# Not found; append (silently)
146
-		echo $3 | sudo tee -a $1 >/dev/null
147
-	fi
148
-}
149
-
150
-echo
151
-echo "Starting installation..."
152
-echo "Updating package index files..."
153
-apt-get update
154
-
155
-echo "Downloading prerequisites..."
156
-apt-get install -y --force-yes python-dev python-imaging
157
-
158
-echo "Downloading RGB matrix software..."
159
-curl -L $GITUSER/$REPO/archive/$COMMIT.zip -o $REPO-$COMMIT.zip
160
-unzip -q $REPO-$COMMIT.zip
161
-rm $REPO-$COMMIT.zip
162
-mv $REPO-$COMMIT rpi-rgb-led-matrix
163
-echo "Building RGB matrix software..."
164
-cd rpi-rgb-led-matrix
165
-if [ $QUALITY_MOD -eq 1 ]; then
166
-	HARDWARE_DESC=adafruit-hat-pwm make
167
-	cd bindings/python
168
-	python setup.py install
169
-else
170
-	HARDWARE_DESC=adafruit-hat make USER_DEFINES="-DDISABLE_HARDWARE_PULSES"
171
-	cd bindings/python
172
-	python setup.py install
173
-fi
174
-# Change ownership to user calling sudo
175
-cd ../../..
176
-chown -R $SUDO_USER:$(id -g $SUDO_USER) rpi-rgb-led-matrix
177
-
178
-
179
-# CONFIG -------------------------------------------------------------------
180
-
181
-echo "Configuring system..."
182
-
183
-if [ $INSTALL_RTC -ne 0 ]; then
184
-	# Enable I2C for RTC
185
-	raspi-config nonint do_i2c 0
186
-	# Do additional RTC setup for DS1307
187
-	reconfig /boot/config.txt "^.*dtoverlay=i2c-rtc.*$" "dtoverlay=i2c-rtc,ds1307"
188
-	apt-get -y remove fake-hwclock
189
-	update-rc.d -f fake-hwclock remove
190
-	sudo sed --in-place '/if \[ -e \/run\/systemd\/system \] ; then/,+2 s/^#*/#/' /lib/udev/hwclock-set
191
-
192
-fi
193
-
194
-if [ $QUALITY_MOD -eq 1 ]; then
195
-	# Disable sound ('easy way' -- kernel module not blacklisted)
196
-	reconfig /boot/config.txt "^.*dtparam=audio.*$" "dtparam=audio=off"
197
-else
198
-	# Enable sound (ditto)
199
-	reconfig /boot/config.txt "^.*dtparam=audio.*$" "dtparam=audio=on"
200
-fi
201
-
202
-# PROMPT FOR REBOOT --------------------------------------------------------
203
-
204
-echo "Done."
205
-echo
206
-echo "Settings take effect on next boot."
207
-if [ $INSTALL_RTC -ne 0 ]; then
208
-	echo "RTC will be enabled then but time must be set"
209
-	echo "up using the 'date' and 'hwclock' commands."
210
-fi
211
-echo
212
-echo -n "REBOOT NOW? [y/N] "
213
-read
214
-if [[ ! "$REPLY" =~ ^(yes|y|Y)$ ]]; then
215
-	echo "Exiting without reboot."
216
-	exit 0
217
-fi
218
-echo "Reboot started..."
219
-reboot
220
-exit 0

+ 222
- 36
spectro.sh View File

@@ -1,36 +1,27 @@
1 1
 #!/bin/bash
2 2
 
3
+# INSTALLER SCRIPT FOR ADAFRUIT SPECTRO PROJECT
4
+
3 5
 if [ $(id -u) -ne 0 ]; then
4 6
 	echo "Installer must be run as root."
5 7
 	echo "Try 'sudo bash $0'"
6 8
 	exit 1
7 9
 fi
8 10
 
9
-if [ $PWD -ne /home/pi ]; then
10
-	echo "Script should be run from the /home/pi directory."
11
-	exit 2
12
-fi
13
-
14
-if [! -d ./rpi-rgb-led-matrix not present]; then
15
-	echo "Please run RGB matrix installer (rgb-matrix.sh) first."
16
-	exit 2
17
-fi
18
-
19 11
 clear
20 12
 
21 13
 echo "This script installs software for the Adafruit"
22
-echo "Spectro project for Raspberry Pi. Steps include:"
14
+echo "Spectro project for Raspberry Pi."
15
+echo "Steps include:"
23 16
 echo "- Update package index files (apt-get update)"
24
-echo "- Install Python libraries: python3-dev, python3-pil,"
25
-echo "  python3-rpi.gpio"
26
-echo "- Download Adafruit Spectro directory in current"
27
-echo "  location (MUST be adjacent to rpi-rgb-led-matrix"
28
-echo "  directory in /home/pi)"
29
-echo "- Set Spectro task-switch button (GPIO25) to run"
30
-echo "  on startup"
31
-echo "RGB MATRIX INSTALLER (rgb-matrix.sh) MUST BE RUN FIRST."
32
-echo "Run time <5 minutes. Reboot required."
17
+echo "- Install prerequisite software"
18
+echo "- Install Spectro software"
19
+echo "- Configure hardware and boot options"
20
+echo "Run time ~10 minutes."
21
+echo
33 22
 echo "EXISTING INSTALLATION, IF ANY, WILL BE OVERWRITTEN."
23
+echo "If you've edited any Spectro-related files, cancel"
24
+echo "the installation and back up those files first."
34 25
 echo
35 26
 echo -n "CONTINUE? [y/N] "
36 27
 read
@@ -39,35 +30,229 @@ if [[ ! "$REPLY" =~ ^(yes|y|Y)$ ]]; then
39 30
 	exit 0
40 31
 fi
41 32
 
42
-# START INSTALL ------------------------------------------------------------
33
+# FEATURE PROMPTS ----------------------------------------------------------
34
+# Installation doesn't begin until after all user input is taken.
35
+
36
+MATRIX_SIZE=0
37
+SLOWDOWN_GPIO=0
38
+ENABLE_MIC=0
39
+ENABLE_ACCEL=0
40
+HDMI_SIZE=0
41
+
42
+OPTION_NAMES=(NO YES)
43
+MATRIX_WIDTHS=(64 32)
44
+MATRIX_HEIGHTS=(32 16)
45
+SIZE_OPTS=( \
46
+  "${MATRIX_WIDTHS[0]} x ${MATRIX_HEIGHTS[0]}" \
47
+  "${MATRIX_WIDTHS[1]} x ${MATRIX_HEIGHTS[1]}" \
48
+)
49
+SLOWDOWN_OPTS=( \
50
+  "0" \
51
+  "1" \
52
+  "2" \
53
+  "3" \
54
+  "4" \
55
+)
56
+HDMI_OPTS=( \
57
+  "640x480" \
58
+  "320x240" \
59
+)
60
+
61
+# Given a list of strings representing options, display each option
62
+# preceded by a number (1 to N), display a prompt, check input until
63
+# a valid number within the selection range is entered.
64
+selectN() {
65
+	args=("${@}")
66
+	# If first item in list is the literal number '0', make the list
67
+	# indexed from 0 rather than 1. This is to avoid confusion when
68
+	# entering the GPIO slowdown setting (e.g. entering '1' for a
69
+	# value of '0' is awkward). In all other cases, list is indexed
70
+	# from 1 as this is more human.
71
+	if [[ ${args[0]} = "0" ]]; then
72
+		OFFSET=0
73
+	else
74
+		OFFSET=1
75
+	fi
76
+	for ((i=0; i<$#; i++)); do
77
+		echo $((i+$OFFSET)). ${args[$i]}
78
+	done
79
+	echo
80
+	REPLY=""
81
+	let LAST=$#+$OFFSET-1
82
+	while :
83
+	do
84
+		echo -n "SELECT $OFFSET-$LAST: "
85
+		read
86
+		if [[ $REPLY -ge $OFFSET ]] && [[ $REPLY -le $LAST ]]; then
87
+			let RESULT=$REPLY-$OFFSET
88
+			return $RESULT
89
+		fi
90
+	done
91
+}
43 92
 
44 93
 echo
45
-echo "Starting installation..."
94
+echo "What size LED matrix are you using with Spectro?"
95
+selectN "${SIZE_OPTS[@]}"
96
+MATRIX_SIZE=$?
97
+
98
+echo
99
+echo "Faster Pi boards require dialing back GPIO speed"
100
+echo "to work with the LED matrix. For Raspberry Pi 4,"
101
+echo "this usually means the max '4' slowdown setting."
102
+echo "For early single-core boards, '0' will often"
103
+echo "suffice. Try '1' or '2' for anything else. There's"
104
+echo "no hard-set rule to this. If the Spectro display"
105
+echo "is glitchy, just re-run this installer, selecting"
106
+echo "a higher setting until you find a stable value."
107
+echo "GPIO slowdown setting:"
108
+selectN "${SLOWDOWN_OPTS[@]}"
109
+SLOWDOWN_GPIO=$?
110
+
111
+echo
112
+echo -n "OPTIONAL: Enable USB microphone support? [y/N] "
113
+read
114
+if [[ "$REPLY" =~ (yes|y|Y)$ ]]; then
115
+	ENABLE_MIC=1
116
+fi
117
+
118
+echo
119
+echo -n "OPTIONAL: Enable LIS3DH accelerometer support? [y/N] "
120
+read
121
+if [[ "$REPLY" =~ (yes|y|Y)$ ]]; then
122
+	ENABLE_ACCEL=1
123
+fi
124
+
125
+# HDMI resolution selection might be handled later; right now nothing
126
+# requires it. But in the future if anything relies on fb2matrix.py,
127
+# HDMI resolution ultimately determines the frame rate that's possible,
128
+# flipside being that some monitors can't handle extremely low resolutions.
129
+# So an option might be presented here, set to 320x240 or 640x480 (the
130
+# latter being the minimum resolution some displays can support).
131
+
132
+# VERIFY SELECTIONS BEFORE CONTINUING --------------------------------------
133
+
134
+echo
135
+echo "LED matrix size: ${SIZE_OPTS[$MATRIX_SIZE]}"
136
+echo "GPIO slowdown: ${SLOWDOWN_OPTS[$SLOWDOWN_GPIO]}"
137
+echo "Enable USB microphone support: ${OPTION_NAMES[$ENABLE_MIC]}"
138
+echo "Enable LIS3DH support: ${OPTION_NAMES[$ENABLE_ACCEL]}"
139
+#echo "HDMI resolution: ${HDMI_OPTS[$HDMI_SIZE]}"
140
+echo
141
+echo -n "CONTINUE? [y/N] "
142
+read
143
+if [[ ! "$REPLY" =~ ^(yes|y|Y)$ ]]; then
144
+	echo "Canceled."
145
+	exit 0
146
+fi
147
+
148
+# Check whether RGB matrix library is present.
149
+# If not, offer to download and run that script first (then return here).
150
+echo
46 151
 echo "Updating package index files..."
47 152
 apt-get update
153
+apt-get -qq install python3-pip python-pip
154
+echo -n "Checking for RGB matrix library..."
155
+pip3 freeze | grep rgbmatrix > /dev/null
156
+if [ $? -eq 0 ]; then
157
+	echo "OK."
158
+else
159
+	echo "not present."
160
+	echo "Would you like to download and install the RGB matrix"
161
+	echo "library (required by Spectro) first? If so, DO NOT REBOOT"
162
+	echo "when prompted. You’ll return to this script for more"
163
+	echo "Spectro configuration."
164
+	echo -n "Run RGB matrix installer? [y/N] "
165
+	read
166
+	if [[ "$REPLY" =~ (yes|y|Y)$ ]]; then
167
+		wget https://raw.githubusercontent.com/adafruit/Raspberry-Pi-Installer-Scripts/master/rgb-matrix.sh -O rgb-matrix.sh
168
+		bash rgb-matrix.sh
169
+		echo
170
+		echo "You are now back in the main Spectro installer script."
171
+		echo "When prompted about reboot again, now it's OK!"
172
+	fi
173
+fi
174
+
175
+# START INSTALL ------------------------------------------------------------
176
+# All selections are validated at this point...
48 177
 
49
-echo "Installing Python libraries..."
50
-apt-get install -y python3-dev python3-pil python3-rpi.gpio
178
+# Given a filename, a regex pattern to match and a replacement string,
179
+# perform replacement if found, else append replacement to end of file.
180
+# (# $1 = filename, $2 = pattern to match, $3 = replacement)
181
+reconfig() {
182
+	grep $2 $1 >/dev/null
183
+	if [ $? -eq 0 ]; then
184
+		# Pattern found; replace in file
185
+		sed -i "s/$2/$3/g" $1 >/dev/null
186
+	else
187
+		# Not found; append (silently)
188
+		echo $3 | sudo tee -a $1 >/dev/null
189
+	fi
190
+}
51 191
 
52
-echo "Installing Adafruit code and data..."
53
-cd /tmp
54
-curl -LO https://github.com/adafruit/Adafruit_Spectro_Pi/archive/master.zip
55
-unzip -o master.zip
56
-mv Adafruit_Spectro_Pi-master /home/pi/Adafruit_Spectro_Pi
57
-chown -R pi:pi /home/pi/Adafruit_Spectro_Pi
192
+# Same as above, but skips if pattern not found
193
+reconfig2() {
194
+        grep $2 $1 >/dev/null
195
+        if [ $? -eq 0 ]; then
196
+                # Pattern found; replace in file
197
+                sed -i "s/$2/$3/g" $1 >/dev/null
198
+        fi
199
+}
200
+
201
+echo
202
+echo "Starting installation..."
203
+
204
+# Although Spectro is all Python3-ready, user additions might rely on
205
+# Python2, so we'll install the prerequisite libraries for both 2 and 3...
206
+echo "Downloading prerequisites..."
207
+pip3 install psutil
208
+pip install psutil
209
+apt-get install -y --force-yes python3-dev python3-pillow python2.7-dev python-pillow 
210
+if [ $ENABLE_MIC -ne 0 ]; then
211
+	apt-get install -y --force-yes python3-pyaudio python3-numpy python-pyaudio python-numpy
212
+fi
213
+if [ $ENABLE_ACCEL -ne 0 ]; then
214
+	pip3 install adafruit-circuitpython-busdevice adafruit-circuitpython-lis3dh
215
+	pip install adafruit-circuitpython-busdevice adafruit-circuitpython-lis3dh
216
+fi
217
+
218
+echo "Downloading Spectro software..."
219
+curl -L https://github.com/adafruit/Adafruit_Spectro_Pi/archive/master.zip -o Adafruit_Spectro_Pi.zip
220
+unzip -q -o Adafruit_Spectro_Pi.zip
221
+rm Adafruit_Spectro_Pi.zip
222
+mv Adafruit_Spectro_Pi-master Adafruit_Spectro_Pi
223
+chown -R pi:pi Adafruit_Spectro_Pi
58 224
 
59 225
 # CONFIG -------------------------------------------------------------------
60 226
 
61 227
 echo "Configuring system..."
62 228
 
229
+if [ $ENABLE_MIC -ne 0 ]; then
230
+	# Change ALSA settings to allow USB mic use
231
+	reconfig2 /usr/share/alsa/alsa.conf "^defaults.ctl.card.*0" "defaults.ctl.card 1"
232
+	reconfig2 /usr/share/alsa/alsa.conf "^defaults.pcm.card.*0" "defaults.pcm.card 1"
233
+fi
234
+
235
+if [ $ENABLE_ACCEL -ne 0 ]; then
236
+	# Enable I2C for accelerometer
237
+	raspi-config nonint do_i2c 0
238
+fi
239
+
240
+# Make default GIFs directory
241
+mkdir /boot/gifs
242
+
243
+# Set up LED columns, rows and slowdown in selector.py script
244
+reconfig2 ./Adafruit_Spectro_Pi/selector.py "^FLAGS.*$" "FLAGS\ =\ [\"--led-cols=${MATRIX_WIDTHS[$MATRIX_SIZE]}\",\ \"--led-rows=${MATRIX_HEIGHTS[$MATRIX_SIZE]}\",\ \"--led-slowdown-gpio=${SLOWDOWN_OPTS[$SLOWDOWN_GPIO]}\"]"
245
+
246
+# Force HDMI out so /dev/fb0 exists
247
+reconfig /boot/config.txt "^.*hdmi_force_hotplug.*$" "hdmi_force_hotplug=1"
248
+#reconfig /boot/config.txt "^.*hdmi_group.*$" "hdmi_group=2"
249
+#reconfig /boot/config.txt "^.*hdmi_mode.*$" "hdmi_mode=87"
250
+
63 251
 # Auto-start selector.py on boot
64 252
 grep selector.py /etc/rc.local >/dev/null
65
-if [ $? -eq 0 ]; then
66
-	# selector.py already in rc.local, but make sure correct:
67
-	sed -i "s/^.*selector.py.*$/cd \/home\/pi\/Adafruit_Spectro_Pi;python3 selector.py \&/g" /etc/rc.local >/dev/null
68
-else
253
+if [ $? -ne 0 ]; then
69 254
 	# Insert selector.py into rc.local before final 'exit 0'
70
-sed -i "s/^exit 0/cd \/home\/pi\/Adafruit_Spectro_Pi;python3 selector.py \&\\nexit 0/g" /etc/rc.local >/dev/null
255
+	sed -i "s/^exit 0/cd \/home\/pi\/Adafruit_Spectro_Pi\;python3 selector.py \&\\nexit 0/g" /etc/rc.local >/dev/null
71 256
 fi
72 257
 
73 258
 # PROMPT FOR REBOOT --------------------------------------------------------
@@ -75,6 +260,7 @@ fi
75 260
 echo "Done."
76 261
 echo
77 262
 echo "Settings take effect on next boot."
263
+echo "For proper clock time, set the time zone with raspi-config."
78 264
 echo
79 265
 echo -n "REBOOT NOW? [y/N] "
80 266
 read
@@ -84,4 +270,4 @@ if [[ ! "$REPLY" =~ ^(yes|y|Y)$ ]]; then
84 270
 fi
85 271
 echo "Reboot started..."
86 272
 reboot
87
-exit 0
273
+sleep infinity

Loading…
Cancel
Save