UI deb package improvements

* Purge files when using apt remove --purge
* Display a message to uninstall installed pkgs from pypi when invoking
apt remove
* link autostart .desktop file to /usr/share/applications instead of
copying it
This commit is contained in:
Gustavo Iñiguez Goia 2020-02-22 17:22:28 +01:00
parent e3b0287e2e
commit 0f171f87d4
3 changed files with 66 additions and 29 deletions

View file

@ -2,24 +2,18 @@
set -e
for i in $(ls /home)
do
path=/home/$i/.config/autostart/
if [ ! -d $path ]; then
mkdir -p $path
fi
if [ -f /usr/share/applications/opensnitch_ui.desktop ];then
cp /usr/share/applications/opensnitch_ui.desktop $path
fi
done
install_pip_pkgs()
{
DIALOG=$(which whiptail || which dialog)
$DIALOG --yesno "OpenSnitch GUI needs to install 3 more packages:
unicode_slugify, grpcio-tools and protobuf.
DIALOG=$(which whiptail || which dialog)
Note: It's better to install them as regular user instead of root:
pip3 install --user unicode_slugify protobuf grpcio-tools
$DIALOG --yesno "OpenSnitch GUI needs to install 3 more packages from
pypi using pip3: unicode_slugify, grpcio-tools and protobuf.\n\nDo you want to install them
now?" 15 60
if [ $? -eq 0 ]; then
Do you want to install them now?" 15 70 ||
if [ $? -eq 0 ]; then
echo "Installing grpcio-tools..."
pip3 install grpcio-tools || echo "Unable to install grpcio, try it manually."
echo
@ -28,4 +22,26 @@ if [ $? -eq 0 ]; then
echo
echo "Installing slugify..."
pip3 install unicode_slugify || echo "Unable to install unicode_slugify, try it manually."
fi
fi
exit 0
}
for i in $(ls /home)
do
path=/home/$i/.config/autostart/
if [ ! -d $path ]; then
mkdir -p $path
fi
if [ -f /usr/share/applications/opensnitch_ui.desktop ];then
ln -s /usr/share/applications/opensnitch_ui.desktop $path || true
fi
done
set +e
case "$1" in
configure)
install_pip_pkgs
;;
esac

23
ui/debian/postrm Executable file
View file

@ -0,0 +1,23 @@
#!/bin/sh
set -e
purge_files()
{
for i in $(ls /home)
do
path=/home/$i/.config/
if [ -h $path/autostart/opensnitch_ui.desktop -o -f $path/autostart/opensnitch_ui.desktop ];then
rm -f $path/autostart/opensnitch_ui.desktop
fi
if [ -d $path/opensnitch/ ]; then
rm -rf $path/opensnitch/
fi
done
}
case "$1" in
purge)
purge_files
;;
esac

View file

@ -2,18 +2,16 @@
set -e
for i in $(ls /home)
do
path=/home/$i/.config/autostart/opensnitch_ui.desktop
if [ -f $path ];then
rm -f $path
fi
done
echo
echo " If you don't need them anymore, remember to uninstall unicode_slugify, grcpio-tools and protobuf:"
echo
echo " pip3 uninstall unicode_slugify"
echo " pip3 uninstall grcpio-tools"
echo " pip3 uninstall protobuf"
echo
case "$1" in
remove)
echo
echo " If you don't need them anymore, remember to uninstall unicode_slugify, grcpio-tools and protobuf:"
echo
echo " pip3 uninstall unicode_slugify"
echo " pip3 uninstall grcpio-tools"
echo " pip3 uninstall protobuf"
echo
;;
esac