-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·47 lines (39 loc) · 1.78 KB
/
Copy pathuninstall.sh
File metadata and controls
executable file
·47 lines (39 loc) · 1.78 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
#!/usr/bin/env bash
# ==============================================================================
# Binkterm Echo Area Button Mod - Uninstaller
# https://github.com/thewebexpert/binkterm-php-echoButtonMod
# ==============================================================================
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TARGET_DIR="${1:-$(cd "$SCRIPT_DIR/.." && pwd)}"
if [ -d "$SCRIPT_DIR/public_html" ] && [ -d "$TARGET_DIR/binkterm" ]; then
TARGET_DIR="$TARGET_DIR/binkterm"
fi
echo "======================================================"
echo " Uninstalling Binkterm Echo Area Button Mod"
echo " Target Binkterm Directory: $TARGET_DIR"
echo "======================================================"
# Remove assets
if [ -f "$TARGET_DIR/public_html/js/echo-filter.js" ]; then
rm -f "$TARGET_DIR/public_html/js/echo-filter.js"
echo "[✓] Removed public_html/js/echo-filter.js"
fi
if [ -f "$TARGET_DIR/public_html/css/echo-filter.css" ]; then
rm -f "$TARGET_DIR/public_html/css/echo-filter.css"
echo "[✓] Removed public_html/css/echo-filter.css"
fi
HEADER_INSERT="$TARGET_DIR/templates/custom/header.insert.twig"
if [ -f "$HEADER_INSERT" ]; then
CLEANED=$(grep -v "echo-filter" "$HEADER_INSERT" | grep -v "Echo Area Button Mod" | sed '/^[[:space:]]*$/d')
if [ -z "$CLEANED" ]; then
rm -f "$HEADER_INSERT"
echo "[✓] Removed templates/custom/header.insert.twig"
else
grep -v "echo-filter" "$HEADER_INSERT" | grep -v "Echo Area Button Mod" > "${HEADER_INSERT}.tmp"
mv "${HEADER_INSERT}.tmp" "$HEADER_INSERT"
echo "[✓] Removed echo-filter references from templates/custom/header.insert.twig"
fi
fi
echo ""
echo "Uninstallation complete!"
echo "======================================================"