42 lines
1.9 KiB
Bash
42 lines
1.9 KiB
Bash
#!/usr/bin/sh
|
|
|
|
set -e
|
|
set -u
|
|
|
|
TMP=$(/usr/bin/mktemp --directory --quiet)
|
|
trap "/usr/bin/rm --force --recursive ${TMP}" EXIT
|
|
BOOT=$(/usr/bin/grep '/boot' '/etc/fstab' | /usr/bin/mawk '$1 !~ /^#/ && $2 ~ /^[/]/ {print $2}')
|
|
/usr/bin/test -n "${BOOT}"
|
|
|
|
case "${1}" in
|
|
install)
|
|
/usr/bin/install --directory '/opt/pironman5'
|
|
if ! /usr/bin/grep --quiet 'sunfounder-pironman5' "${BOOT}/config.txt"; then
|
|
/usr/bin/echo '' >> "${BOOT}/config.txt"
|
|
/usr/bin/echo '## sunfounder-pironman5' >> "${BOOT}/config.txt"
|
|
/usr/bin/echo '## Enable the SunFounder Pironman 5 driver.' >> "${BOOT}/config.txt"
|
|
/usr/bin/echo '##' >> "${BOOT}/config.txt"
|
|
/usr/bin/echo 'dtoverlay=sunfounder-pironman5,ir=off' >> "${BOOT}/config.txt"
|
|
fi
|
|
/usr/bin/echo 'BOOT_UART=1' >> "${TMP}/raspberrypi-eeprom.cfg"
|
|
/usr/bin/echo 'BOOT_ORDER=0xf41' >> "${TMP}/raspberrypi-eeprom.cfg"
|
|
/usr/bin/echo 'POWER_OFF_ON_HALT=1' >> "${TMP}/raspberrypi-eeprom.cfg"
|
|
/usr/bin/echo 'WAIT_FOR_POWER_BUTTON=1 ' >> "${TMP}/raspberrypi-eeprom.cfg"
|
|
/usr/bin/echo 'BOOT_WATCHDOG_TIMEOUT=15 ' >> "${TMP}/raspberrypi-eeprom.cfg"
|
|
/usr/bin/echo 'MAX_RESTARTS=1 ' >> "${TMP}/raspberrypi-eeprom.cfg"
|
|
/usr/bin/echo 'DISABLE_HDMI=1' >> "${TMP}/raspberrypi-eeprom.cfg"
|
|
/usr/bin/echo '' >> "${TMP}/raspberrypi-eeprom.cfg"
|
|
/usr/bin/rpi-eeprom-config --apply "${TMP}/raspberrypi-eeprom.cfg" > '/dev/null' 2>&1
|
|
/usr/bin/echo ''
|
|
/usr/bin/echo '########################################################'
|
|
/usr/bin/echo '# #'
|
|
/usr/bin/echo '# ! Restart the device to load the necessary drivers ! #'
|
|
/usr/bin/echo '# #'
|
|
/usr/bin/echo '########################################################'
|
|
/usr/bin/echo ''
|
|
;;
|
|
upgrade)
|
|
/usr/bin/install --directory '/opt/pironman5'
|
|
;;
|
|
esac
|