This repository was archived by the owner on Sep 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup
More file actions
executable file
·214 lines (162 loc) · 8.1 KB
/
Copy pathsetup
File metadata and controls
executable file
·214 lines (162 loc) · 8.1 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#!/bin/bash
# Make sure Firefox is closed, to avoid any issues.
# This uses Kdialog, zenity or notify-send as backup.
# It will need to enforce the closing of Firefox.
SCRIPTPATH="$PWD"
# Check for available dialog tools and execute the corresponding function
if [[ $(command -v kdialog) ]]; then
GUIMETHOD="kdialog"
result=$(kdialog --title "Arkenfox Setup Preparation" --msgbox "Firefox will be closed to avoid data corruption.")
close_firefox
elif [[ $(command -v zenity) ]]; then
GUIMETHID="zenity"
result=$(zenity --question --title "Arkenfox Setup Preparation" --text "Firefox will be closed to avoid data corruption.")
close_firefox
else
GUIMETHOD="notifysend"
notify-send -a "Arkenfox Setup Preparation" "Closing Firefox" "Firefox will close in 15 seconds automatically, to avoid issues with your data."
sleep 10
notify-send -a "Arkenfox Setup Preparation" "Closing Firefox in 5 seconds"
sleep 5
pkill -9 firefox
fi
# ------------- Firefox Version detection ----------
# Which version of Firefox is installed? This sets the base string in the other script
# Leaving out Torbrowser, Librewolf and Mullvad Browser as these are already hardened.
if command -v firefox &>/dev/null; then
notify-send -a "Arkenfox Setup" "Native Firefox detected" "The profile will be installed for your natively installed firefox"
BASEDIR="~/.mozilla/firefox"
RUNCOMMAND="firefox"
notify-send -t 0 -a "Arkenfox Setup" "Systemwide policy installed." "A policy for the whole system is installed, which presets some security and privacy settings. You can view it in '/etc/firefox/policies'."
run0 sh -c '
mkdir -p /etc/firefox/policies
curl -SslL https://raw.githubusercontent.com/boredsquirrel/Arkenfox-softening/refs/heads/main/policies.json -O /etc/firefox/policies/policies.json
'
elif flatpak list --app | grep -q org.mozilla.firefox; then
notify-send -a "Arkenfox Setup" "Flatpak Firefox detected" "The profile will be installed for Firefox installed via Flatpak. Note that until Firefox gets a fork server and a solution like 'zypak' is made for Flatpak Firefox, it has highly restricted process isolation and should not be used." -t 30
BASEDIR="~/.var/app/org.mozilla.firefox/.mozilla/firefox"
RUNCOMMAND="flatpak run org.mozilla.firefox"
elif snap list | grep -q firefox; then
notify-send -a "Arkenfox Setup" "Snap Firefox detected" "The profile will be installed for Firefox installed via Snap."
BASEDIR="~/snap/firefox/current/.mozilla/firefox"
RUNCOMMAND="snap run firefox"
else
notify-send -t 15000 -a "Arkenfox Setup" "Firefox is not installed?" "If you use Librewolf or Mullvad-Browser,\n you dont need this script.\n Otherwise, please file an issue report\! \n Setup cancelled."
exit 1
fi
ARKDIR="$BASEDIR/ARKENFOX"
# ------------ Folder creation --------
cd $BASEDIR
DEFAULTDIR=(*-default-release)
mkdir DO-NOT-REMOVE #the directory to store the vanilla Arkenfox user.js in
mkdir ARKENFOX
cat >DO-NOT-REMOVE/README.txt <<EOF
What is this directory?
It belongs to the "Arkenfox Setup script" and contains the original user.js
To keep things sorted, the Arkenfox repo is cloned here. To restore the original arkenfox, just remove the user-overrides.js
EOF
# ----------- Backup and Copy of Profile folder -------
# Get the name of the default directory (Firefox names these randomly, probably against viruses?)
# Find the file with the name *-default-release
# Copying the currently used profile
notify-send -t 20000 -a "Arkenfox Setup" "Copying your profile folder..." "Your current profile is not changed\!\n You find it in $BASEDIR, named $DEFAULTDIR.\n Run '$RUNCOMMAND -p $DEFAULTDIR' to launch the profile selection."
cp $DEFAULTDIR/* ARKENFOX
sleep 3
# ---------- Install Arkenfox ---------
# set profile folder
cd ARKENFOX
# clone arkenfox
notify-send -a "Arkenfox Setup" "Downloading" "Downloading the config files from the Arkenfox repository: the overrides.js,\nand the updater."
wget "https://raw.githubusercontent.com/arkenfox/user.js/refs/heads/master/user.js"
wget "https://raw.githubusercontent.com/arkenfox/user.js/refs/heads/master/updater.sh"
wget "https://raw.githubusercontent.com/boredsquirrel/Arkenfox-softening/main/user-overrides.js"
notify-send -a "Arkenfox Setup" "Running..." "Running the Arkenfox updater and applying the overrides"
echo "Y" | updater.sh &&
# copy result to parent folder (firefox main user directory)
cp user.js ../$(date +"%Y-%m-%d")_user.js
# -------------- Running Arkenfox ----------
notify-send -t 0 -a "Arkenfox Setup" "Profile setup." "The profile was created and Firefox will start, after 5 seconds it will be closed again."
$RUNCOMMAND -profile "$ARKDIR" &
sleep 5
pkill -9 firefox
notify-send -t 4000 -a "Arkenfox Setup" "Profile created. It should now show up in the profile selector. Otherwise you need to manually create it."
sleep 4
firefox -p
# ------------ Autoupdating script -------
UPDATER="~/.local/bin/arkenfox-updater"
cat >$UPDATER <<EOF
#!/bin/bash
# This script does not much, but update the user.js using the upstream Arkenfox script, using my overrides,
# and copy that result to the profile folder, override the older user.js
# run the arkenfox updater, using the custom overrides
echo "Y" | $ARKDIR/user.js/updater.sh &&\
# backup the user.js
cp -f user.js ../
EOF
chmod +x $UPDATER
# ------------ Setup automatic updates ----------
# Desktop entry creation
wget https://raw.githubusercontent.com/boredsquirrel/Arkenfox-softening/main/arkenfox-icon.png -O ~/.local/share/applications/arkenfox-icon.png
cat >~/.local/share/applications/Update-Arkenfox.desktop <<EOF
[Desktop Entry]
Exec=$ARKDIR/arkenfoxgit/updater.sh
GenericName=Downloads the latest Arkenfox version, applies softening
Icon=$HOME/.local/share/applications/arkenfox-icon.png
Name=Update Arkenfox
EOF
# Profile chooser Desktop Entry
# Some Firefox versions (RPM, Flatpak, ...) may do this automatically, so its useless
# But I like the icon lol
wget https://raw.githubusercontent.com/boredsquirrel/Arkenfox-softening/main/profilechooser-icon.png ~/.local/share/applications/firefox-profilechooser.png
cat >~/.local/share/applications/Update-Arkenfox.desktop <<EOF
[Desktop Entry]
Name=Firefox Profiles
Exec=$RUNCOMMAND -p
GenericName=Select a Firefox Profile
Icon=$HOME/.local/share/applications/firefox-profilechooser.png
EOF
# --------------- Systemd services -----------
mkdir -p ~/.config/systemd/user
# service
cat >~/.config/systemd/user/arkenfox-updater.service <<EOF
[Unit]
Description=Runs the Arkenfox updater, applies your set changes
[Service]
Type=simple
ExecStart=$HOME/.local/bin/arkenfox-updater
Restart=on-failure
RestartSec=60
[Install]
WantedBy=default.target
EOF
# timer
cat >~/.config/systemd/user/arkenfox-updater.timer <<EOF
[Unit]
Description=Run arkenfox-updater every day
[Timer]
OnCalendar=daily
Persistent=true
Wants=network-online.target
[Install]
WantedBy=default.target
EOF
systemctl --user enable arkenfox-updater.service
# ---------- Finish Messages -------
FINISHTEXT="Arkenfox is now set up with default settings.\n\nIt may not suit your needs though.\n\nChange the 'user-overrides.js' in $BASEDIR, do NOT change the user.js to avoid breakage.\n\nThe override is configured to be user-friendly."
ADDONTEXT="Please install NoScript or UBlock-Origin and disable WebGL on all levels:\n\n- Default\n- Trusted\n- Untrusted\n\nYou can enable it manually if Webapps, Games or Maps require it, by changing the sites Javascript setting to 'custom' and enabling WebGL manually.\n\nWhy? WebGL uses your Graphics card, which can be used to track you.\n\nAlternatively you can report a fake value of your GPU using the Addon 'WebGL Fingerprint Defender'."
case "$GUIMETHOD" in
"kdialog")
kdialog --title "Setup finished!" --msgbox "$FINISHTEXT"
kdialog --title "WebGL enabled" --warningyesno "$ADDONTEXT"
;;
"zenity")
zenity --info --title "Setup finished!" --text="$FINISHTEXT"
zenity --warning --title "WebGL enabled" --text "$ADDONTEXT"
;;
"notifysend")
notify-send -t 20000 -a "Setup finished!" "$FINISHTEXT"
sleep 10
notify-send -t 20000 -a "WebGL enabled" "$ADDONTEXT" --urgency=critical
sleep 20
;;
esac