|
@@ -192,70 +192,6 @@ apt-get -y --force-yes install ntp busybox-syslogd; dpkg --purge rsyslog
|
192
|
192
|
|
193
|
193
|
echo "Configuring system..."
|
194
|
194
|
|
195
|
|
-# Install boot-time R/W jumper test if requested
|
196
|
|
-GPIOTEST="gpio -g mode $RW_PIN up\n\
|
197
|
|
-if [ \`gpio -g read $RW_PIN\` -eq 0 ] ; then\n\
|
198
|
|
-\tmount -o remount,rw \/\n\
|
199
|
|
-\tmount -o remount,rw \/boot\n\
|
200
|
|
-fi\n"
|
201
|
|
-if [ $INSTALL_RW_JUMPER -ne 0 ]; then
|
202
|
|
- apt-get install -y --force-yes wiringpi
|
203
|
|
- # Check if already present in rc.local:
|
204
|
|
- grep "gpio -g read" /etc/rc.local >/dev/null
|
205
|
|
- if [ $? -eq 0 ]; then
|
206
|
|
- # Already there, but make sure pin is correct:
|
207
|
|
- sed -i "s/^.*gpio\ -g\ read.*$/$GPIOTEST/g" /etc/rc.local >/dev/null
|
208
|
|
-
|
209
|
|
- else
|
210
|
|
- # Not there, insert before final 'exit 0'
|
211
|
|
- sed -i "s/^exit 0/$GPIOTEST\\nexit 0/g" /etc/rc.local >/dev/null
|
212
|
|
- fi
|
213
|
|
-fi
|
214
|
|
-
|
215
|
|
-# Install watchdog if requested
|
216
|
|
-if [ $INSTALL_WATCHDOG -ne 0 ]; then
|
217
|
|
- apt-get install -y --force-yes watchdog
|
218
|
|
- # $MODULE is specific watchdog module name
|
219
|
|
- MODULE=${WATCHDOG_MODULES[($WD_TARGET-1)]}
|
220
|
|
- # Add to /etc/modules, update watchdog config file
|
221
|
|
- append1 /etc/modules $MODULE $MODULE
|
222
|
|
- replace /etc/watchdog.conf "#watchdog-device" "watchdog-device"
|
223
|
|
- replace /etc/watchdog.conf "#max-load-1" "max-load-1"
|
224
|
|
- # Start watchdog at system start and start right away
|
225
|
|
- # Raspbian Stretch needs this package installed first
|
226
|
|
- apt-get install -y --force-yes insserv
|
227
|
|
- insserv watchdog; /etc/init.d/watchdog start
|
228
|
|
- # Additional settings needed on Jessie
|
229
|
|
- append1 /lib/systemd/system/watchdog.service "WantedBy" "WantedBy=multi-user.target"
|
230
|
|
- systemctl enable watchdog
|
231
|
|
- # Set up automatic reboot in sysctl.conf
|
232
|
|
- replaceAppend /etc/sysctl.conf "^.*kernel.panic.*$" "kernel.panic = 10"
|
233
|
|
-fi
|
234
|
|
-
|
235
|
|
-# Install gpio-halt if requested
|
236
|
|
-if [ $INSTALL_HALT -ne 0 ]; then
|
237
|
|
- apt-get install -y --force-yes wiringpi
|
238
|
|
- echo "Installing gpio-halt in /usr/local/bin..."
|
239
|
|
- cd /tmp
|
240
|
|
- curl -LO https://github.com/adafruit/Adafruit-GPIO-Halt/archive/master.zip
|
241
|
|
- unzip master.zip
|
242
|
|
- cd Adafruit-GPIO-Halt-master
|
243
|
|
- make
|
244
|
|
- mv gpio-halt /usr/local/bin
|
245
|
|
- cd ..
|
246
|
|
- rm -rf Adafruit-GPIO-Halt-master
|
247
|
|
-
|
248
|
|
- # Add gpio-halt to /rc.local:
|
249
|
|
- grep gpio-halt /etc/rc.local >/dev/null
|
250
|
|
- if [ $? -eq 0 ]; then
|
251
|
|
- # gpio-halt already in rc.local, but make sure correct:
|
252
|
|
- sed -i "s/^.*gpio-halt.*$/\/usr\/local\/bin\/gpio-halt $HALT_PIN \&/g" /etc/rc.local >/dev/null
|
253
|
|
- else
|
254
|
|
- # Insert gpio-halt into rc.local before final 'exit 0'
|
255
|
|
- sed -i "s/^exit 0/\/usr\/local\/bin\/gpio-halt $HALT_PIN \&\\nexit 0/g" /etc/rc.local >/dev/null
|
256
|
|
- fi
|
257
|
|
-fi
|
258
|
|
-
|
259
|
195
|
# Add fastboot, noswap and/or ro to end of /boot/cmdline.txt
|
260
|
196
|
append2 /boot/cmdline.txt fastboot fastboot
|
261
|
197
|
append2 /boot/cmdline.txt noswap noswap
|
|
@@ -271,12 +207,6 @@ rm -rf /var/cache/lightdm
|
271
|
207
|
ln -s /tmp /var/lib/lightdm
|
272
|
208
|
ln -s /tmp /var/cache/lightdm
|
273
|
209
|
|
274
|
|
-# Make SSH work
|
275
|
|
-replaceAppend /etc/ssh/sshd_config "^.*UsePrivilegeSeparation.*$" "UsePrivilegeSeparation no"
|
276
|
|
-# bbro method (not working in Jessie?):
|
277
|
|
-#rmdir /var/run/sshd
|
278
|
|
-#ln -s /tmp /var/run/sshd
|
279
|
|
-
|
280
|
210
|
# Change spool permissions in var.conf (rondie/Margaret fix)
|
281
|
211
|
replace /usr/lib/tmpfiles.d/var.conf "spool\s*0755" "spool 1777"
|
282
|
212
|
|
|
@@ -294,6 +224,7 @@ replace /etc/fstab "vfat\s*defaults\s" "vfat defaults,ro "
|
294
|
224
|
replace /etc/fstab "ext4\s*defaults,noatime\s" "ext4 defaults,noatime,ro "
|
295
|
225
|
append1 /etc/fstab "/var/log" "tmpfs /var/log tmpfs nodev,nosuid 0 0"
|
296
|
226
|
append1 /etc/fstab "/var/tmp" "tmpfs /var/tmp tmpfs nodev,nosuid 0 0"
|
|
227
|
+append1 /etc/fstab "/var/run" "tmpfs /var/run tmpfs nodev,nosuid 0 0"
|
297
|
228
|
append1 /etc/fstab "\s/tmp" "tmpfs /tmp tmpfs nodev,nosuid 0 0"
|
298
|
229
|
|
299
|
230
|
# PROMPT FOR REBOOT --------------------------------------------------------
|