-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.sh
executable file
·72 lines (58 loc) · 2.03 KB
/
uninstall.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
# Uninstall the Nautilus Hash Check Extension
EXT_DIR="$HOME/.local/share/nautilus-python/extensions"
EMBLEMS_DIR="$HOME/.icons/hicolor/48x48/emblems"
ICONS_DIR="$HOME/.icons"
# Remove the extension script
if [ -f "$EXT_DIR/hash_check_emblem.py" ]; then
echo "Removing Nautilus Hash Check script..."
rm -f "$EXT_DIR/hash_check_emblem.py"
else
echo "Nautilus Hash Check script not found in $EXT_DIR."
fi
# Remove the emblem files
if [ -f "$EMBLEMS_DIR/emblem-hash-verified.png" ]; then
echo "Removing emblem-hash-verified PNG..."
rm -f "$EMBLEMS_DIR/emblem-hash-verified.png"
fi
if [ -f "$EMBLEMS_DIR/emblem-hash-verified.icon" ]; then
echo "Removing emblem-hash-verified ICON..."
rm -f "$EMBLEMS_DIR/emblem-hash-verified.icon"
fi
if [ -f "$EMBLEMS_DIR/emblem-hash-verified.png" ]; then
echo "Removing emblem-hash-verified PNG..."
rm -f "$EMBLEMS_DIR/emblem-hash-verified.png"
fi
if [ -f "$EMBLEMS_DIR/emblem-hash-verified.icon" ]; then
echo "Removing emblem-hash-verified ICON..."
rm -f "$EMBLEMS_DIR/emblem-hash-verified.icon"
fi
# Recursive cleanup of empty directories
cleanup_empty_dirs() {
for dir in "$@"; do
find "$dir" -depth -type d -empty -delete
done
}
echo "Cleaning up empty directories..."
cleanup_empty_dirs "$EXT_DIR" "$ICONS_DIR"
echo "Empty directories cleaned up."
# Update the icon cache
if [ -d "$HOME/.icons" ]; then
echo "Updating icon cache..."
gtk-update-icon-cache "$HOME/.icons"
else
echo "Icon directory not found. Skipping icon cache update."
fi
# Notify the user
echo "Uninstallation complete. Please restart Nautilus if it is running."
# Prompt the user to restart Nautilus
read -p "Do you want to restart Nautilus now? [Y/n] " response
response=${response,,} # Convert to lowercase
if [[ "$response" == "y" || "$response" == "" ]]; then
echo "Restarting Nautilus..."
pkill nautilus
nohup nautilus >/dev/null 2>&1 &
echo "Nautilus has been restarted."
else
echo "Please restart Nautilus manually to finalize the uninstallation."
fi