post_install() { # virtual environement to avoid pip changing system packages /usr/bin/python -m venv --system-site-packages /opt/thefanclub/overgrive/venv /opt/thefanclub/overgrive/venv/bin/pip install --upgrade google-api-python-client gtk-update-icon-cache -q -t -f usr/share/icons/hicolor # Recomplie Schemas for good measure if [ -f /usr/bin/glib-compile-schemas ] then /usr/bin/glib-compile-schemas /usr/share/glib-2.0/schemas/ fi if [ -d /opt/thefanclub/overgrive/__pycache__ ] then cp /opt/thefanclub/overgrive/__pycache__/$(ls /opt/thefanclub/overgrive/__pycache__ | grep $(python3 -V | cut -d' ' -f2 | cut -d'.' -f1-2 | sed 's/\.//g')) /opt/thefanclub/overgrive/overgrive rm -R /opt/thefanclub/overgrive/__pycache__ fi # Post Install Check if correctly installed and Python version present if [ ! -f /opt/thefanclub/overgrive/overgrive ] then echo "[overGrive] Install failed. Could not find compatible Python3 version. Install a compatible Python3 version then re-install overGrive, or consider using the AppImage." exit 1 fi } post_upgrade() { post_install } pre_remove() { # stop application if running if ( pgrep overgrive > /dev/null ) then pkill -9 ^overgrive fi # Set English as Shell output language LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 userName=$(eval echo $SUDO_USER) userHome=$(eval echo ~${SUDO_USER}) if [ -f /tmp/overgrive.lock ] then # check if indicator is running checkFlock=$(cat /tmp/overgrive.lock) if [ ! "$checkFlock" = "" ] then kill $checkFlock 2>/dev/null || true rm /tmp/overgrive.lock fi fi if [ -f "$userHome/.config/autostart/overgrive-autostart.desktop" ] then rm "$userHome/.config/autostart/overgrive-autostart.desktop" fi if [ -f "$userHome/.config/autostart/overgrive.desktop" ] then rm "$userHome/.config/autostart/overgrive.desktop" fi if [ -d "/opt/thefanclub/overgrive/venv" ] then rm -r "/opt/thefanclub/overgrive/venv" fi if [ -f "/opt/thefanclub/overgrive/overgrive" ] then rm "/opt/thefanclub/overgrive/overgrive" fi } post_remove() { rm -rf /opt/thefanclub/overgrive/ if [ -z "$(ls -A /opt/thefanclub/)" ] then rmdir /opt/thefanclub/ fi gtk-update-icon-cache -q -t -f usr/share/icons/hicolor update-desktop-database -q }