Skip to content

Commit

Permalink
Fix installation script
Browse files Browse the repository at this point in the history
  • Loading branch information
bkbilly committed Feb 12, 2024
1 parent 3f0f56e commit fbbb993
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ With LNXlink, you can monitor your Linux machine's performance, execute commands

# Get started
To get started with LNXlink, follow these simple steps:
- Download the LNXlink application and install it on your Linux machine: `pip install -U lnxlink`
- Download the LNXlink application and install it on your Linux machine: `pipx install lnxlink`
- Follow the configuration instructions to setup LNXlink: `lnxlink -c lnxlink.yaml`
- Install and configure on Home Assistant the [hass-mqtt-mediaplayer](https://github.com/bkbilly/hass-mqtt-mediaplayer) integration.
- Enjoy real-time monitoring and control of your Linux machine from your Home Assistant dashboard.
Expand Down
40 changes: 23 additions & 17 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ basedir=/opt/lnxlink
if [ -f /etc/debian_version ]; then
installcommand='apt-get --yes --force-yes install'
system='debian/ubuntu'
echo -e "\e[35mUpdating package manager...\e[0m"
sudo apt-get update
elif [ -d /etc/yum.repos.d ]; then
installcommand='dnf install -y'
Expand All @@ -19,38 +20,43 @@ else
fi

# Installing system packages
echo -e "\e[35mLooking for Python3...\e[0m"
if [ -z $(which python3) ]; then
echo -e "\e[31mPython3 not found, installing from $system package manager:\e[0m"
sudo $installcommand python3
fi

echo -e "\e[35mLooking for PIP3...\e[0m"
if [ -z $(which pip3) ]; then
echo -e "\e[31mPIP3 not found, installing from $system package manager:\e[0m"
if [ system=='arch/manjaro' ]; then
sudo $installcommand python-pip
else
sudo $installcommand python3-pip
fi
if [ -z $(which pipx) ]; then
echo -e "\e[31mPIPX not found, installing from $system package manager:\e[0m"
sudo $installcommand pipx
pipx ensurepath
fi


echo -e "\e[35mInstalling system dependencies...\e[0m"
if [ "$system" == "redhat/fedora" ]; then
# python3-devel and needed on fedora to install evdev (a dependency of pynput)
sudo $installcommand kernel-headers-$(uname -r) python3-devel gcc
fi
if [ system != 'debian/ubuntu' ]; then
if [ "$system" != 'debian/ubuntu' ]; then
echo -e "\n\n\e[31mSystem dependencies might not be correct...\e[0m"
fi
sudo $installcommand patchelf meson libdbus-glib-1-dev libglib2.0-dev libasound2-dev xdotool xprintidle xdg-utils

if [[ $(pidof dbus-daemon) ]]; then
echo -e "\e[35mFound dbus...\e[0m"
sudo $installcommand patchelf meson libdbus-glib-1-dev libglib2.0-dev libcairo2-dev libgirepository1.0-dev
fi
sudo $installcommand libasound2-dev upower xdotool xdg-utils python3-pyaudio

# Install Python requirements
echo -e "\e[35mInstalling LNXlink from PyPi...\e[0m"
sudo pip3 install -U lnxlink

# Install LNXlink
if [ -z $(which lnxlink) ]; then
echo -e "\e[35mInstalling LNXlink...\e[0m"
pipx install lnxlink
lnxlink -sc config.yaml
else
echo -e "\e[31mUpgrading LNXlink...\e[0m"
pipx upgrade lnxlink
fi

# Done
echo -e "\n\n\nAll done!"
echo "Enjoy!!!"
echo -e "\e[35m\n\n\nAll done!\e[0m"
echo -e "\e[35mEnjoy!!!\e[0m"

0 comments on commit fbbb993

Please sign in to comment.