install-script: Change to account for fixing broken packages in apt
This commit is contained in:
parent
4d3918a68a
commit
145d9c1d84
@ -8,18 +8,40 @@ PKGLIST="xserver-xorg-video-fbturbo xdotool xinit xinput x11-xserver-utils libop
|
|||||||
PKGLIST="${PKGLIST} python3-gi-cairo python3-virtualenv gir1.2-gtk-3.0 virtualenv matchbox-keyboard wireless-tools"
|
PKGLIST="${PKGLIST} python3-gi-cairo python3-virtualenv gir1.2-gtk-3.0 virtualenv matchbox-keyboard wireless-tools"
|
||||||
PKGLIST="${PKGLIST} libatlas-base-dev"
|
PKGLIST="${PKGLIST} libatlas-base-dev"
|
||||||
|
|
||||||
|
DGRAY='\033[1;30m'
|
||||||
|
NC='\033[0m'
|
||||||
|
|
||||||
|
echo_text ()
|
||||||
|
{
|
||||||
|
printf "${NC}$1${DGRAY}\n"
|
||||||
|
}
|
||||||
|
|
||||||
install_packages()
|
install_packages()
|
||||||
{
|
{
|
||||||
echo "Update package data"
|
echo_text "Update package data"
|
||||||
sudo apt update
|
sudo apt-get update
|
||||||
|
|
||||||
echo "Installing package dependencies"
|
echo_text "Checking for broken packages..."
|
||||||
sudo apt install -y $PKGLIST
|
output=$(dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' | grep -E ^.[^nci])
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo_text "Detectected broken pacakges. Attempting to fix"
|
||||||
|
sudo apt-get -f install
|
||||||
|
output=$(dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' | grep -E ^.[^nci])
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo_text "Unable to fix dependencies. These must be fixed before KlipperScreen can be installed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo_text "No broken packages"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo_text "Installing KlipperScreen dependencies"
|
||||||
|
sudo apt-get install -y $PKGLIST
|
||||||
}
|
}
|
||||||
|
|
||||||
create_virtualenv()
|
create_virtualenv()
|
||||||
{
|
{
|
||||||
echo "Creating virtual environment"
|
echo_text "Creating virtual environment"
|
||||||
[ ! -d ${KSENV} ] && virtualenv -p /usr/bin/python3 ${KSENV}
|
[ ! -d ${KSENV} ] && virtualenv -p /usr/bin/python3 ${KSENV}
|
||||||
|
|
||||||
${KSENV}/bin/pip install -r ${KSPATH}/scripts/KlipperScreen-requirements.txt
|
${KSENV}/bin/pip install -r ${KSPATH}/scripts/KlipperScreen-requirements.txt
|
||||||
@ -30,10 +52,10 @@ create_virtualenv()
|
|||||||
install_systemd_service()
|
install_systemd_service()
|
||||||
{
|
{
|
||||||
if [ -f "/etc/systemd/system/KlipperScreen.service" ]; then
|
if [ -f "/etc/systemd/system/KlipperScreen.service" ]; then
|
||||||
echo "KlipperScreen unit file already installed"
|
echo_text "KlipperScreen unit file already installed"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
echo "Installing KlipperScreen unit file"
|
echo_text "Installing KlipperScreen unit file"
|
||||||
|
|
||||||
SERVICE=$(<$SCRIPTPATH/KlipperScreen.service)
|
SERVICE=$(<$SCRIPTPATH/KlipperScreen.service)
|
||||||
KSPATH_ESC=$(sed "s/\//\\\\\//g" <<< $KSPATH)
|
KSPATH_ESC=$(sed "s/\//\\\\\//g" <<< $KSPATH)
|
||||||
@ -57,10 +79,10 @@ update_x11()
|
|||||||
{
|
{
|
||||||
if [ -e /etc/X11/Xwrapper.conf ]
|
if [ -e /etc/X11/Xwrapper.conf ]
|
||||||
then
|
then
|
||||||
echo "Updating X11 Xwrapper"
|
echo_text "Updating X11 Xwrapper"
|
||||||
sudo sed -i 's/allowed_users=console/allowed_users=anybody/g' /etc/X11/Xwrapper.config
|
sudo sed -i 's/allowed_users=console/allowed_users=anybody/g' /etc/X11/Xwrapper.config
|
||||||
else
|
else
|
||||||
echo "Adding X11 Xwrapper"
|
echo_text "Adding X11 Xwrapper"
|
||||||
echo 'allowed_users=anybody' | sudo tee /etc/X11/Xwrapper.config
|
echo 'allowed_users=anybody' | sudo tee /etc/X11/Xwrapper.config
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -75,3 +97,4 @@ modify_user
|
|||||||
install_systemd_service
|
install_systemd_service
|
||||||
update_x11
|
update_x11
|
||||||
start_KlipperScreen
|
start_KlipperScreen
|
||||||
|
echo "${NC}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user