forked from gsalucci/firefox-profiles-to-ram
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuninstall.sh
More file actions
executable file
·63 lines (49 loc) · 1.66 KB
/
uninstall.sh
File metadata and controls
executable file
·63 lines (49 loc) · 1.66 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
#!/bin/bash
# Browser to RAM Utils - Uninstaller
set -euo pipefail
if [[ $EUID -eq 0 ]]; then
echo "This script should be run as your normal user, not root."
exit 1
fi
SCRIPT_NAME="browser-to-ram-utils"
SERVICE_NAME="browser-to-ram-utils.service"
INSTALL_BIN_DIR="$HOME/.local/bin"
INSTALL_SERVICE_DIR="$HOME/.config/systemd/user"
PROFILES_HOME="$HOME/.config/mozilla/firefox"
PROFILES_INI="$PROFILES_HOME/profiles.ini"
echo "Uninstalling $SCRIPT_NAME..."
# 1. Stop and Disable Service
if systemctl --user is-active --quiet "$SERVICE_NAME"; then
echo "Stopping service (this will sync profiles to disk)..."
systemctl --user stop "$SERVICE_NAME"
fi
echo "Disabling service..."
systemctl --user disable "$SERVICE_NAME" || true
# 2. Restore Profiles
echo "Restoring profiles to standard disk storage..."
if [[ -f "$PROFILES_INI" ]]; then
grep "^Path=" "$PROFILES_INI" | cut -d'=' -f2 | while read -r path; do
path=$(echo "$path" | xargs)
if [[ "$path" == /* ]]; then
source_path="$path"
else
source_path="$PROFILES_HOME/$path"
fi
disk_path="${source_path}.bak"
if [[ -L "$source_path" ]] && [[ -d "$disk_path" ]]; then
echo "Restoring $source_path..."
rm "$source_path"
mv "$disk_path" "$source_path"
echo "Restored."
fi
done
else
echo "profiles.ini not found. Skipping profile restoration."
fi
# 3. Remove Files
echo "Removing installed files..."
rm -f "$INSTALL_SERVICE_DIR/$SERVICE_NAME"
rm -f "$INSTALL_BIN_DIR/$SCRIPT_NAME"
echo "Reloading systemd..."
systemctl --user daemon-reload
echo "Uninstallation complete."