-
-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathuninstall
More file actions
executable file
·79 lines (68 loc) · 2.29 KB
/
Copy pathuninstall
File metadata and controls
executable file
·79 lines (68 loc) · 2.29 KB
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
73
74
75
76
77
78
79
#!/bin/sh
set -e
printf "Starting uninstallation...\n"
# ---------------------------------------------------------
# Ask for prefix
# ---------------------------------------------------------
printf "Enter the install prefix used during installation (default: /usr/local): "
read PREFIX
PREFIX=${PREFIX:-/usr/local}
# ---------------------------------------------------------
# File list (POSIX array = space-separated variable)
# ---------------------------------------------------------
FILES="
bin/lektra
share/lektra/
share/applications/lektra.desktop
share/icons/hicolor/16x16/apps/lektra.png
share/icons/hicolor/32x32/apps/lektra.png
share/icons/hicolor/48x48/apps/lektra.png
share/icons/hicolor/64x64/apps/lektra.png
share/icons/hicolor/128x128/apps/lektra.png
share/icons/hicolor/256x256/apps/lektra.png
share/icons/hicolor/512x512/apps/lektra.png
share/doc/lektra/tutorial.pdf
share/man/man1/lektra.1
share/man/man1/lektra.1.gz
"
# ---------------------------------------------------------
# Confirm uninstall
# ---------------------------------------------------------
printf "This will remove the following files from $PREFIX:\n"
for file in $FILES; do
printf " - $PREFIX/$file\n"
done
printf "Are you sure you want to uninstall 'lektra' and all associated files? [y/N]: "
read confirm
# default to "n"
[ -z "$confirm" ] && confirm="n"
# lowercase conversion (POSIX way)
confirm=$(printf "%s" "$confirm" | tr 'A-Z' 'a-z')
if [ "$confirm" != "y" ]; then
echo "Cancelling uninstall."
exit 0
fi
# ---------------------------------------------------------
# Check if lektra is installed
# ---------------------------------------------------------
if ! command -v lektra >/dev/null 2>&1; then
echo "lektra is not installed (not found in PATH)."
else
echo "lektra binary found in PATH: $(command -v lektra)"
fi
# ---------------------------------------------------------
# Remove files
# ---------------------------------------------------------
for file in $FILES; do
TARGET="$PREFIX/$file"
if [ -e "$TARGET" ]; then
echo "Removing $TARGET"
rm -rf "$TARGET"
else
echo "Skipping missing: $TARGET"
fi
done
# ---------------------------------------------------------
# Done
# ---------------------------------------------------------
echo "Uninstallation completed."