fix moved config.txt (#4530)

This commit is contained in:
/rootzoll 2024-04-08 11:48:12 +02:00 committed by GitHub
parent c2c710a9d1
commit 2eed08965c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 187 additions and 101 deletions

View file

@ -270,6 +270,17 @@ else
fi fi
echo "baseimage=${baseimage}" echo "baseimage=${baseimage}"
# AUTO-DETECTION: CONFIGFILES
# ---------------------------------------
raspi_configfile="/boot/config.txt"
raspi_commandfile="/boot/cmdline.txt"
if [ -d /boot/firmware ];then
raspi_configfile="/boot/firmware/config.txt"
raspi_commandfile="/boot/firmware/cmdline.txt"
fi
echo "raspi_configfile=${raspi_configfile}"
echo "raspi_commandfile=${raspi_commandfile}"
# USER-CONFIRMATION # USER-CONFIRMATION
if [ "${interaction}" = "true" ]; then if [ "${interaction}" = "true" ]; then
echo -n "# Do you agree with all parameters above? (yes/no) " echo -n "# Do you agree with all parameters above? (yes/no) "
@ -441,27 +452,22 @@ if [ "${baseimage}" = "raspios_arm64" ]; then
[ "${wifi_region}" != "off" ] && raspi-config nonint do_wifi_country $wifi_region [ "${wifi_region}" != "off" ] && raspi-config nonint do_wifi_country $wifi_region
# see https://github.com/rootzoll/raspiblitz/issues/428#issuecomment-472822840 # see https://github.com/rootzoll/raspiblitz/issues/428#issuecomment-472822840
if [ -d /boot/firmware ];then if ! grep "Raspiblitz" $raspi_configfile; then
configFile="/boot/firmware/config.txt" echo "# Adding Raspiblitz Edits to $raspi_configfile"
else echo | tee -a $raspi_configfile
configFile="/boot/config.txt" echo "# Raspiblitz" | tee -a $raspi_configfile
fi
if ! grep "Raspiblitz" $configFile; then
echo "# Adding Raspiblitz Edits to $configFile"
echo | tee -a $configFile
echo "# Raspiblitz" | tee -a $configFile
# ensure that kernel8.img is used to set PAGE_SIZE to 4K # ensure that kernel8.img is used to set PAGE_SIZE to 4K
# https://github.com/raspiblitz/raspiblitz/issues/4346 # https://github.com/raspiblitz/raspiblitz/issues/4346
if [ -f /boot/kernel8.img ] || [ -f /boot/firmware/kernel8.img ]; then if [ -f /boot/kernel8.img ] || [ -f /boot/firmware/kernel8.img ]; then
echo 'kernel=kernel8.img' | tee -a $configFile echo 'kernel=kernel8.img' | tee -a $raspi_configfile
fi fi
echo "max_usb_current=1" | tee -a $configFile echo "max_usb_current=1" | tee -a $raspi_configfile
echo "dtparam=nvme" | tee -a $configFile echo "dtparam=nvme" | tee -a $raspi_configfile
echo "dtparam=watchdog=on" | tee -a $configFile echo "dtparam=watchdog=on" | tee -a $raspi_configfile
echo 'dtoverlay=pi3-disable-bt' | tee -a $configFile echo 'dtoverlay=pi3-disable-bt' | tee -a $raspi_configfile
echo 'dtoverlay=disable-bt' | tee -a $configFile echo 'dtoverlay=disable-bt' | tee -a $raspi_configfile
else else
echo "# Raspiblitz Edits are already in $configFile" echo "# Raspiblitz Edits are already in $raspi_configfile"
fi fi
# run fsck on sd root partition on every startup to prevent "maintenance login" screen # run fsck on sd root partition on every startup to prevent "maintenance login" screen
@ -476,23 +482,22 @@ if [ "${baseimage}" = "raspios_arm64" ]; then
fi fi
# edit kernel parameters # edit kernel parameters
kernelOptionsFile=/boot/cmdline.txt
fsOption1="fsck.mode=force" fsOption1="fsck.mode=force"
fsOption2="fsck.repair=yes" fsOption2="fsck.repair=yes"
fsOption1InFile=$(grep -c ${fsOption1} ${kernelOptionsFile}) fsOption1InFile=$(grep -c ${fsOption1} ${raspi_commandfile})
fsOption2InFile=$(grep -c ${fsOption2} ${kernelOptionsFile}) fsOption2InFile=$(grep -c ${fsOption2} ${raspi_commandfile})
if [ ${fsOption1InFile} -eq 0 ]; then if [ ${fsOption1InFile} -eq 0 ]; then
sed -i "s/^/$fsOption1 /g" "$kernelOptionsFile" sed -i "s/^/$fsOption1 /g" "${raspi_commandfile}"
echo "$fsOption1 added to $kernelOptionsFile" echo "$fsOption1 added to ${raspi_commandfile}"
else else
echo "$fsOption1 already in $kernelOptionsFile" echo "$fsOption1 already in ${raspi_commandfile}"
fi fi
if [ ${fsOption2InFile} -eq 0 ]; then if [ ${fsOption2InFile} -eq 0 ]; then
sed -i "s/^/$fsOption2 /g" "$kernelOptionsFile" sed -i "s/^/$fsOption2 /g" "${raspi_commandfile}"
echo "$fsOption2 added to $kernelOptionsFile" echo "$fsOption2 added to ${raspi_commandfile}"
else else
echo "$fsOption2 already in $kernelOptionsFile" echo "$fsOption2 already in ${raspi_commandfile}"
fi fi
# *** SAFE SHUTDOWN *** # *** SAFE SHUTDOWN ***
@ -783,16 +788,16 @@ if [ "${baseimage}" = "raspios_arm64" ] || [ "${baseimage}" = "debian" ]; then
# disable audio # disable audio
echo -e "\n*** DISABLE AUDIO (snd_bcm2835) ***" echo -e "\n*** DISABLE AUDIO (snd_bcm2835) ***"
sed -i "s/^dtparam=audio=on/# dtparam=audio=on/g" /boot/config.txt sed -i "s/^dtparam=audio=on/# dtparam=audio=on/g" ${raspi_configfile}
# disable DRM VC4 V3D # disable DRM VC4 V3D
echo -e "\n*** DISABLE DRM VC4 V3D driver ***" echo -e "\n*** DISABLE DRM VC4 V3D driver ***"
dtoverlay=vc4-fkms-v3d dtoverlay=vc4-fkms-v3d
sed -i "s/^dtoverlay=${dtoverlay}/# dtoverlay=${dtoverlay}/g" /boot/config.txt sed -i "s/^dtoverlay=${dtoverlay}/# dtoverlay=${dtoverlay}/g" ${raspi_configfile}
# I2C fix (make sure dtparam=i2c_arm is not on) # I2C fix (make sure dtparam=i2c_arm is not on)
# see: https://github.com/rootzoll/raspiblitz/issues/1058#issuecomment-739517713 # see: https://github.com/rootzoll/raspiblitz/issues/1058#issuecomment-739517713
sed -i "s/^dtparam=i2c_arm=.*//g" /boot/config.txt sed -i "s/^dtparam=i2c_arm=.*//g" ${raspi_configfile}
fi fi
# *** BOOTSTRAP *** # *** BOOTSTRAP ***

View file

@ -19,6 +19,15 @@ echo "INFO: _background.sh loop started - sudo journalctl -f -u background" >> /
blitzTUIHeartBeatLine="" blitzTUIHeartBeatLine=""
/home/admin/_cache.sh set blitzTUIRestarts "0" /home/admin/_cache.sh set blitzTUIRestarts "0"
# determine correct raspberrypi boot drive path (that easy to access when sd card is insert into laptop)
raspi_bootdir=""
if [ -d /boot/firmware ]; then
raspi_bootdir="/boot/firmware"
elif [ -d /boot ]; then
raspi_bootdir="/boot"
fi
echo "# raspi_bootdir(${raspi_bootdir})"
counter=0 counter=0
while [ 1 ] while [ 1 ]
do do
@ -481,11 +490,35 @@ do
echo "--> Channel Backup File changed" echo "--> Channel Backup File changed"
# make copy to sd card (as local basic backup) # make copy to sd card (as local basic backup)
mkdir -p /home/admin/backups/scb/ 2>/dev/null mkdir -p ${localBackupDir} 2>/dev/null
cp $scbPath $localBackupPath cp $scbPath $localBackupPath
if [ $? -eq 0 ]; then
echo "OK channel.backup copied to '${localBackupPath}'"
else
logger -p daemon.err "_background.sh FAIL channel.backup copy to '${localBackupPath}'"
echo "FAIL channel.backup copy to '${localBackupPath}'"
fi
cp $scbPath $localTimestampedPath cp $scbPath $localTimestampedPath
cp $scbPath /boot/firmware/channel.backup if [ $? -eq 0 ]; then
echo "OK channel.backup copied to '${localBackupPath}' and '${localTimestampedPath}' and '/boot/firmware/channel.backup'" echo "OK channel.backup copied to '${localTimestampedPath}'"
else
logger -p daemon.err "_background.sh FAIL channel.backup copy to '${localTimestampedPath}'"
echo "FAIL channel.backup copy to '${localTimestampedPath}'"
fi
# copy to boot drive (for easy recovery)
if [ "${raspi_bootdir}" != "" ]; then
cp $scbPath ${raspi_bootdir}/channel.backup
if [ $? -eq 0 ]; then
echo "OK channel.backup copied to '${raspi_bootdir}/channel.backup'"
else
logger -p daemon.err "_background.sh FAIL channel.backup copy to '${raspi_bootdir}/channel.backup'"
echo "FAIL channel.backup copy to '${raspi_bootdir}/channel.backup'"
fi
else
echo "No boot drive found - skip copy to boot"
fi
# check if a additional local backup target is set # check if a additional local backup target is set
# see ./config.scripts/blitz.backupdevice.sh # see ./config.scripts/blitz.backupdevice.sh
@ -590,8 +623,8 @@ do
mkdir -p /home/admin/backups/er/ 2>/dev/null mkdir -p /home/admin/backups/er/ 2>/dev/null
cp $erPath $localBackupPath cp $erPath $localBackupPath
cp $erPath $localTimestampedPath cp $erPath $localTimestampedPath
cp $erPath /boot/firmware/${netprefix}emergency.recover cp $erPath ${raspi_bootdir}/${netprefix}emergency.recover
echo "OK emergency.recover copied to '${localBackupPath}' and '${localTimestampedPath}' and '/boot/firmware/${netprefix}emergency.recover'" echo "OK emergency.recover copied to '${localBackupPath}' and '${localTimestampedPath}' and '${raspi_bootdir}/${netprefix}emergency.recover'"
# check if a additional local backup target is set # check if a additional local backup target is set
# see ./config.scripts/blitz.backupdevice.sh # see ./config.scripts/blitz.backupdevice.sh

View file

@ -115,11 +115,20 @@ chmod 664 ${infoFile}
# write content of raspiblitz.info to logs # write content of raspiblitz.info to logs
cat $infoFile >> $logFile cat $infoFile >> $logFile
# determine correct raspberrypi boot drive path (that easy to access when sd card is insert into laptop)
raspi_bootdir=""
if [ -d /boot/firmware ]; then
raspi_bootdir="/boot/firmware"
elif [ -d /boot ]; then
raspi_bootdir="/boot"
fi
echo "# raspi_bootdir(${raspi_bootdir})" >> $logFile
###################################### ######################################
# STOP file flag - for manual provision # STOP file flag - for manual provision
# when a file 'stop' is on the sd card bootfs partition root - stop for manual provision # when a file 'stop' is on the sd card bootfs partition root - stop for manual provision
flagExists=$(ls /boot/firmware/stop | grep -c 'stop') flagExists=$(ls ${raspi_bootdir}/stop 2>/dev/null | grep -c 'stop')
if [ "${flagExists}" == "1" ]; then if [ "${flagExists}" == "1" ]; then
# set state info # set state info
/home/admin/_cache.sh set state "stop" /home/admin/_cache.sh set state "stop"
@ -173,8 +182,8 @@ source ${configFile} 2>/dev/null
# CHECK SD CARD STATE # CHECK SD CARD STATE
# wifi config by file on sd card # wifi config by file on sd card
wifiFileExists=$(ls /boot/firmware/wifi | grep -c 'wifi') wifiFileExists=$(ls ${raspi_bootdir}/wifi 2>/dev/null | grep -c 'wifi')
wpaFileExists=$(ls /boot/firmware/wpa_supplicant.conf | grep -c 'wpa_supplicant.conf') wpaFileExists=$(ls ${raspi_bootdir}/wpa_supplicant.conf 2>/dev/null | grep -c 'wpa_supplicant.conf')
if [ "${wifiFileExists}" == "1" ] || [ "${wpaFileExists}" == "1" ]; then if [ "${wifiFileExists}" == "1" ] || [ "${wpaFileExists}" == "1" ]; then
# set info # set info
@ -185,17 +194,17 @@ if [ "${wifiFileExists}" == "1" ] || [ "${wpaFileExists}" == "1" ]; then
# get first line as string from wifi file (NAME OF WIFI) # get first line as string from wifi file (NAME OF WIFI)
# get second line as string from wifi file (PASSWORD OF WIFI) # get second line as string from wifi file (PASSWORD OF WIFI)
if [ "${wifiFileExists}" == "1" ]; then if [ "${wifiFileExists}" == "1" ]; then
echo "Getting data from file: /boot/firmware/wifi" >> ${logFile} echo "Getting data from file: ${raspi_bootdir}/wifi" >> ${logFile}
ssid=$(sed -n '1p' /boot/firmware/wifi | tr -d '[:space:]') ssid=$(sed -n '1p' ${raspi_bootdir}/wifi | tr -d '[:space:]')
password=$(sed -n '2p' /boot/firmware/wifi | tr -d '[:space:]') password=$(sed -n '2p' ${raspi_bootdir}/wifi | tr -d '[:space:]')
fi fi
# File: wpa_supplicant.conf (legacy way to set wifi) # File: wpa_supplicant.conf (legacy way to set wifi)
# see: https://github.com/raspibolt/raspibolt/blob/a21788c0518618d17093e3f447f68a53e4efa6e7/raspibolt/raspibolt_20_pi.md#prepare-wifi # see: https://github.com/raspibolt/raspibolt/blob/a21788c0518618d17093e3f447f68a53e4efa6e7/raspibolt/raspibolt_20_pi.md#prepare-wifi
if [ "${wpaFileExists}" == "1" ]; then if [ "${wpaFileExists}" == "1" ]; then
echo "Getting data from file: /boot/firmware/wpa_supplicant.conf" >> ${logFile} echo "Getting data from file: ${raspi_bootdir}/wpa_supplicant.conf" >> ${logFile}
ssid=$(grep ssid "/boot/firmware/wpa_supplicant.conf" | awk -F'=' '{print $2}' | tr -d '"') ssid=$(grep ssid "${raspi_bootdir}/wpa_supplicant.conf" | awk -F'=' '{print $2}' | tr -d '"')
password=$(grep psk "/boot/firmware/wpa_supplicant.conf" | awk -F'=' '{print $2}' | tr -d '"') password=$(grep psk "${raspi_bootdir}/wpa_supplicant.conf" | awk -F'=' '{print $2}' | tr -d '"')
fi fi
# set wifi # set wifi
@ -203,7 +212,7 @@ if [ "${wifiFileExists}" == "1" ] || [ "${wpaFileExists}" == "1" ]; then
echo "Setting Wifi SSID(${ssid}) Password(${password})" >> ${logFile} echo "Setting Wifi SSID(${ssid}) Password(${password})" >> ${logFile}
source <(/home/admin/config.scripts/internet.wifi.sh on ${ssid} ${password}) source <(/home/admin/config.scripts/internet.wifi.sh on ${ssid} ${password})
if [ "${err}" != "" ]; then if [ "${err}" != "" ]; then
echo "Setting Wifi failed - edit or remove file /boot/firmware/wifi" >> ${logFile} echo "Setting Wifi failed - edit or remove file ${raspi_bootdir}/wifi" >> ${logFile}
echo "error(${err})" >> ${logFile} echo "error(${err})" >> ${logFile}
echo "Will shutdown in 1min ..." >> ${logFile} echo "Will shutdown in 1min ..." >> ${logFile}
/home/admin/_cache.sh set state "errorWIFI" /home/admin/_cache.sh set state "errorWIFI"
@ -215,8 +224,8 @@ if [ "${wifiFileExists}" == "1" ] || [ "${wpaFileExists}" == "1" ]; then
# remove file # remove file
echo "Setting Wifi worked - removing file" >> ${logFile} echo "Setting Wifi worked - removing file" >> ${logFile}
rm /boot/firmware/wifi 2>/dev/null rm ${raspi_bootdir}/wifi 2>/dev/null
rm /boot/firmware/wpa_supplicant.conf 2>/dev/null rm ${raspi_bootdir}/wpa_supplicant.conf 2>/dev/null
else else
echo "No Wifi config by file on sd card." >> ${logFile} echo "No Wifi config by file on sd card." >> ${logFile}
fi fi
@ -315,10 +324,10 @@ systemInitReboot=0
# the sd card - switch to hdmi # the sd card - switch to hdmi
################################ ################################
forceHDMIoutput=$(ls /boot/firmware/hdmi* 2>/dev/null | grep -c hdmi) forceHDMIoutput=$(ls ${raspi_bootdir}/hdmi* 2>/dev/null | grep -c hdmi)
if [ ${forceHDMIoutput} -eq 1 ]; then if [ ${forceHDMIoutput} -eq 1 ]; then
# delete that file (to prevent loop) # delete that file (to prevent loop)
rm /boot/hdmi* rm ${raspi_bootdir}/hdmi*
# switch to HDMI what will trigger reboot # switch to HDMI what will trigger reboot
echo "HDMI switch found ... activating HDMI display output & reboot" >> $logFile echo "HDMI switch found ... activating HDMI display output & reboot" >> $logFile
/home/admin/config.scripts/blitz.display.sh set-display hdmi >> $logFile /home/admin/config.scripts/blitz.display.sh set-display hdmi >> $logFile
@ -391,10 +400,10 @@ fi
# the sd card - delete old ssh data # the sd card - delete old ssh data
################################ ################################
sshReset=$(ls /boot/firmware/ssh.reset* 2>/dev/null | grep -c reset) sshReset=$(ls ${raspi_bootdir}/ssh.reset* 2>/dev/null | grep -c reset)
if [ ${sshReset} -eq 1 ]; then if [ ${sshReset} -eq 1 ]; then
# delete that file (to prevent loop) # delete that file (to prevent loop)
rm /boot/firmware/ssh.reset* >> $logFile rm ${raspi_bootdir}/ssh.reset* >> $logFile
# delete ssh certs # delete ssh certs
echo "SSHRESET switch found ... stopping SSH and deleting old certs" >> $logFile echo "SSHRESET switch found ... stopping SSH and deleting old certs" >> $logFile
/home/admin/config.scripts/blitz.ssh.sh renew >> $logFile /home/admin/config.scripts/blitz.ssh.sh renew >> $logFile
@ -668,7 +677,7 @@ if [ ${isMounted} -eq 0 ]; then
# check if there is a flag set on sd card boot section to format as btrfs (experimental) # check if there is a flag set on sd card boot section to format as btrfs (experimental)
filesystem="ext4" filesystem="ext4"
flagBTRFS=$(ls /boot/firmware/btrfs* 2>/dev/null | grep -c btrfs) flagBTRFS=$(ls ${raspi_bootdir}/btrfs* 2>/dev/null | grep -c btrfs)
if [ "${flagBTRFS}" != "0" ]; then if [ "${flagBTRFS}" != "0" ]; then
echo "Found BTRFS flag ---> formatting with experimental BTRFS filesystem" >> ${logFile} echo "Found BTRFS flag ---> formatting with experimental BTRFS filesystem" >> ${logFile}
filesystem="btrfs" filesystem="btrfs"
@ -1099,8 +1108,9 @@ fi
# FORCE UASP FLAG # FORCE UASP FLAG
#################### ####################
# if uasp.force flag was set on sd card - now move into raspiblitz.conf # if uasp.force flag was set on sd card - now move into raspiblitz.conf
if [ -f "/boot/firmware/uasp.force" ]; then if [ -f "${raspi_bootdir}/uasp.force" ]; then
/home/admin/config.scripts/blitz.conf.sh set forceUasp "on" /home/admin/config.scripts/blitz.conf.sh set forceUasp "on"
rm ${raspi_bootdir}/uasp.force* >> $logFile
echo "DONE forceUasp=on recorded in raspiblitz.conf" >> $logFile echo "DONE forceUasp=on recorded in raspiblitz.conf" >> $logFile
fi fi

View file

@ -26,6 +26,15 @@ if [ "$EUID" -ne 0 ]; then
exit 1 exit 1
fi fi
# determine correct raspberrypi boot drive path (that easy to access when sd card is insert into laptop)
raspi_bootdir=""
if [ -d /boot/firmware ]; then
raspi_bootdir="/boot/firmware"
elif [ -d /boot ]; then
raspi_bootdir="/boot"
fi
echo "# raspi_bootdir(${raspi_bootdir})"
# install BTRFS if needed # install BTRFS if needed
btrfsInstalled=$(btrfs --version 2>/dev/null | grep -c "btrfs-progs") btrfsInstalled=$(btrfs --version 2>/dev/null | grep -c "btrfs-progs")
if [ ${btrfsInstalled} -eq 0 ]; then if [ ${btrfsInstalled} -eq 0 ]; then
@ -561,7 +570,7 @@ if [ "$1" = "status" ]; then
hddAdapterUSAP=0 hddAdapterUSAP=0
# check if force UASP flag is set on sd card # check if force UASP flag is set on sd card
if [ -f "/boot/firmware/uasp.force" ]; then if [ -f "${raspi_bootdir}/uasp.force" ]; then
hddAdapterUSAP=1 hddAdapterUSAP=1
fi fi
# or UASP is set by config file # or UASP is set by config file
@ -1881,18 +1890,18 @@ if [ "$1" = "uasp-fix" ]; then
# check if UASP is already deactivated (on RaspiOS) # check if UASP is already deactivated (on RaspiOS)
# https://www.pragmaticlinux.com/2021/03/fix-for-getting-your-ssd-working-via-usb-3-on-your-raspberry-pi/ # https://www.pragmaticlinux.com/2021/03/fix-for-getting-your-ssd-working-via-usb-3-on-your-raspberry-pi/
cmdlineExists=$(ls /boot/cmdline.txt 2>/dev/null | grep -c "cmdline.txt") cmdlineExists=$(ls ${raspi_bootdir}/cmdline.txt 2>/dev/null | grep -c "cmdline.txt")
if [ ${cmdlineExists} -eq 1 ] && [ ${#hddAdapterUSB} -gt 0 ] && [ ${hddAdapterUSAP} -eq 0 ]; then if [ ${cmdlineExists} -eq 1 ] && [ ${#hddAdapterUSB} -gt 0 ] && [ ${hddAdapterUSAP} -eq 0 ]; then
echo "# Checking for UASP deactivation ..." echo "# Checking for UASP deactivation ..."
usbQuirkActive=$(cat /boot/cmdline.txt | grep -c "usb-storage.quirks=") usbQuirkActive=$(cat ${raspi_bootdir}/cmdline.txt | grep -c "usb-storage.quirks=")
usbQuirkDone=$(cat /boot/cmdline.txt | grep -c "usb-storage.quirks=${hddAdapterUSB}:u") usbQuirkDone=$(cat ${raspi_bootdir}/cmdline.txt | grep -c "usb-storage.quirks=${hddAdapterUSB}:u")
if [ ${usbQuirkActive} -gt 0 ] && [ ${usbQuirkDone} -eq 0 ]; then if [ ${usbQuirkActive} -gt 0 ] && [ ${usbQuirkDone} -eq 0 ]; then
# remove old usb-storage.quirks # remove old usb-storage.quirks
sed -i "s/usb-storage.quirks=[^ ]* //g" /boot/cmdline.txt sed -i "s/usb-storage.quirks=[^ ]* //g" ${raspi_bootdir}/cmdline.txt
fi fi
if [ ${usbQuirkDone} -eq 0 ]; then if [ ${usbQuirkDone} -eq 0 ]; then
# add new usb-storage.quirks # add new usb-storage.quirks
sed -i "s/^/usb-storage.quirks=${hddAdapterUSB}:u /" /boot/cmdline.txt sed -i "s/^/usb-storage.quirks=${hddAdapterUSB}:u /" ${raspi_bootdir}/cmdline.txt
# go into reboot to activate new setting # go into reboot to activate new setting
echo "# DONE deactivating UASP for ${hddAdapterUSB} ... reboot needed" echo "# DONE deactivating UASP for ${hddAdapterUSB} ... reboot needed"
echo "neededReboot=1" echo "neededReboot=1"

View file

@ -19,6 +19,7 @@ fi
# 1. Parameter: lcd command # 1. Parameter: lcd command
command=$1 command=$1
echo "### blitz.display.sh $command"
# its OK if its not exist yet # its OK if its not exist yet
source /home/admin/raspiblitz.info source /home/admin/raspiblitz.info
@ -29,6 +30,16 @@ source /mnt/hdd/raspiblitz.conf 2>/dev/null
# but basically this just says if the driver for GPIO LCD is installed - not if connected # but basically this just says if the driver for GPIO LCD is installed - not if connected
fb1Exists=$(ls /dev/fb1 2>/dev/null | grep -c "/dev/fb1") fb1Exists=$(ls /dev/fb1 2>/dev/null | grep -c "/dev/fb1")
# determine correct raspberrypi config files
raspi_configfile="/boot/config.txt"
raspi_commandfile="/boot/cmdline.txt"
if [ -d /boot/firmware ];then
raspi_configfile="/boot/firmware/config.txt"
raspi_commandfile="/boot/firmware/cmdline.txt"
fi
echo "# raspi_configfile(${raspi_configfile})"
echo "# raspi_commandfile(${raspi_commandfile})"
################### ###################
# QR CODE KONSOLE # QR CODE KONSOLE
# fallback if no LCD is available # fallback if no LCD is available
@ -137,7 +148,7 @@ if [ "${command}" == "rotate" ]; then
# change rotation config # change rotation config
echo "# Turn ON: LCD ROTATE" echo "# Turn ON: LCD ROTATE"
sed -i "s/^dtoverlay=.*/dtoverlay=waveshare35a:rotate=90/g" /boot/config.txt sed -i "s/^dtoverlay=.*/dtoverlay=waveshare35a:rotate=90/g" ${raspi_configfile}
rm /etc/X11/xorg.conf.d/40-libinput.conf 2>/dev/null rm /etc/X11/xorg.conf.d/40-libinput.conf 2>/dev/null
/home/admin/config.scripts/blitz.conf.sh set lcdrotate 1 1>/dev/null 2>/dev/null /home/admin/config.scripts/blitz.conf.sh set lcdrotate 1 1>/dev/null 2>/dev/null
@ -148,7 +159,7 @@ if [ "${command}" == "rotate" ]; then
# change rotation config # change rotation config
echo "#Turn OFF: LCD ROTATE" echo "#Turn OFF: LCD ROTATE"
sed -i "s/^dtoverlay=.*/dtoverlay=waveshare35a:rotate=270/g" /boot/config.txt sed -i "s/^dtoverlay=.*/dtoverlay=waveshare35a:rotate=270/g" ${raspi_configfile}
# if touchscreen is on # if touchscreen is on
if [ "${touchscreen}" = "1" ]; then if [ "${touchscreen}" = "1" ]; then
@ -219,14 +230,14 @@ function prepareinstall() {
function install_hdmi() { function install_hdmi() {
echo "# hdmi install ... set framebuffer width/height" echo "# hdmi install ... set framebuffer width/height"
#sed -i "s/^#framebuffer_width=.*/framebuffer_width=480/g" /boot/config.txt #sed -i "s/^#framebuffer_width=.*/framebuffer_width=480/g" ${raspi_configfile}
#sed -i "s/^#framebuffer_height=.*/framebuffer_height=320/g" /boot/config.txt #sed -i "s/^#framebuffer_height=.*/framebuffer_height=320/g" ${raspi_configfile}
} }
function uninstall_hdmi() { function uninstall_hdmi() {
echo "# hdmi uninstall ... reset framebuffer width/height" echo "# hdmi uninstall ... reset framebuffer width/height"
#sed -i "s/^framebuffer_width=.*/#framebuffer_width=480/g" /boot/config.txt #sed -i "s/^framebuffer_width=.*/#framebuffer_width=480/g" ${raspi_configfile}
#sed -i "s/^framebuffer_height=.*/#framebuffer_height=320/g" /boot/config.txt #sed -i "s/^framebuffer_height=.*/#framebuffer_height=320/g" ${raspi_configfile}
} }
function install_lcd() { function install_lcd() {
@ -261,35 +272,35 @@ function install_lcd() {
# add waveshare mod # add waveshare mod
cp ./waveshare35a.dtbo /boot/overlays/ cp ./waveshare35a.dtbo /boot/overlays/
# modify /boot/config.txt # modify config file
sed -i "s/^hdmi_force_hotplug=.*//g" /boot/firmware/config.txt sed -i "s/^hdmi_force_hotplug=.*//g" ${raspi_configfile}
sed -i '/^hdmi_group=/d' /boot/firmware/config.txt 2>/dev/null sed -i '/^hdmi_group=/d' ${raspi_configfile} 2>/dev/null
sed -i "/^hdmi_mode=/d" /boot/firmware/config.txt 2>/dev/null sed -i "/^hdmi_mode=/d" ${raspi_configfile} 2>/dev/null
#sed -i "s/^#framebuffer_width=.*/framebuffer_width=480/g" /boot/config.txt #sed -i "s/^#framebuffer_width=.*/framebuffer_width=480/g" ${raspi_configfile}
#sed -i "s/^#framebuffer_height=.*/framebuffer_height=320/g" /boot/config.txt #sed -i "s/^#framebuffer_height=.*/framebuffer_height=320/g" ${raspi_configfile}
#echo "hdmi_force_hotplug=1" >> /boot/firmware/config.txt #echo "hdmi_force_hotplug=1" >> ${raspi_configfile}
sed -i "s/^dtparam=i2c_arm=.*//g" /boot/firmware/config.txt sed -i "s/^dtparam=i2c_arm=.*//g" ${raspi_configfile}
# echo "dtparam=i2c_arm=on" >> /boot/config.txt --> this is to be called I2C errors - see: https://github.com/rootzoll/raspiblitz/issues/1058#issuecomment-739517713 # echo "dtparam=i2c_arm=on" >> ${raspi_configfile} --> this is to be called I2C errors - see: https://github.com/rootzoll/raspiblitz/issues/1058#issuecomment-739517713
# don't enable SPI and UART ports by default # don't enable SPI and UART ports by default
# echo "dtparam=spi=on" >> /boot/firmware/config.txt # echo "dtparam=spi=on" >> ${raspi_configfile}
# echo "enable_uart=1" >> /boot/firmware/config.txt # echo "enable_uart=1" >> ${raspi_configfile}
sed -i "s/^dtoverlay=.*//g" /boot/firmware/config.txt sed -i "s/^dtoverlay=.*//g" ${raspi_configfile}
echo "dtoverlay=waveshare35a:rotate=90" >> /boot/firmware/config.txt echo "dtoverlay=waveshare35a:rotate=90" >> ${raspi_configfile}
# modify cmdline.txt # modify cmdline.txt
modification="dwc_otg.lpm_enable=0 quiet fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo" modification="dwc_otg.lpm_enable=0 quiet fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo"
containsModification=$(grep -c "${modification}" /boot/cmdline.txt) containsModification=$(grep -c "${modification}" ${raspi_commandfile})
if [ ${containsModification} -eq 0 ]; then if [ ${containsModification} -eq 0 ]; then
echo "# adding modification to /boot/cmdline.txt" echo "# adding modification to ${raspi_commandfile}"
cmdlineContent=$(cat /boot/cmdline.txt) cmdlineContent=$(cat ${raspi_commandfile})
echo "${cmdlineContent} ${modification}" > /boot/cmdline.txt echo "${cmdlineContent} ${modification}" > ${raspi_commandfile}
else else
echo "# /boot/cmdline.txt already contains modification" echo "# ${raspi_commandfile} already contains modification"
fi fi
containsModification=$(grep -c "${modification}" /boot/cmdline.txt) containsModification=$(grep -c "${modification}" ${raspi_commandfile})
if [ ${containsModification} -eq 0 ]; then if [ ${containsModification} -eq 0 ]; then
echo "# FAIL: was not able to modify /boot/cmdline.txt" echo "# FAIL: was not able to modify ${raspi_commandfile}"
echo "err='ended unclear state'" echo "err='ended unclear state'"
exit 1 exit 1
fi fi
@ -327,19 +338,19 @@ function uninstall_lcd() {
apt-get install -y xinput-calibrator apt-get install -y xinput-calibrator
# remove modifications of config.txt # remove modifications of config.txt
sed -i '/^hdmi_force_hotplug=/d' /boot/config.txt 2>/dev/null sed -i '/^hdmi_force_hotplug=/d' ${raspi_configfile} 2>/dev/null
sed -i '/^hdmi_group=/d' /boot/config.txt 2>/dev/null sed -i '/^hdmi_group=/d' ${raspi_configfile} 2>/dev/null
sed -i "/^hdmi_mode=/d" /boot/config.txt 2>/dev/null sed -i "/^hdmi_mode=/d" ${raspi_configfile} 2>/dev/null
sed -i "s/^dtoverlay=.*//g" /boot/config.txt 2>/dev/null sed -i "s/^dtoverlay=.*//g" ${raspi_configfile} 2>/dev/null
#sed -i "s/^framebuffer_width=.*/#framebuffer_width=480/g" /boot/config.txt #sed -i "s/^framebuffer_width=.*/#framebuffer_width=480/g" ${raspi_configfile}
#sed -i "s/^framebuffer_height=.*/#framebuffer_height=320/g" /boot/config.txt #sed -i "s/^framebuffer_height=.*/#framebuffer_height=320/g" ${raspi_configfile}
echo "hdmi_group=1" >> /boot/config.txt echo "hdmi_group=1" >> ${raspi_configfile}
echo "hdmi_mode=3" >> /boot/config.txt echo "hdmi_mode=3" >> ${raspi_configfile}
echo "dtoverlay=pi3-disable-bt" >> /boot/config.txt echo "dtoverlay=pi3-disable-bt" >> ${raspi_configfile}
echo "dtoverlay=disable-bt" >> /boot/config.txt echo "dtoverlay=disable-bt" >> ${raspi_configfile}
# remove modification of cmdline.txt # remove modification of cmdline.txt
sed -i "s/ dwc_otg.lpm_enable=0 quiet fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo//g" /boot/cmdline.txt sed -i "s/ dwc_otg.lpm_enable=0 quiet fbcon=map:10 fbcon=font:ProFont6x11 logo.nologo//g" ${raspi_commandfile}
# un-prepare X11 # un-prepare X11
mv /home/admin/wavesharelcd-64bit-rpi/40-libinput.conf /etc/X11/xorg.conf.d/40-libinput.conf 2>/dev/null mv /home/admin/wavesharelcd-64bit-rpi/40-libinput.conf /etc/X11/xorg.conf.d/40-libinput.conf 2>/dev/null

View file

@ -9,6 +9,15 @@ if [ "$EUID" -ne 0 ]
exit 1 exit 1
fi fi
# determine correct raspberrypi boot drive path (that easy to access when sd card is insert into laptop)
raspi_bootdir=""
if [ -d /boot/firmware ]; then
raspi_bootdir="/boot/firmware"
elif [ -d /boot ]; then
raspi_bootdir="/boot"
fi
echo "# raspi_bootdir(${raspi_bootdir})"
# make sure LCD is on (default for fatpack) # make sure LCD is on (default for fatpack)
/home/admin/config.scripts/blitz.display.sh set-display lcd /home/admin/config.scripts/blitz.display.sh set-display lcd
@ -24,7 +33,7 @@ if [ "${needsExpansion}" == "1" ]; then
# write a stop file to prevent full bootstrap # write a stop file to prevent full bootstrap
# after fsexpand reboot # after fsexpand reboot
touch /boot/firmware/stop touch ${raspi_bootdir}/stop
# trigger fsexpand # trigger fsexpand
/home/admin/config.scripts/blitz.bootdrive.sh fsexpand /home/admin/config.scripts/blitz.bootdrive.sh fsexpand

View file

@ -3,13 +3,22 @@
# Just run this script once after a fresh sd card build # Just run this script once after a fresh sd card build
# to prepare the image for release as a downloadable sd card image # to prepare the image for release as a downloadable sd card image
# determine correct raspberrypi boot drive path (that easy to access when sd card is insert into laptop)
raspi_bootdir=""
if [ -d /boot/firmware ]; then
raspi_bootdir="/boot/firmware"
elif [ -d /boot ]; then
raspi_bootdir="/boot"
fi
echo "# raspi_bootdir(${raspi_bootdir})"
# stop background services # stop background services
sudo systemctl stop background.service sudo systemctl stop background.service
sudo systemctl stop background.scan.service sudo systemctl stop background.scan.service
# remove stop flag (if exists) # remove stop flag (if exists)
echo "deleting stop flag .." echo "deleting stop flag .."
sudo rm /boot/firmware/stop 2>/dev/null sudo rm ${raspi_bootdir}/stop 2>/dev/null
# cleaning logs # cleaning logs
echo "deleting raspiblitz & system logs .." echo "deleting raspiblitz & system logs .."
@ -68,7 +77,7 @@ echo "keys will get recreated and sshd reactivated on fresh bootup, by _bootstra
sudo systemctl stop sshd sudo systemctl stop sshd
sudo systemctl disable sshd sudo systemctl disable sshd
sudo rm /etc/ssh/ssh_host_* sudo rm /etc/ssh/ssh_host_*
sudo touch /boot/firmware/ssh sudo touch ${raspi_bootdir}/ssh
echo "OK" echo "OK"
echo echo

View file

@ -30,7 +30,7 @@ if [ "$1" = "1" ] || [ "$1" = "on" ]; then
fi fi
echo "# make sure hdmi_force_hotplug is deactivated" echo "# make sure hdmi_force_hotplug is deactivated"
sudo sed -i '/^hdmi_force_hotplug=/d' /boot/config.txt 2>/dev/null sudo sed -i '/^hdmi_force_hotplug=/d' /boot/firmware/config.txt 2>/dev/null
# update install sources # update install sources
echo "making sure system dependencies are installed" echo "making sure system dependencies are installed"
@ -207,8 +207,8 @@ if [ "$1" = "0" ] || [ "$1" = "off" ]; then
sudo raspi-config nonint do_boot_behaviour B2 >/dev/null 2>&1 sudo raspi-config nonint do_boot_behaviour B2 >/dev/null 2>&1
# make sure hdmi_force_hotplug=1 is added again to config.txt # make sure hdmi_force_hotplug=1 is added again to config.txt
sudo sed -i '/^hdmi_force_hotplug=/d' /boot/config.txt 2>/dev/null sudo sed -i '/^hdmi_force_hotplug=/d' /boot/firmware/config.txt 2>/dev/null
#echo "hdmi_force_hotplug=1" >> /boot/config.txt #echo "hdmi_force_hotplug=1" >> /boot/firmware/config.txt
# set user pi user for autostart # set user pi user for autostart
# TODO(frennkie/rootzoll) what should happen here? This does the same as "on". # TODO(frennkie/rootzoll) what should happen here? This does the same as "on".

View file

@ -157,7 +157,7 @@ if [ "${setupPhase}" == "setup" ]; then
filesystem="ext4" filesystem="ext4"
# check if there is a flag set on sd card boot section to format as btrfs (experimental) # check if there is a flag set on sd card boot section to format as btrfs (experimental)
flagBTRFS=$(sudo ls /boot/btrfs* 2>/dev/null | grep -c btrfs) flagBTRFS=$(sudo ls /boot/firmware/btrfs* 2>/dev/null | grep -c btrfs)
if [ "${flagBTRFS}" != "0" ]; then if [ "${flagBTRFS}" != "0" ]; then
echo "Found BTRFS flag ---> formatting with experimental BTRFS filesystem" echo "Found BTRFS flag ---> formatting with experimental BTRFS filesystem"
filesystem="btrfs" filesystem="btrfs"