Skip to content

Commit

Permalink
Merge pull request #93 from 7k5x/installer
Browse files Browse the repository at this point in the history
Add installer(Ver 1.5)
  • Loading branch information
black7375 authored Jun 14, 2021
2 parents f20b74a + d928157 commit 35f40be
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 23 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.github export-ignore
/CODE_OF_CONDUCT.md export-ignore
/README.org export-ignore
/README.org export-ignore
18 changes: 18 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
on:
push:
branches:
- master
- photon-style
pull_request:
branches:
- master
name: 'ShellCheck'

jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
1 change: 1 addition & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ W: https://github.com/medhefgo
Contributors

N: 7k5x
E: [email protected]
W: https://github.com/7k5x

N: Burak Yigit Kaya
Expand Down
19 changes: 0 additions & 19 deletions Install.sh

This file was deleted.

8 changes: 6 additions & 2 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
- Size: Fill(Changes dynamically to your size)

** Installation Guide

*** Method 1. Manual installation
1. Download files
- Click the green ":arrow_down: Code"-button above
- Select ":package: Download Zip"
Expand All @@ -79,7 +79,11 @@
- Click the =Clear startup cache...= at the top of =about:support=

If you prefer Photon, see [[https://github.com/black7375/Firefox-UI-Fix/tree/photon-style][Lepton's photon-style]].

*** Method 2. Automatic installation(Currently Linux, MacOS only)
1. Run installer script
- Type =./install.sh= or =sh install.sh= in your terminal and press enter
2. Restart Firefox (Not needed if FireFox is already off)
- Click the =Clear startup cache...= at the top of =about:support=
** WHY Proton?
I think a lot has improved.

Expand Down
107 changes: 107 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#!/usr/bin/env bash
# shellcheck disable=SC2185
function copychrome(){
\cp -f userChrome.css ~/.mozilla/firefox/"$1"/chrome/userChrome.css
\cp -f userContent.css ~/.mozilla/firefox/"$1"/chrome/userContent.css
\cp -f -r icons ~/.mozilla/firefox/"$1"/chrome/
}
function backupchrome(){
if [ -f ~/.mozilla/firefox/"$1"/chrome/userChrome.css ];then
\mv -f ~/.mozilla/firefox/"$1"/chrome/userChrome.css ~/.mozilla/firefox/"$1"/chrome/userChrome.css.bak
\mv -f ~/.mozilla/firefox/"$1"/chrome/userContent.css ~/.mozilla/firefox/"$1"/chrome/userContent.css.bak
fi
cd ~/.mozilla/firefox/"$1"/chrome/icons || exit
if [ -f ~/.mozilla/firefox/"$1"/chrome/icons/bug.svg ];then
for file in *
do
\mv -f "$file" "${file/.svg/.svg.bak}"
done
fi
cd "$wherewasi" || exit
}
function backupjs(){
\mv -f ~/.mozilla/firefox/"$1"/user.js ~/.mozilla/firefox/"$1"/user.js.bak
}
function copyjs(){
\cp -f user.js ~/.mozilla/firefox/"$1"/user.js
}
function doneinstall()
{
echo "Installation finished."
}
function install_lepton(){
if [ -f ~/.mozilla/firefox/"$1"/user.js ]; then
printf "user.js exists. Do you want to make a backup of it?(Y/n): "
read -r
case $REPLY in
[Nn]* ) printf "Overwriting...\n";copyjs "$1";;
* )printf "Making a backup...\n";backupjs "$1";copyjs "$1";;
esac
else
copyjs "$1"
fi
if [ -d "$HOME/.mozilla/firefox/$1/chrome" ]; then
printf "The directory chrome/ exists. Do you want to make a backup of it?(Y/n): "
read -r
case $REPLY in
[Nn]* ) printf "Overwriting...\n";copychrome "$1";doneinstall;;
* )printf "Making a backup...\n";backupchrome "$1";copychrome "$1";doneinstall;;
esac
else
mkdir ~/.mozilla/firefox/"$1"/chrome/
copychrome "$1"
doneinstall
fi
}

function multipleinstall(){
echo "You have more than 1 profile for your install. What will you use? Pick a number."
grep "$1" ~/.mozilla/firefox/profiles.ini | grep 'Default=' | cut -f 2 -d'=' > .installs
cat --number .installs
read -r
profiledir="$(head -"${REPLY}" .installs | tail +"${REPLY}")"
install_lepton "$profiledir"
rm -rf .installs
}

function install_option(){
if [ "$(grep -c "$1" ~/.mozilla/firefox/.folders)" == "1" ]; then
profiledir="$(grep "$1" ~/.mozilla/firefox/profiles.ini | grep 'Default=' | cut -f 2 -d'=')"
install_lepton "$profiledir"
else
multipleinstall "$1"
fi
rm -rf ~/.mozilla/firefox/.folders
}
function askinstall(){
printf "Will you install for ESR, Default, Dev, Nightly?(ESR/Default/Dev/Nightly): "
read -r
case $REPLY in
[Ee][Ss][Rr]) install_option .default-esr;;
[Dd][Ee][Ff][Aa][Uu][Ll][Tt]) install_option .default-release;;
[Dd][Ee][Vv]) install_option .dev-edition-default;;
[Nn][Ii][Gg][Hh][Tt][Ll][Yy]) install_option .default-nightly;;
*) echo "Unspecified.";exit;;
esac
}
wherewasi="$(pwd)"
cd ~/.mozilla/firefox/ || exit
find -maxdepth 1 | cut -f 2 -d"/" | sed -n '1!p' > .folders
cd "$wherewasi" || exit
if [ "$(grep -c "Default=" ~/.mozilla/firefox/installs.ini)" == "1" ]; then
#I have no idea how to sort this out. You fix it please.
if [ "$(grep -c ".dev-edition-default" ~/.mozilla/firefox/.folders)" == "1" ] || [ "$(grep -c ".dev-edition-default" ~/.mozilla/firefox/.folders)" -gt "1" ]; then
install_option .dev-edition-default
elif [ "$(grep -c ".default-release" ~/.mozilla/firefox/.folders)" == "1" ] || [ "$(grep -c ".default-release" ~/.mozilla/firefox/.folders)" -gt "1" ]; then
install_option .default-release
elif [ "$(grep -c ".default-nightly" ~/.mozilla/firefox/.folders)" == "1" ] || [ "$(grep -c ".default-nightly" ~/.mozilla/firefox/.folders)" -gt "1" ]; then
install_option .default-nightly
elif [ "$(grep -c ".default-esr" ~/.mozilla/firefox/.folders)" == "1" ] || [ "$(grep -c ".default-esr" ~/.mozilla/firefox/.folders)" == "1" ]; then
install_option .default-esr
else
echo "No Firefox profile found. Maybe you have never started FireFox. Please run at least 1 time to create a profile."
exit
fi
else
askinstall
fi

0 comments on commit 35f40be

Please sign in to comment.