Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Commit

Permalink
debian: Remove config files when user uninstalls app
Browse files Browse the repository at this point in the history
  • Loading branch information
akashnimare committed Dec 5, 2017
1 parent 62e8dfe commit a1d5a35
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
10 changes: 6 additions & 4 deletions scripts/debian-add-repo.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env bash

# This script runs when user install the debian package

# Install apt repository source list if it does not exist
if ! grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep zulip; then
sudo apt-key adv --keyserver pool.sks-keyservers.net --recv 69AD12704E71A4803DCA3A682424BE5AE9BD10D9
echo "deb https://dl.bintray.com/zulip/debian/ stable main" | \
sudo tee -a /etc/apt/sources.list.d/zulip.list
if ! grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep zulip.list; then
sudo apt-key adv --keyserver pool.sks-keyservers.net --recv 69AD12704E71A4803DCA3A682424BE5AE9BD10D9
echo "deb https://dl.bintray.com/zulip/debian/ stable main" | \
sudo tee -a /etc/apt/sources.list.d/zulip.list;
fi
24 changes: 22 additions & 2 deletions scripts/debian-uninstaller.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,24 @@
#!/usr/bin/env bash

sudo apt-key del 69AD12704E71A4803DCA3A682424BE5AE9BD10D9
sudo rm /etc/apt/sources.list.d/zulip.list
# This script runs when user uninstall the debian package.
# It will remove all the config files and anything which was added by the app.

# Remove apt repository source list when user uninstalls Zulip app
if grep ^ /etc/apt/sources.list /etc/apt/sources.list.d/* | grep zulip.list; then
sudo apt-key del 69AD12704E71A4803DCA3A682424BE5AE9BD10D9;
sudo rm /etc/apt/sources.list.d/zulip.list;
fi

# Get the root user
if [ $SUDO_USER ];
then getSudoUser=$SUDO_USER;
else getSudoUser=`whoami`;
fi

# Get the path for Zulip's desktop entry which is created by auto-launch script
getDesktopEntry=/home/$getSudoUser/.config/autostart/zulip.desktop;

# Remove desktop entry if exists
if [ -f $getDesktopEntry ]; then
sudo rm $getDesktopEntry;
fi

0 comments on commit a1d5a35

Please sign in to comment.