#!/bin/sh -e
#
# this script is meant to ease the installation of downloaded .deb files
# it goes hand in hand with local/share/applications/apt-install-local-file.desktop

deb=$(readlink -f "$1")

zenity --question --text \
  "This will install $(basename "${deb}"). Are you sure you want to proceed?"

ret=$?
if [ "${ret}" != 0 ]; then
  notify-send "Installation cancelled" "${deb}"
  exit
fi

sudo apt install "${deb}"
ret=$?
if [ "${ret}" = 0 ]; then
  notify-send "Installation successful" "${deb}"
else
  notify-send "Installation failed" "${deb}"
fi
