-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
752b80d
commit 6cf35c6
Showing
1 changed file
with
51 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,55 @@ | ||
# /bin/bash | ||
#!/bin/bash | ||
|
||
# Function to display messages in red and exit | ||
die() { | ||
echo -e "\033[91m$1\033[0m" >&2 | ||
exit 1 | ||
} | ||
|
||
# Testing if root... | ||
if [ $UID -ne 0 ] | ||
then | ||
RED "You must run this script as root!" && echo | ||
exit | ||
testRoot() { | ||
if [ $UID -ne 0 ] ; then | ||
die "You must run this script as root" | ||
fi | ||
} | ||
|
||
# Check if config_dir exists | ||
checkInstall() { | ||
if [ ! -d "$config_dir" ]; then | ||
die "The specified Firefox directory does not exist. Firefox may not be installed or not in the default directory." | ||
fi | ||
} | ||
|
||
testRoot | ||
|
||
# Define the directories | ||
if [ `uname -s` = "Darwin" ] ; then | ||
# For macos - firefox 124.0.2 | ||
preferences_dir="/Applications/Firefox.app/Contents/Resources/defaults/pref/" | ||
config_dir="/Applications/Firefox.app/Contents/Resources/" | ||
|
||
checkInstall | ||
|
||
rm /Library/Preferences/org.mozilla.firefox.plist | ||
defaults import /Library/Preferences/org.mozilla.firefox ./Files/distribution/org.mozilla.firefox.plist | ||
|
||
else | ||
# For linux | ||
config_dir="/lib/firefox/" | ||
preferences_dir="/lib/firefox/browser/defaults/preferences/" | ||
|
||
checkInstall | ||
|
||
distribution_dir="/lib/firefox/distribution/" | ||
mkdir -p "$distribution_dir" | ||
cp ./Files/distribution/policies.json "$distribution_dir" | ||
|
||
fi | ||
|
||
mkdir -p /lib/firefox/browser/defaults/preferences/ | ||
mkdir -p /lib/firefox/distribution/extensions/ | ||
cp ./Files/browser/defaults/preferences/* /lib/firefox/browser/defaults/preferences/* | ||
cp ./Files/distribution/extensions/* /lib/firefox/distribution/extensions/* | ||
cp ./Files/browser/distribution/* /lib/firefox/distribution/* | ||
# Create directories if they don't exist | ||
mkdir -p "$preferences_dir" | ||
mkdir -p "$extensions_dir" | ||
|
||
# Copy files to the directories | ||
cp ./Files/Config/mozilla.cfg "$config_dir" | ||
cp -r ./Files/Config/browser/defaults/preferences/* "$preferences_dir" |