From af853d23ed3415d5ebe9d56f5885dba83a0b1325 Mon Sep 17 00:00:00 2001 From: 7k5x <7k5xlp0onfire@gmail.com> Date: Mon, 14 Jun 2021 13:20:40 +0900 Subject: [PATCH 01/10] Add installer --- Install.sh | 115 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 100 insertions(+), 15 deletions(-) diff --git a/Install.sh b/Install.sh index e87dcfd..8e81a3b 100755 --- a/Install.sh +++ b/Install.sh @@ -1,19 +1,104 @@ -autocopy() { - local file=${1} - local target=${2} - - if [ -e "${target}" ]; then - echo "${target} alreay exist." - echo "Now Backup.." - autocopy "${target}" "${target}.bak" - echo"" +#!/usr/bin/env bash +# shellcheck disable=SC2185 +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/ +} +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 - - cp -v "${file}" "${target}" + 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 +} +backupjs(){ + \mv -f ~/.mozilla/firefox/"$1"/user.js ~/.mozilla/firefox/"$1"/user.js.bak +} +copyjs(){ + \cp -f user.js ~/.mozilla/firefox/"$1"/user.js +} +doneinstall() +{ + echo "Installation finished." +} +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 } -install_lepton() { - local userConfig="user.js" - autocopy "${userConfig}" "../${userConfig}" +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 } -install_lepton + +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 +} +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." + exit + fi +else + 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 +fi From ffab733b0f7ea4122c121387a212a45436e3e5e3 Mon Sep 17 00:00:00 2001 From: 7k5x <7k5xlp0onfire@gmail.com> Date: Mon, 14 Jun 2021 13:21:58 +0900 Subject: [PATCH 02/10] edit .gitattributes since .gitignore does not exist --- .gitattributes | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 498a943..ed814f1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 \ No newline at end of file From 4d9b13bf475142e11d9f37602917ed9bbf865754 Mon Sep 17 00:00:00 2001 From: 7k5x <7k5xlp0onfire@gmail.com> Date: Mon, 14 Jun 2021 13:34:30 +0900 Subject: [PATCH 03/10] function syntax improve, CRLF to LF --- Install.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Install.sh b/Install.sh index 8e81a3b..242d7ff 100755 --- a/Install.sh +++ b/Install.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash # shellcheck disable=SC2185 -copychrome(){ +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/ } -backupchrome(){ +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 @@ -19,17 +19,17 @@ backupchrome(){ fi cd "$wherewasi" || exit } -backupjs(){ +function backupjs(){ \mv -f ~/.mozilla/firefox/"$1"/user.js ~/.mozilla/firefox/"$1"/user.js.bak } -copyjs(){ +function copyjs(){ \cp -f user.js ~/.mozilla/firefox/"$1"/user.js } -doneinstall() +function doneinstall() { echo "Installation finished." } -install_lepton(){ +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 @@ -54,7 +54,7 @@ else fi } -multipleinstall(){ +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 @@ -64,7 +64,7 @@ multipleinstall(){ rm -rf .installs } -install_option(){ +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" From bb56cc350b2f197ba6d559ed4f459834129347a9 Mon Sep 17 00:00:00 2001 From: 7k5x <7k5xlp0onfire@gmail.com> Date: Mon, 14 Jun 2021 13:36:58 +0900 Subject: [PATCH 04/10] Rename Install.sh to install.sh --- Install.sh => install.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Install.sh => install.sh (100%) diff --git a/Install.sh b/install.sh similarity index 100% rename from Install.sh rename to install.sh From 8c68dc6d0211be1baa29d189af4e53f9822114e5 Mon Sep 17 00:00:00 2001 From: 7k5x <7k5xlp0onfire@gmail.com> Date: Mon, 14 Jun 2021 13:48:52 +0900 Subject: [PATCH 05/10] Fix ridiculous error(&& should be ||) --- install.sh | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/install.sh b/install.sh index 242d7ff..639d245 100755 --- a/install.sh +++ b/install.sh @@ -73,25 +73,7 @@ function install_option(){ fi rm -rf ~/.mozilla/firefox/.folders } -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." - exit - fi -else +function askinstall(){ printf "Will you install for ESR, Default, Dev, Nightly?(ESR/Default/Dev/Nightly): " read -r case $REPLY in @@ -101,4 +83,25 @@ else [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 From 6740ab52de5df7efa35516bc1783149de1da7b27 Mon Sep 17 00:00:00 2001 From: 7k5x <7k5xlp0onfire@gmail.com> Date: Mon, 14 Jun 2021 13:53:03 +0900 Subject: [PATCH 06/10] Create shellcheck.yml --- .github/workflows/shellcheck.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/shellcheck.yml diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml new file mode 100644 index 0000000..c1c8c94 --- /dev/null +++ b/.github/workflows/shellcheck.yml @@ -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 From adfa913baadf1ab5774c5ef551d919115111898b Mon Sep 17 00:00:00 2001 From: 7k5x <7k5xlp0onfire@gmail.com> Date: Mon, 14 Jun 2021 13:57:14 +0900 Subject: [PATCH 07/10] Add double quote --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 639d245..ce0f73b 100755 --- a/install.sh +++ b/install.sh @@ -6,12 +6,12 @@ function copychrome(){ \cp -f -r icons ~/.mozilla/firefox/"$1"/chrome/ } function backupchrome(){ - if [ -f ~/.mozilla/firefox/$1/chrome/userChrome.css ];then + 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 + if [ -f ~/.mozilla/firefox/"$1"/chrome/icons/bug.svg ];then for file in * do \mv -f "$file" "${file/.svg/.svg.bak}" @@ -30,7 +30,7 @@ function doneinstall() echo "Installation finished." } function install_lepton(){ -if [ -f ~/.mozilla/firefox/$1/user.js ]; then +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 From 56f82b0e4a567cfacb950772a27c65f671759031 Mon Sep 17 00:00:00 2001 From: 7k5x <7k5xlp0onfire@gmail.com> Date: Mon, 14 Jun 2021 14:06:07 +0900 Subject: [PATCH 08/10] chmod permission --- install.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 install.sh diff --git a/install.sh b/install.sh old mode 100755 new mode 100644 From fa860d6b245ea8bc31e0153ac460563fc45eb68f Mon Sep 17 00:00:00 2001 From: 7k5x <7k5xlp0onfire@gmail.com> Date: Mon, 14 Jun 2021 14:12:14 +0900 Subject: [PATCH 09/10] Add my email --- CREDITS | 1 + 1 file changed, 1 insertion(+) diff --git a/CREDITS b/CREDITS index 7ee9e72..b9a608b 100644 --- a/CREDITS +++ b/CREDITS @@ -66,6 +66,7 @@ W: https://github.com/medhefgo Contributors N: 7k5x +E: 7k5xlp0onfire@gmail.com W: https://github.com/7k5x N: Burak Yigit Kaya From d9281575c26f283383fd490e765d7e43ffdaa8d4 Mon Sep 17 00:00:00 2001 From: 7k5x <7k5xlp0onfire@gmail.com> Date: Mon, 14 Jun 2021 14:37:50 +0900 Subject: [PATCH 10/10] Update README.org --- README.org | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.org b/README.org index 5ab36f1..99d22a8 100644 --- a/README.org +++ b/README.org @@ -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" @@ -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.