-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstop.sh
More file actions
executable file
·39 lines (32 loc) · 1.28 KB
/
Copy pathstop.sh
File metadata and controls
executable file
·39 lines (32 loc) · 1.28 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
#!/bin/bash
# Reverts everything start.sh changed: hosts entry, CA trust, running server.
cd "$(dirname "$0")"
[ "$(id -u)" = "0" ] || { echo "run with sudo: sudo ./stop.sh"; exit 1; }
MARK_BEGIN="# >>> 8bitdo local flash >>>"
MARK_END="# <<< 8bitdo local flash <<<"
pkill -f "server.py" 2>/dev/null && echo "stopped local server" || true
if grep -q "$MARK_BEGIN" /etc/hosts; then
sed -i '' "/$MARK_BEGIN/,/$MARK_END/d" /etc/hosts
echo "removed hosts redirect"
fi
if [ -f ca.crt ]; then
security remove-trusted-cert -d ca.crt 2>/dev/null || true
security delete-certificate -c "8BitDo Local Flash CA" /Library/Keychains/System.keychain 2>/dev/null || true
echo "removed local CA"
fi
dscacheutil -flushcache 2>/dev/null || true
killall -HUP mDNSResponder 2>/dev/null || true
killall nsurlsessiond 2>/dev/null || true
echo
echo "verifying:"
if grep -q "8bitdo" /etc/hosts 2>/dev/null; then
echo " WARNING: /etc/hosts still contains an 8bitdo entry"
else
echo " /etc/hosts clean"
fi
if security find-certificate -c "8BitDo Local Flash CA" /Library/Keychains/System.keychain >/dev/null 2>&1; then
echo " WARNING: CA still present in System keychain"
else
echo " System keychain clean"
fi
echo " support.8bitdo.com -> $(dig +short support.8bitdo.com | head -1) (should not be 127.0.0.1)"