summaryrefslogtreecommitdiffstats
path: root/uninstall.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:30:46 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:30:46 +0000
commit0fd136032da867c46316931cf35fc361933ce76d (patch)
treeee1295e4221a722a32b91f0d9bdc41f68731ea1b /uninstall.sh
parentInitial commit. (diff)
downloadpowerline-fonts-0fd136032da867c46316931cf35fc361933ce76d.tar.xz
powerline-fonts-0fd136032da867c46316931cf35fc361933ce76d.zip
Adding upstream version 0~20240322.upstream/0_20240322upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'uninstall.sh')
-rwxr-xr-xuninstall.sh31
1 files changed, 31 insertions, 0 deletions
diff --git a/uninstall.sh b/uninstall.sh
new file mode 100755
index 0000000..36f17e9
--- /dev/null
+++ b/uninstall.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# Set source and target directories
+powerline_fonts_dir="$( cd "$( dirname "$0" )" && pwd )"
+
+# if an argument is given it is used to select which fonts to uninstall
+prefix="$1"
+
+if test "$(uname)" = "Darwin" ; then
+ # MacOS
+ font_dir="$HOME/Library/Fonts"
+else
+ # Linux
+ font_dir="$HOME/.local/share/fonts"
+ if test ! -d "$font_dir" ; then
+ echo "It seems there are no powerline fonts installed on your system. Uninstall not needed."
+ exit 0
+ fi
+fi
+
+# Remove all fonts from user fonts directory
+echo "Removing fonts..."
+find "$powerline_fonts_dir" \( -name "$prefix*.[ot]tf" -or -name "$prefix*.pcf.gz" \) -type f -print0 | xargs -n1 -0 -I % sh -c "rm -f \"\$0/\${1##*/}\"" "$font_dir" %
+
+# Reset font cache on Linux
+if which fc-cache >/dev/null 2>&1 ; then
+ echo "Resetting font cache, this may take a moment..."
+ fc-cache -f "$font_dir"
+fi
+
+echo "Powerline fonts uninstalled from $font_dir"