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,23 +2,17 @@
set -e set -e
for i in $(ls /home) install_pip_pkgs()
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
DIALOG=$(which whiptail || which dialog) DIALOG=$(which whiptail || which dialog)
$DIALOG --yesno "OpenSnitch GUI needs to install 3 more packages from $DIALOG --yesno "OpenSnitch GUI needs to install 3 more packages:
pypi using pip3: unicode_slugify, grpcio-tools and protobuf.\n\nDo you want to install them unicode_slugify, grpcio-tools and protobuf.
now?" 15 60
Note: It's better to install them as regular user instead of root:
pip3 install --user unicode_slugify protobuf grpcio-tools
Do you want to install them now?" 15 70 ||
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Installing grpcio-tools..." echo "Installing grpcio-tools..."
pip3 install grpcio-tools || echo "Unable to install grpcio, try it manually." pip3 install grpcio-tools || echo "Unable to install grpcio, try it manually."
@ -29,3 +23,25 @@ if [ $? -eq 0 ]; then
echo "Installing slugify..." echo "Installing slugify..."
pip3 install unicode_slugify || echo "Unable to install unicode_slugify, try it manually." 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,14 +2,9 @@
set -e 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
case "$1" in
remove)
echo echo
echo " If you don't need them anymore, remember to uninstall unicode_slugify, grcpio-tools and protobuf:" echo " If you don't need them anymore, remember to uninstall unicode_slugify, grcpio-tools and protobuf:"
echo echo
@ -17,3 +12,6 @@ echo " pip3 uninstall unicode_slugify"
echo " pip3 uninstall grcpio-tools" echo " pip3 uninstall grcpio-tools"
echo " pip3 uninstall protobuf" echo " pip3 uninstall protobuf"
echo echo
;;
esac