#4073 On migration from RaspberryPi to VM set display to headless (#4734)

* dont allow LCD on VM
* #4073 when migration import on VM - set display to headless
This commit is contained in:
/rootzoll 2024-10-02 11:28:44 +02:00 committed by GitHub
parent b0cc9f7dbd
commit 224259694c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 9 deletions

View File

@ -443,14 +443,6 @@ fi
if [ "${command}" == "set-display" ]; then
# Make sure needed packages are installed
if [ $(dpkg-query -l | grep "ii fbi" | wc -l) = 0 ]; then
sudo apt-get install fbi -y > /dev/null
fi
if [ $(dpkg-query -l | grep "ii qrencode" | wc -l) = 0 ]; then
sudo apt-get install qrencode -y > /dev/null
fi
paramDisplayClass=$2
paramDisplayType=$3
echo "# blitz.display.sh set-display ${paramDisplayClass} ${paramDisplayType}"
@ -462,6 +454,12 @@ if [ "${command}" == "set-display" ]; then
exit 1
fi
# abort if set to lcd and is vm
if [ "${vm}" == "1" ] && [ "${paramDisplayClass}" == "lcd" ]; then
echo "err='LCD not supported on VM'"
exit 1
fi
# check if display class parameter is given
if [ "${baseimage}" == "" ]; then
echo "err='missing baseimage info'"
@ -474,6 +472,14 @@ if [ "${command}" == "set-display" ]; then
exit 1
fi
# Make sure needed packages are installed
if [ $(dpkg-query -l | grep "ii fbi" | wc -l) = 0 ]; then
sudo apt-get install fbi -y > /dev/null
fi
if [ $(dpkg-query -l | grep "ii qrencode" | wc -l) = 0 ]; then
sudo apt-get install qrencode -y > /dev/null
fi
echo "# old(${displayClass})"
echo "# new(${paramDisplayClass})"

View File

@ -84,6 +84,7 @@ migrate_raspiblitz_conf () {
fi
# write default raspiblitz config
source /home/admin/raspiblitz.info
source /home/admin/_version.info
echo "# RASPIBLITZ CONFIG FILE" > /home/admin/raspiblitz.conf
sudo mv /home/admin/raspiblitz.conf /mnt/hdd/raspiblitz.conf
@ -94,7 +95,13 @@ migrate_raspiblitz_conf () {
/home/admin/config.scripts/blitz.conf.sh set network "bitcoin"
/home/admin/config.scripts/blitz.conf.sh set chain "main"
/home/admin/config.scripts/blitz.conf.sh set hostname "${nodename}"
/home/admin/config.scripts/blitz.conf.sh set displayClass "lcd"
if [ "${vm}" == "1" ]; then
/home/admin/config.scripts/blitz.conf.sh set displayClass "headless"
else
/home/admin/config.scripts/blitz.conf.sh set displayClass "lcd"
fi
/home/admin/config.scripts/blitz.conf.sh set lcdrotate "1"
/home/admin/config.scripts/blitz.conf.sh set runBehindTor "on"
@ -562,6 +569,12 @@ if [ "$1" = "import" ]; then
exit 1
fi
#4073 if migration is imported on VM - make sure to set displayClass to headless
source /home/admin/raspiblitz.info
if [ "${vm}" == "1" ]; then
/home/admin/config.scripts/blitz.conf.sh set displayClass "headless"
fi
# correcting all user rights on data will be done by provisioning process
echo "# OK import done - provisioning process needed"
exit 0