installer improvements (#601)

The installer now catchs apt errors
FBturbo is now optional and FBdev is used as fallback
install xserver-xorg-legacy but do not force it, it's usually required for a lot of screens, but not 100%
hide pip update warnings, the new version broke stuff.
more granularity and steps to what's being installed, should make it easier to debug if something goes wrong
This commit is contained in:
Alfredo Monclus 2022-04-29 12:12:00 -03:00 committed by GitHub
parent 6aa7f56231
commit 7420f38b15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,10 +4,13 @@ SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
KSPATH=$(sed 's/\/scripts//g' <<< $SCRIPTPATH) KSPATH=$(sed 's/\/scripts//g' <<< $SCRIPTPATH)
KSENV="${HOME}/.KlipperScreen-env" KSENV="${HOME}/.KlipperScreen-env"
PKGLIST="xserver-xorg-video-fbturbo xdotool xinit xinput x11-xserver-utils libopenjp2-7 python3-distutils" XSERVER="xinit xinput x11-xserver-utils xdotool"
PKGLIST="${PKGLIST} python3-virtualenv virtualenv matchbox-keyboard wireless-tools" FBTURBO="xserver-xorg-video-fbturbo"
PKGLIST="${PKGLIST} libatlas-base-dev fonts-freefont-ttf" FBDEV="xserver-xorg-video-fbdev"
PKGLIST="${PKGLIST} libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0" PYTHON="python3-virtualenv virtualenv python3-distutils"
PYGOBJECT="libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0"
MISC="libopenjp2-7 libatlas-base-dev fonts-freefont-ttf matchbox-keyboard wireless-tools"
OPTIONAL="xserver-xorg-legacy"
Red='\033[0;31m' Red='\033[0;31m'
Green='\033[0;32m' Green='\033[0;32m'
@ -49,7 +52,49 @@ install_packages()
fi fi
echo_text "Installing KlipperScreen dependencies" echo_text "Installing KlipperScreen dependencies"
sudo apt-get install -y $PKGLIST sudo apt-get install -y $XSERVER
if [ $? -eq 0 ]; then
echo_ok "Installed X"
else
echo_error "Installation of X-server dependencies failed ($XSERVER)"
exit 1
fi
sudo apt-get install -y $OPTIONAL
sudo apt-get install -y $FBTURBO
if [ $? -eq 0 ]; then
echo_ok "Installed FBturbo driver"
else
echo $_
echo_error "Installation of $FBTURBO failed, trying $FBDEV"
sudo apt-get install -y $FBDEV
if [ $? -eq 0 ]; then
echo_ok "Installed FBdev"
else
echo_error "Installation of FBdev failed ($FBDEV)"
exit 1
fi
fi
sudo apt-get install -y $PYTHON
if [ $? -eq 0 ]; then
echo_ok "Installed Python dependincies"
else
echo_error "Installation of Python dependincies failed ($PYTHON)"
exit 1
fi
sudo apt-get install -y $PYGOBJECT
if [ $? -eq 0 ]; then
echo_ok "Installed PyGobject dependincies"
else
echo_error "Installation of PyGobject dependincies failed ($PYGOBJECT)"
exit 1
fi
sudo apt-get install -y $MISC
if [ $? -eq 0 ]; then
echo_ok "Installed Misc packages"
else
echo_error "Installation of Misc packages failed ($MISC)"
exit 1
fi
} }
create_virtualenv() create_virtualenv()
@ -65,12 +110,12 @@ create_virtualenv()
source ${KSENV}/bin/activate source ${KSENV}/bin/activate
while read requirements; do while read requirements; do
pip install $requirements pip --disable-pip-version-check install $requirements
if [ $? -gt 0 ]; then if [ $? -gt 0 ]; then
echo "Error: pip install exited with status code $?" echo "Error: pip install exited with status code $?"
echo "Unable to install dependencies, aborting install." echo "Unable to install dependencies, aborting install."
deactivate deactivate
exit exit 1
fi fi
done < ${KSPATH}/scripts/KlipperScreen-requirements.txt done < ${KSPATH}/scripts/KlipperScreen-requirements.txt
deactivate deactivate
@ -125,7 +170,7 @@ start_KlipperScreen()
} }
if [ "$EUID" == 0 ] if [ "$EUID" == 0 ]
then echo_error "Plaease do not run this script as root" then echo_error "Plaease do not run this script as root"
exit exit 1
fi fi
install_packages install_packages
create_virtualenv create_virtualenv