Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create install script #81

Open
wants to merge 53 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
a1e88f8
create install script
DanielSGH Feb 9, 2023
41ac13d
add variables to top for easy configuration
DanielSGH Feb 9, 2023
5c028ce
detect profile folder automatically
DanielSGH Feb 9, 2023
58b032a
add uninstall option
DanielSGH Feb 9, 2023
9888aed
edit README.md
DanielSGH Feb 9, 2023
0c341de
clean up and optimize pref-setting method
DanielSGH Feb 10, 2023
bcf1ea1
README.md fix linux/macos install section
DanielSGH Feb 11, 2023
a9cd914
detect if firefox is running
DanielSGH Feb 11, 2023
7e0ba72
check dev edition
DanielSGH Feb 15, 2023
366f9a9
check if firefox running before uninstall
DanielSGH Feb 15, 2023
8779076
add windows install.ps1
DanielSGH Feb 16, 2023
3d5d7a9
Merge branch 'bmFtZQ:main' into create-install-script
DanielSGH Feb 16, 2023
77a7866
*nix: MacOS fixes, better active profile assumptions, colors
DanielSGH Feb 16, 2023
ce08109
Windows: add same check method for active profile
DanielSGH Feb 16, 2023
240b302
Update README.md for Windows users
DanielSGH Feb 17, 2023
ce32c02
Merge branch 'main' into create-install-script
DanielSGH Dec 23, 2023
5c280b8
unpack repo tarball, add optional tweaks support, fix macOS issues, r…
DanielSGH Dec 24, 2023
55869dc
add easier (un)installation instructions in README.md
DanielSGH Dec 25, 2023
1e646e6
append user.js file (or create it if it doesn't exist) instead of ove…
DanielSGH Dec 25, 2023
038ecf7
Merge branch 'bmFtZQ:main' into create-install-script
DanielSGH Dec 25, 2023
82c9592
Merge branch 'bmFtZQ:main' into create-install-script
DanielSGH Dec 26, 2023
2df1f9a
Windows: made equivalent to linux bash script + uninstall removes use…
DanielSGH Dec 26, 2023
f1e020b
fix bug: Tee-Object produced poorly encoded text
DanielSGH Dec 26, 2023
3c6b806
change install instructions for windows powershell
DanielSGH Dec 26, 2023
3904b78
Linux: when uninstalling, user.js lines are removed, not the whole file.
DanielSGH Dec 26, 2023
6e7237d
Linux: add reviewing of settings before removal from user.js in unins…
DanielSGH Dec 27, 2023
34ed2b3
Windows: add reviewing of settings before removal from user.js in uni…
DanielSGH Dec 27, 2023
83de61c
Remove comments from README.md install instructions
DanielSGH Dec 28, 2023
e554a3d
add quotes to macOS FIREFOX_DIR path
DanielSGH Dec 28, 2023
beba1e3
use mktemp to manage temporary directory
DanielSGH Dec 28, 2023
35a56ff
create ask_question function to simplify code
DanielSGH Dec 29, 2023
17f27f2
Windows: remove error message for Copy-Item and Remove-Item
DanielSGH Dec 29, 2023
36ca23d
Windows: add ask_question function
DanielSGH Dec 29, 2023
24a8a7b
Windows: System.IO fix for appending, append_to_file function, defaul…
DanielSGH Dec 29, 2023
e8eaba6
Linux: set default option to 'yes' in uninstall
DanielSGH Dec 29, 2023
85b7be3
Merge branch 'bmFtZQ:main' into create-install-script
DanielSGH Dec 29, 2023
bf54faf
Linux: revert delete_pref to use regex again
DanielSGH Dec 29, 2023
723cbd8
Linux: optionally delete_pref in prefs.js too, don't add user pref if…
DanielSGH Dec 30, 2023
73ba064
Windows: add option to remove prefs from prefs.js too and create backups
DanielSGH Dec 30, 2023
8142087
Windows: revert append_to_file function
DanielSGH Dec 30, 2023
f1a1894
Windows: don't add user preff if already exists in user.js
DanielSGH Dec 30, 2023
49a4f16
Windows: fix error with Contains() when user.js doesn't exist
DanielSGH Dec 31, 2023
272b2c2
Windows: remove macOS pref from OPTIONALS array
DanielSGH Dec 31, 2023
f15ab72
Linux: remove 'tee' command from installation process
DanielSGH Dec 31, 2023
a90eb56
Linux: add quotes around PROFILE_ROOTDIR variables
DanielSGH Dec 31, 2023
635e88a
Linux: remove grep error messages, fix reset_all variable
DanielSGH Dec 31, 2023
67e9fbd
remove bash 3.2 dependency from uninstall process
DanielSGH Dec 31, 2023
7bbe534
add portable version of sed
DanielSGH Dec 31, 2023
c078f2f
only ask to remove optional pref if exists
DanielSGH Dec 31, 2023
fc5f89e
Windows: only ask to remove optional pref if exists
DanielSGH Dec 31, 2023
6eec232
Linux: add to_lowercase function
DanielSGH Dec 31, 2023
16f7235
Merge branch 'bmFtZQ:main' into create-install-script
DanielSGH Jan 9, 2024
73d11c0
Merge branch 'bmFtZQ:main' into create-install-script
DanielSGH Jan 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ A Firefox userChrome.css theme that aims to recreate the look and feel of the Ch
<img src="screenshots/thumbnail.png" alt="thumbnail screenshot" title="Screenshot taken with macOS Monterey / Firefox Nightly 96.0a1 (2021-11-30)" width="800">

## How to install
### Via Linux and MacOS shell script
DanielSGH marked this conversation as resolved.
Show resolved Hide resolved
Paste this into your terminal emulator:
```sh
DanielSGH marked this conversation as resolved.
Show resolved Hide resolved
# Linux may not have $TMPDIR set by default
if [ -z $TMPDIR ]; then TMPDIR=/tmp; fi;

curl https://raw.githubusercontent.com/bmFtZQ/edge-frfox/blob/main/install.sh > $TMPDIR/installer.sh && chmod +x $TMPDIR/installer.sh && sh $TMPDIR/installer.sh
DanielSGH marked this conversation as resolved.
Show resolved Hide resolved
```

Uninstallation can be done by just writing `uninstall` at the end of the script above

### Manual Installation
1. Go to `about:support` and click the "Open Folder/Show in Finder" button for the root directory of your browser profile/s.
2. Download and copy the `chrome` folder into the profile folder.
3. Go to about:config and change these preferences:
Expand Down
97 changes: 97 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/bin/bash

# VARIABLES, CHANGE AS NEEDED
GITHUB_REPO="https://github.com/bmFtZQ/edge-frfox.git"
PROFILE_ROOTDIR=~/.mozilla/firefox/$(grep Default= ~/.mozilla/firefox/installs.ini | tail -1 | cut -c 9-);
CHANGED_PREFS=("toolkit.legacyUserProfileCustomizations.stylesheets" "svg.context-properties.content.enabled" "layout.css.color-mix.enabled")

# UTILITY FUNCTIONS
set_pref() {
echo "setting $1 to $2 in prefs.js";
echo "user_pref(\"$1\", $2);" >> $PROFILE_ROOTDIR/prefs.js;
}

delete_pref() {
echo "resetting $1 to default"
sed -i "/user_pref(\"$1\", \(true\|false\));/d" $PROFILE_ROOTDIR/prefs.js;
}

#####################
# PRE-INSTALL PHASE #
#####################

# Check if issued `./installer.sh uninstall`
if [[ $1 == "uninstall" ]]; then
echo "Warning: the following command will delete said folder and wipe out everything in its sub-directories"
rm -rfi $PROFILE_ROOTDIR/chrome;
echo "uninstalling...";
for pref in ${CHANGED_PREFS[@]}; do
delete_pref $pref;
done;

echo "uninstall complete."
exit 0;
fi

echo "Detecting if firefox is installed on your system..."
if [ ! -f /usr/bin/firefox ] || { [ ! -f /usr/lib/firefox/firefox ]; }; then
echo "ERROR: firefox not found..."

ans="y"
read -e -i "$ans" -p "Do you want to continue anyway? (y/n): " in
ans="${in:-$ans}";

if [[ ! ${ans,,} =~ ^(yes|y)$ ]]; then
exit 0;
fi
fi

git --version 2>&1 > /dev/null;
if [ ! $? -eq 0 ]; then
echo "ERROR: git is not installed... Please install it."
exit 0;
fi

# Prompting for correct install directory
read -e -i "$PROFILE_ROOTDIR" -p "Enter profile root directory: " newdir
PROFILE_ROOTDIR="${newdir:-$PROFILE_ROOTDIR}"

if [ ! -d "$PROFILE_ROOTDIR" ]; then
echo "ERROR: firefox profile directory could not be found"

while [ ! -d "$PROFILE_ROOTDIR" ]; do
read -p "Enter active root directory found in \"about:profiles\" here: " PROFILE_ROOTDIR;

if [ ! -d "$PROFILE_ROOTDIR" ]; then
echo "invalid directory: specified location does not exist. Try again..."
fi
done;
fi

#################
# INSTALL PHASE #
#################

echo "Installing..."
if [ ! -d ~/github/edge-frfox ]; then
echo "cloning repository";
if ! git clone $GITHUB_REPO ~/github/edge-frfox; then
echo "Error while cloning repository into ~/github/edge-frfox..."
exit 0;
fi
fi

echo "Copying theme folder..."
cp -r ~/github/edge-frfox/chrome "$PROFILE_ROOTDIR"

# firefox will automatically sort out any duplicate issues, whatever is at the end of the file takes priority, so this works.
echo "Adding necessary configs..."
for pref in ${CHANGED_PREFS[@]}; do
DanielSGH marked this conversation as resolved.
Show resolved Hide resolved
set_pref $pref "true"
done;

if [[ $OSTYPE == "darwin"* ]]; then
set_pref "widget.macos.native-context-menus" "false"
DanielSGH marked this conversation as resolved.
Show resolved Hide resolved
fi

echo "Finished successfully! Please (re)start firefox to see the changes.";