Permalink
Browse files

Remove desktop icons automatically when we uninstall apps

  • Loading branch information...
kmoore134 committed May 13, 2014
1 parent 0c23f64 commit a58abb5c7c7c78ce45a59ea4f89ed09bee306365
Showing with 18 additions and 0 deletions.
  1. +18 −0 src-sh/pbi-manager/pbi-manager
@@ -751,6 +751,10 @@ do_pbi_delete() {
exit_err "$PBI_DELETENAME is part of PC-BSD base system and cannot be removed."
fi
+ # Remove the desktop icon for all users, if it exists
+ del_xdg_icon "$PBI_CONFDIR" "desktop" "all"
+
+ # Enable the force flag if necessary
if [ "$PBI_FORCEDELETE" = "YES" ] ; then
pOpts="-y -f"
else
@@ -852,6 +856,20 @@ del_xdg_icon() {
do
$cmd uninstall `basename $i`
done
+
+ if [ "$3" != "all" ] ; then return; fi
+ require_root
+
+ # Try to remove this for all users
+ for user in `ls /home`
+ do
+ # Does this user exist?
+ cat /etc/passwd | grep -q "^${user}:"
+ if [ $? -ne 0 ] ; then continue; fi
+
+ # Remove the icon
+ su $user -c "pbi icon del-desktop $PBI_ORIGIN" 2>/dev/null
+ done
}
add_xdg_icon() {

0 comments on commit a58abb5

Please sign in to comment.