mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-02-21 00:39:59 +00:00
Fix removing directories for macos uninstall_pkg
This commit is contained in:
parent
46dede3381
commit
25e21ee807
@ -4,7 +4,7 @@ set -e
|
|||||||
package_name=org.macports.Sunshine
|
package_name=org.macports.Sunshine
|
||||||
|
|
||||||
echo "Removing files now..."
|
echo "Removing files now..."
|
||||||
FILES=$(pkgutil --files --only-files $package_name)
|
FILES=$(pkgutil --files $package_name --only-files)
|
||||||
|
|
||||||
remove_config=True
|
remove_config=True
|
||||||
remove_apps=True
|
remove_apps=True
|
||||||
@ -44,12 +44,22 @@ for file in ${FILES}; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo "Removing directories now..."
|
echo "Removing directories now..."
|
||||||
DIRECTORIES=$(pkgutil --files --only-dirs org.macports.Sunshine)
|
DIRECTORIES=$(pkgutil --files org.macports.Sunshine --only-dirs)
|
||||||
|
|
||||||
for dir in ${DIRECTORIES}; do
|
for dir in ${DIRECTORIES}; do
|
||||||
dir="/$dir"
|
dir="/$dir"
|
||||||
echo "Checking if empty directory: $dir"
|
echo "Checking if empty directory: $dir"
|
||||||
find "$dir" -type d -empty -exec rm -f -d {} \;
|
|
||||||
|
# check if directory is empty... could just use ${DIRECTORIES} here if pkgutils added the `/` prefix
|
||||||
|
empty_dir=$(find "$dir" -depth 0 -type d -empty)
|
||||||
|
|
||||||
|
# remove the directory if it is empty
|
||||||
|
if [[ $empty_dir != "" ]]; then # prevent the loop from running and failing if no directories found
|
||||||
|
for i in "${empty_dir}"; do # don't split words as we already know this will be a single directory
|
||||||
|
echo "Removing empty directory: ${i}"
|
||||||
|
rmdir "${i}"
|
||||||
|
done
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Forgetting Sunshine..."
|
echo "Forgetting Sunshine..."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user