#!/bin/bash
sudo dpkg --add-architecture armhf
install_packages libudev1:armhf libgconf-2-4:armhf libgtk2.0-0:armhf libxrender1:armhf libxtst6:armhf libxi6:armhf libxss1:armhf libnss3:armhf libasound2:armhf libstdc++6:armhf || exit 1
sudo ln -s /usr/lib/aarch64-linux-gnu/libudev.so.1 /usr/lib/aarch64-linux-gnu/libudev.so.0
wget -O $HOME/Temps.zip https://github.com/musicpro/temps/releases/download/0.7.4/Temps-linux-armv7l.zip || error 'Failed to download Temps!'
unzip $HOME/Temps.zip || error 'Failed to unzip Temps.zip!'
sudo ln -sf $HOME/Temps-linux-armv7l/Temps /usr/local/bin/temps || error 'Failed to create a symbolic link from $HOME/Temps-linux-armv7l/Temps to /bin/temps!'
echo "[Desktop Entry]
Name=Temps
Comment=Temps is a modern and minimal menubar application based on Electron with actual weather information and forecast.
GenericName=Weather App
Exec=temps
Icon=$(dirname $0)/icon-64.png
StartupNotify=true
Terminal=false
Type=Application
Categories=Utility;" > $HOME/.local/share/applications/Temps.desktop || error 'Failed to create menu shortcut!'
rm -f $HOME/Temps.zip || sudo rm -f $HOME/Temps.zip || error 'Failed to remove Temps.zip!'
