diff --git a/CMakeLists.txt b/CMakeLists.txt index 5382a5e7..ba27a8a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -598,6 +598,8 @@ elseif(UNIX) if(APPLE) install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") + + install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/misc/uninstall_pkg.sh" DESTINATION "${SUNSHINE_ASSETS_DIR}") else() install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}") install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}") diff --git a/src_assets/macos/misc/uninstall_pkg.sh b/src_assets/macos/misc/uninstall_pkg.sh new file mode 100644 index 00000000..8cc7f62c --- /dev/null +++ b/src_assets/macos/misc/uninstall_pkg.sh @@ -0,0 +1,39 @@ +#!/bin/bash -e +set -e + +FILES=(pkgutil --files org.macports.Sunshine) + +remove_config=True +remove_apps=True + +for n in {1..2}; do + echo "Loop: $n" + for file in "${FILES[@]}"; do + if [[ $file == *sunshine.conf ]]; then + if [ $remove_config == True ]; then + while true; do + read -p -r "Do you wish to remove 'sunshine.conf'?" yn + case $yn in + [Yy]* ) rm --force "$file"; break;; + [Nn]* ) remove_config=False; break;; + * ) echo "Please answer yes or no.";; + esac + done + fi + fi + if [[ $file == *apps.json ]]; then + if [ $remove_apps == True ]; then + while true; do + read -p -r "Do you wish to remove 'apps.conf'?" yn + case $yn in + [Yy]* ) rm --force "$file"; break;; + [Nn]* ) remove_apps=False; break;; + * ) echo "Please answer yes or no.";; + esac + done + fi + fi + + rm --force --dir "$file" + done +done