install.sh update

This commit is contained in:
Gerome Matilla 2020-07-08 16:11:11 +08:00
parent 2e25f384b5
commit ff1d243b16

View File

@ -1,39 +1,41 @@
#!/usr/bin/env bash #!/usr/bin/env bash
message() { printf "%s\n" "$*" >&2; } message() {
printf "%s\n" "$*" >&2;
}
download_bf() { download_bf() {
message "[>>] Downloading theme..." message "[>>] Downloading theme..."
curl -LJ0 https://github.com/manilarome/blurredfox/archive/master.tar.gz | tar -xz -C /tmp/ curl -LJ0 https://github.com/manilarome/blurredfox/archive/master.tar.gz | tar -xz -C /tmp/
if [[ $? -eq 0 ]]; if [[ $? -eq 0 ]];
then then
message "[>>] Copying..." message "[>>] Copying..."
FF_THEME="/tmp/blurredfox-master/" FF_THEME="/tmp/blurredfox-master/"
cp -r "${FF_THEME}"* "${CHROME_DIRECTORY}" cp -r "${FF_THEME}"* "${CHROME_DIRECTORY}"
cat > "${CHROME_DIRECTORY}/../user.js" <<'EOL' cat > "${CHROME_DIRECTORY}/../user.js" <<'EOL'
user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true); user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true);
user_pref("layers.acceleration.force-enabled", true); user_pref("layers.acceleration.force-enabled", true);
user_pref("gfx.webrender.all", true); user_pref("gfx.webrender.all", true);
user_pref("gfx.webrender.enabled", true); user_pref("gfx.webrender.enabled", true);
user_pref("svg.context-properties.content.enabled", true); user_pref("svg.context-properties.content.enabled", true);
EOL EOL
if [[ $? -eq 0 ]]; if [[ $? -eq 0 ]];
then then
rm -rf "/tmp/blurredfox-master" rm -rf "/tmp/blurredfox-master"
else else
message " [!!] There was a problem while copying the files. Terminating..." message " [!!] There was a problem while copying the files. Terminating..."
return 1 return 1
fi fi
else else
message " [!!] Problem detected while downloading the theme. Terminating..." message " [!!] Problem detected while downloading the theme. Terminating..."
return 1 return 1
fi fi
cat <<-'EOF' cat <<-'EOF'
░█▀▄░█░░░█░█░█▀▄░█▀▄░█▀▀░█▀▄ ░█▀▄░█░░░█░█░█▀▄░█▀▄░█▀▀░█▀▄
░█▀▄░█░░░█░█░█▀▄░█▀▄░█▀▀░█░█ ░█▀▄░█░░░█░█░█▀▄░█▀▄░█▀▀░█░█
░▀▀░░▀▀▀░▀▀▀░▀░▀░▀░▀░▀▀▀░▀▀░ ░▀▀░░▀▀▀░▀▀▀░▀░▀░▀░▀░▀▀▀░▀▀░
@ -41,52 +43,44 @@ EOL
┏━┛┃ ┃ ┛ ┏━┛┃ ┃ ┛
┛ ━━┛┛ ┛ ┛ ━━┛┛ ┛
EOF EOF
message "blurredfox successfully installed! To enable the transparency change the theme to Dark in preferences! Enjoy!" message "blurredfox successfully installed! To enable the transparency change the theme to Dark in preferences! Enjoy!"
} }
FF_USER_DIRECTORY="$(find "${HOME}/.mozilla/firefox/" -maxdepth 1 -type d -regextype egrep -regex '.*[a-zA-Z0-9]+.default-(release|default|esr)')"
FF_USER_DIRECTORY="$(find "${HOME}/.mozilla/firefox/" -maxdepth 1 -type d -regextype egrep -regex '.*[a-zA-Z0-9]+.default-(release|default)')"
if [[ -n $FF_USER_DIRECTORY ]]; if [[ -n $FF_USER_DIRECTORY ]];
then then
message "[>>] Firefox user profile directory located..." message "[>>] Firefox user profile directory located..."
CHROME_DIRECTORY="$(find "$FF_USER_DIRECTORY" -maxdepth 1 -type d -name 'chrome')"
if [[ -n $CHROME_DIRECTORY ]];
then
# Check if the chrome folder contains files
shopt -s nullglob dotglob
content="${CHROME_DIRECTORY}/"
CHROME_DIRECTORY="$(find "$FF_USER_DIRECTORY" -maxdepth 1 -type d -name 'chrome')" # If there's a current theme, make a backup
if [ ${#content[@]} -gt 0 ];
then
message "[>>] Current chrome folder is not empty. Creating a backup in the same directory..."
mv "${CHROME_DIRECTORY}" "${CHROME_DIRECTORY}.backup"
mkdir "${CHROME_DIRECTORY}"
fi
download_bf
else
message "[>>] Chrome directory does not exist! Creating one..."
mkdir "${FF_USER_DIRECTORY}/chrome"
if [[ -n $CHROME_DIRECTORY ]]; if [[ $? -eq 0 ]];
then then
CHROME_DIRECTORY="${FF_USER_DIRECTORY}/chrome"
# Check if the chrome folder contains files
shopt -s nullglob dotglob download_bf
content="${CHROME_DIRECTORY}/" else
message "[!!] There was a problem creating the directory. Terminating..."
# If there's a current theme, make a backup exit 1;
if [ ${#content[@]} -gt 0 ]; fi
then fi
message "[>>] Current chrome folder is not empty. Creating a backup in the same directory..."
mv "${CHROME_DIRECTORY}" "${CHROME_DIRECTORY}.backup"
mkdir "${CHROME_DIRECTORY}"
fi
download_bf
else
message "[>>] Chrome directory does not exist! Creating one..."
mkdir "${FF_USER_DIRECTORY}/chrome"
if [[ $? -eq 0 ]];
then
CHROME_DIRECTORY="${FF_USER_DIRECTORY}/chrome"
download_bf
else
message "[!!] There was a problem creating the directory. Terminating..."
exit 1;
fi
fi
else else
message "[!!] No firefox user profile directory found. Make sure to run firefox atleast once! Terminating..." message "[!!] No firefox user profile directory found. Make sure to run firefox atleast once! Terminating..."
exit 1; exit 1;
fi fi