Zrythm installer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.2 KiB

#!/bin/bash
#Generate application uninstallers for macOS.
#Parameters
DATE=`date +%Y-%m-%d`
TIME=`date +%H:%M:%S`
LOG_PREFIX="[$DATE $TIME]"
#Functions
log_info() {
echo "${LOG_PREFIX}[INFO]" $1
}
log_warn() {
echo "${LOG_PREFIX}[WARN]" $1
}
log_error() {
echo "${LOG_PREFIX}[ERROR]" $1
}
#Check running user
if (( $EUID != 0 )); then
echo "Please run as root."
exit
fi
echo "Welcome to Application Uninstaller"
echo "The following packages will be REMOVED:"
echo " Zrythm-@ZRYTHM_PRODUCT_VERSION@"
while true; do
read -p "Do you wish to continue [Y/n]?" answer
[[ $answer == "y" || $answer == "Y" || $answer == "" ]] && break
[[ $answer == "n" || $answer == "N" ]] && exit 0
echo "Please answer with 'y' or 'n'"
done
#Need to replace these with install preparation script
VERSION=@ZRYTHM_PRODUCT_VERSION@
PRODUCT=Zrythm
echo "Application uninstalling process started"
# remove link to shorcut file
find "/usr/local/bin/" -name "zrythm-@ZRYTHM_PRODUCT_VERSION@" | xargs rm
if [ $? -eq 0 ]
then
echo "[1/5] [DONE] Successfully deleted shortcut links"
else
echo "[1/5] [ERROR] Could not delete shortcut links" >&2
fi
# remove bundled Lv2 plugins
find "/Library/Audio/Plug-Ins/LV2" -name "Zrythm-$VERSION*" | \
xargs rm -rf
if [ $? -eq 0 ]
then
echo "[2/5] [DONE] Successfully deleted bundled plugins"
else
echo "[2/5] [ERROR] Could not delete bundled plugins" >&2
fi
# remove .app
find "/Applications" -name "Zrythm-$VERSION.app" | \
xargs rm -rf
if [ $? -eq 0 ]
then
echo "[3/5] [DONE] Successfully deleted Zrythm.app"
else
echo "[3/5] [ERROR] Could not delete Zrythm.app" >&2
fi
#forget from pkgutil
pkgutil --forget "org.$PRODUCT.$VERSION" > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo "[4/5] [DONE] Successfully deleted application informations"
else
echo "[4/5] [ERROR] Could not delete application informations" >&2
fi
#remove application source distribution
[ -e "/Library/${PRODUCT}/${VERSION}" ] && rm -rf "/Library/${PRODUCT}/${VERSION}"
if [ $? -eq 0 ]
then
echo "[5/5] [DONE] Successfully deleted application"
else
echo "[5/5] [ERROR] Could not delete application" >&2
fi
echo "Application uninstall process finished"
exit 0