Skip to content

Commit

Permalink
checking folder existence
Browse files Browse the repository at this point in the history
  • Loading branch information
Paolo Minniti committed Nov 1, 2017
1 parent acc31be commit f7b56ee
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
6 changes: 5 additions & 1 deletion install
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ logvolume_bool="stopchime_logvolume_bool"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# administrative privileges
if [ "$(id -u)" != "0" ]; then
if [ "$(id -u)" != "0" ]

then

printf "You need administrative privileges to run this script.\nPlease run: sudo bash install\n"
exit 1

fi

# create installation folder if it doesn't already exists.
Expand Down
34 changes: 22 additions & 12 deletions uninstall
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,29 @@ logouth="stopchime_logout"
logvolume_int="stopchime_logvolume_int"
logvolume_bool="stopchime_logvolume_bool"

printf "Removing hooks: '$logouth' and '$loginh'\n"
if [ -d "$install_folder" ]

# removing login and logout hooks
defaults delete com.apple.loginwindow LoginHook
defaults delete com.apple.loginwindow LogoutHook
then

printf "Deleting files from '$install_folder'\n"
printf "Scripts found\n"

# deleting login, logout and logvolume scripts
rm "$install_folder$loginh"
rm "$install_folder$logouth"
rm "$install_folder$logvolume_int"
rm "$install_folder$logvolume_bool"
rmdir "$install_folder"
printf "Removing hooks: '$logouth' and '$loginh'\n"

printf "Done! Uninstallation terminated\n"
# removing login and logout hooks
defaults delete com.apple.loginwindow LoginHook
defaults delete com.apple.loginwindow LogoutHook

printf "Deleting files from '$install_folder'\n"

# deleting login, logout and logvolume scripts
rm "$install_folder$loginh"
rm "$install_folder$logouth"
rm "$install_folder$logvolume_int"
rm "$install_folder$logvolume_bool"
rmdir "$install_folder"

printf "Done! Uninstallation terminated\n"

else
echo "Scripts NOT found"
fi

0 comments on commit f7b56ee

Please sign in to comment.