updater scripts for mac and linux
This commit is contained in:
parent
b24e708c7c
commit
550f4594ba
|
@ -1,31 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
### ShadowFox updater for Mac/Linux
|
||||
### ShadowFox updater for Linux
|
||||
## author: @overdodactyl
|
||||
## version: 1.0
|
||||
## version: 1.1
|
||||
|
||||
userChrome="https://raw.githubusercontent.com/overdodactyl/ShadowFox/master/userChrome.css"
|
||||
userContent="https://raw.githubusercontent.com/overdodactyl/ShadowFox/master/userContent.css"
|
||||
|
||||
echo -e "\nThis script should be run from your inside your Firefox profile.\n"
|
||||
echo -e "\nThis script should be run from inside your Firefox profile.\n"
|
||||
|
||||
currdir=$(pwd)
|
||||
|
||||
## get the full path of this script (readlink for Linux, greadlink for Mac with coreutils installed)
|
||||
sfp=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null)
|
||||
|
||||
## fallback for Macs without coreutils
|
||||
## fallback for Macs without coreutils - may cause problems if symbolic links are encountered
|
||||
if [ -z "$sfp" ]; then sfp=${BASH_SOURCE[0]}; fi
|
||||
|
||||
## change directory to the Firefox profile directory
|
||||
cd "$(dirname "${sfp}")"
|
||||
|
||||
## Make chrome directory if it doesn't exist
|
||||
mkdir -p chrome;
|
||||
|
||||
## Move to chrome directory
|
||||
cd chrome;
|
||||
|
||||
echo -e "\nUpdating userContent.css and userChrome.css for Firefox profile:\n$(pwd)\n"
|
||||
|
||||
if [ -e userContent.css ]; then
|
||||
|
@ -44,15 +38,35 @@ read -p "Continue Y/N? " -n 1 -r
|
|||
echo -e "\n\n"
|
||||
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
|
||||
## Make chrome directory if it doesn't exist
|
||||
mkdir -p chrome;
|
||||
|
||||
## Move to chrome directory
|
||||
cd chrome;
|
||||
|
||||
## Make ShadowFox_customization directory if it doesn't exist
|
||||
mkdir -p ShadowFox_customization;
|
||||
|
||||
## Create all customization files if they don't exist
|
||||
touch ./ShadowFox_customization/colorOverrides.css
|
||||
touch ./ShadowFox_customization/internal_UUIDs.txt
|
||||
touch ./ShadowFox_customization/userContent_customization.css
|
||||
touch ./ShadowFox_customization/userChrome_customization.css
|
||||
|
||||
if [ -e userChrome.css ] || [ -e userContent.css ] ; then
|
||||
## Make chrome backups folder if it doesn't extern
|
||||
mkdir -p chrome_backups
|
||||
fi
|
||||
if [ -e userChrome.css ]; then
|
||||
# backup current userChrome.css file
|
||||
bakfile="userChrome.backup.$(date +"%Y-%m-%d_%H%M")"
|
||||
mv userChrome.css "${bakfile}" && echo "Your previous userChrome.css file was backed up: ${bakfile}"
|
||||
bakfile="userChrome.backup.$(date +"%Y-%m-%d_%H%M%S")"
|
||||
mv userChrome.css "chrome_backups/${bakfile}" && echo "Your previous userChrome.css file was backed up: ${bakfile}"
|
||||
fi
|
||||
if [ -e userContent.css ]; then
|
||||
# backup current userChrome.css file
|
||||
bakfile="userContent.backup.$(date +"%Y-%m-%d_%H%M")"
|
||||
mv userContent.css "${bakfile}" && echo "Your previous userContent.css file was backed up: ${bakfile}"
|
||||
bakfile="userContent.backup.$(date +"%Y-%m-%d_%H%M%S")"
|
||||
mv userContent.css "chrome_backups/${bakfile}" && echo "Your previous userContent.css file was backed up: ${bakfile}"
|
||||
fi
|
||||
|
||||
# download latest ShadowFox userChrome.css
|
||||
|
@ -63,36 +77,57 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
|
|||
echo -e "\ndownloading latest ShadowFox userContent.css file\n"
|
||||
curl -O ${userContent} && echo "ShadowFox userContent.css has been downloaded"
|
||||
|
||||
if [ -s ./ShadowFox_customization/internal_UUIDs.txt ]; then
|
||||
## Insert any UUIDs defined in internal_UUIDs.txt into userContent.css
|
||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||
IFS='=' read -r -a array <<< "$line"
|
||||
sed -i "s/${array[0]}/${array[1]}/" "userContent.css"
|
||||
done < "./ShadowFox_customization/internal_UUIDs.txt"
|
||||
echo -e "\nYour internal UUIDs have been inserted.\n"
|
||||
else
|
||||
echo -e "\nYou have not defined any internal UUIDs for webextensions.\n"
|
||||
echo -e "\nIf you choose not to do so, webextensions will not be styled with a dark theme and may have compatibility issues in about:addons.\n"
|
||||
echo -e "\nFor more information, see here:\n"
|
||||
echo -e "\nhttps://github.com/overdodactyl/ShadowFox/wiki/Altering-webextensions\n"
|
||||
fi
|
||||
|
||||
if [ -s ./ShadowFox_customization/colorOverrides.css ]; then
|
||||
## Delete everything inbetween override markers
|
||||
sed -i '/\/\*! Begin color overrides \*\//,/\/\*! End color overrides \*\//{//!d;}' userContent.css
|
||||
sed -i '/\/\*! Begin color overrides \*\//,/\/\*! End color overrides \*\//{//!d;}' userChrome.css
|
||||
|
||||
## Insert everything from colorOverrides.css
|
||||
sed -i '/\/\*! Begin color overrides \*\// r ./ShadowFox_customization/colorOverrides.css' userContent.css
|
||||
sed -i '/\/\*! Begin color overrides \*\// r ./ShadowFox_customization/colorOverrides.css' userChrome.css
|
||||
|
||||
echo -e "\nYour custom colors have been set.\n"
|
||||
else
|
||||
echo -e "\nYou are using the default colors set by ShadowFox\n"
|
||||
echo -e "\nYou can customize the colors used by editing colorOverrides.css\n"
|
||||
fi
|
||||
|
||||
if [ -s ./ShadowFox_customization/userContent_customization.css ]; then
|
||||
## Append tweaks to the end of userContent.css
|
||||
cat ./ShadowFox_customization/userContent_customization.css >> userContent.css
|
||||
echo -e "\nYour custom userContent.css tweaks have been applied.\n"
|
||||
else
|
||||
echo -e "\nYou do not have any custom userContent.css tweaks.\n"
|
||||
echo -e "\nYou can customize userContent.css using userContent_customization.css.\n"
|
||||
fi
|
||||
|
||||
if [ -s ./ShadowFox_customization/userChrome_customization.css ]; then
|
||||
## Append tweaks to the end of userContent.css
|
||||
cat ./ShadowFox_customization/userChrome_customization.css >> userChrome.css
|
||||
echo -e "\nYour custom userChrome.css tweaks have been applied.\n"
|
||||
else
|
||||
echo -e "\nYou do not have any custom userChrome.css tweaks.\n"
|
||||
echo -e "\nYou can customize userChrome.css using userChrome_customization.css.\n"
|
||||
fi
|
||||
|
||||
else
|
||||
echo -e "\nProcess aborted\n"
|
||||
fi
|
||||
|
||||
|
||||
## change any color variables here
|
||||
PRIMARY_ACCENT_COLOR="#279f27"
|
||||
PRIMARY_ACCENT_COLOR_DARK="#228b22"
|
||||
PRIMARY_ACCENT_COLOR_DARKEST="#006100"
|
||||
|
||||
sed -i "s/--primary-accent-color: var(--blue-40);/--primary-accent-color: $PRIMARY_ACCENT_COLOR;/" "userChrome.css"
|
||||
sed -i "s/--primary-accent-color: var(--blue-40);/--primary-accent-color: $PRIMARY_ACCENT_COLOR;/" "userContent.css"
|
||||
|
||||
sed -i "s/--primary-accent-color-dark: var(--blue-50);/--primary-accent-color-dark: $PRIMARY_ACCENT_COLOR_DARK;/" "userChrome.css"
|
||||
sed -i "s/--primary-accent-color-dark: var(--blue-50);/--primary-accent-color-dark: $PRIMARY_ACCENT_COLOR_DARK;/" "userContent.css"
|
||||
|
||||
sed -i "s/--primary-accent-color-darkest: var(--blue-60);/--primary-accent-color-darkest: $PRIMARY_ACCENT_COLOR_DARKEST;/" "userChrome.css"
|
||||
sed -i "s/--primary-accent-color-darkest: var(--blue-60);/--primary-accent-color-darkest: $PRIMARY_ACCENT_COLOR_DARKEST;/" "userContent.css"
|
||||
|
||||
|
||||
## change any webextension Internal UUIDs here.
|
||||
## one example is provided
|
||||
|
||||
## Define Internal UUID's for extensions here
|
||||
uMATRIX_INTERNAL_UUID="32818407-cb70-5d40-9f8d-81ed9f2012a6"
|
||||
|
||||
## Replace Ineternal UUID placeholders with variables defined above
|
||||
sed -i "s/9eba7fab-892c-7b42-a57e-b876d4196d70/$uMATRIX_INTERNAL_UUID/" "userContent.css"
|
||||
|
||||
|
||||
|
||||
## change directory back to the original working directory
|
||||
cd "${currdir}"
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
#!/bin/bash
|
||||
|
||||
### ShadowFox updater for Mac
|
||||
## author: @overdodactyl
|
||||
## version: 1.1
|
||||
|
||||
userChrome="https://raw.githubusercontent.com/overdodactyl/ShadowFox/master/userChrome.css"
|
||||
userContent="https://raw.githubusercontent.com/overdodactyl/ShadowFox/master/userContent.css"
|
||||
|
||||
echo "\nThis script should be run from inside your Firefox profile.\n"
|
||||
|
||||
currdir=$(pwd)
|
||||
|
||||
## get the full path of this script (readlink for Linux, greadlink for Mac with coreutils installed)
|
||||
sfp=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null)
|
||||
|
||||
## fallback for Macs without coreutils - may cause problems if symbolic links are encountered
|
||||
if [ -z "$sfp" ]; then sfp=${BASH_SOURCE[0]}; fi
|
||||
|
||||
## change directory to the Firefox profile directory
|
||||
cd "$(dirname "${sfp}")"
|
||||
|
||||
echo "Updating userContent.css and userChrome.css for Firefox profile:\n$(pwd)\n"
|
||||
|
||||
if [ -e userContent.css ]; then
|
||||
echo "Your current userContent.css file for this profile will be backed up and the latest ShadowFox version from github will take its place."
|
||||
else
|
||||
echo "A userContent.css file does not exist in this profile. If you continue, the latest ShadowFox version from github will be downloaded."
|
||||
fi
|
||||
|
||||
if [ -e userChrome.css ]; then
|
||||
echo "Your current userChrome.css file for this profile will be backed up and the latest ShadowFox version from github will take its place.\n"
|
||||
else
|
||||
echo "A userChrome.css file does not exist in this profile. If you continue, the latest ShadowFox version from github will be downloaded.\n"
|
||||
fi
|
||||
|
||||
read -p "Continue Y/N? " -n 1 -r
|
||||
echo "\n\n"
|
||||
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
|
||||
## Make chrome directory if it doesn't exist
|
||||
mkdir -p chrome;
|
||||
|
||||
## Move to chrome directory
|
||||
cd chrome;
|
||||
|
||||
## Make ShadowFox_customization directory if it doesn't exist
|
||||
mkdir -p ShadowFox_customization;
|
||||
|
||||
## Create all customization files if they don't exist
|
||||
touch ./ShadowFox_customization/colorOverrides.css
|
||||
touch ./ShadowFox_customization/internal_UUIDs.txt
|
||||
touch ./ShadowFox_customization/userContent_customization.css
|
||||
touch ./ShadowFox_customization/userChrome_customization.css
|
||||
|
||||
if [ -e userChrome.css ] || [ -e userContent.css ] ; then
|
||||
## Make chrome backups folder if it doesn't extern
|
||||
mkdir -p chrome_backups
|
||||
fi
|
||||
if [ -e userChrome.css ]; then
|
||||
# backup current userChrome.css file
|
||||
bakfile="userChrome.backup.$(date +"%Y-%m-%d_%H%M%S")"
|
||||
mv userChrome.css "chrome_backups/${bakfile}" && echo "Your previous userChrome.css file was backed up: ${bakfile}"
|
||||
fi
|
||||
if [ -e userContent.css ]; then
|
||||
# backup current userChrome.css file
|
||||
bakfile="userContent.backup.$(date +"%Y-%m-%d_%H%M%S")"
|
||||
mv userContent.css "chrome_backups/${bakfile}" && echo "Your previous userContent.css file was backed up: ${bakfile}"
|
||||
fi
|
||||
|
||||
# download latest ShadowFox userChrome.css
|
||||
echo "downloading latest ShadowFox userChrome.css file"
|
||||
curl -O ${userChrome} && echo "\nShadowFox userChrome.css has been downloaded"
|
||||
|
||||
# download latest ShadowFox userContent.css
|
||||
echo "downloading latest ShadowFox userContent.css file"
|
||||
curl -O ${userContent} && echo "\nShadowFox userContent.css has been downloaded\n"
|
||||
|
||||
if [ -s ./ShadowFox_customization/internal_UUIDs.txt ]; then
|
||||
## Insert any UUIDs defined in internal_UUIDs.txt into userContent.css
|
||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||
IFS='=' read -r -a array <<< "$line"
|
||||
sed -i '' "s/${array[0]}/${array[1]}/" "userContent.css"
|
||||
done < "./ShadowFox_customization/internal_UUIDs.txt"
|
||||
echo "Your internal UUIDs have been inserted.\n"
|
||||
else
|
||||
echo "You have not defined any internal UUIDs for webextensions."
|
||||
echo "If you choose not to do so, webextensions will not be styled with a dark theme and may have compatibility issues in about:addons."
|
||||
echo "For more information, see here:"
|
||||
echo "https://github.com/overdodactyl/ShadowFox/wiki/Altering-webextensions\n"
|
||||
fi
|
||||
|
||||
if [ -s ./ShadowFox_customization/colorOverrides.css ]; then
|
||||
## Delete everything inbetween override markers
|
||||
sed -i '' '/\/\*! Begin color overrides \*\//,/\/\*! End color overrides \*\//{//!d;}' userContent.css
|
||||
sed -i '' '/\/\*! Begin color overrides \*\//,/\/\*! End color overrides \*\//{//!d;}' userChrome.css
|
||||
|
||||
## Insert everything from colorOverrides.css
|
||||
sed -i '' '/\/\*! Begin color overrides \*\// r ./ShadowFox_customization/colorOverrides.css' userContent.css
|
||||
sed -i '' '/\/\*! Begin color overrides \*\// r ./ShadowFox_customization/colorOverrides.css' userChrome.css
|
||||
|
||||
echo "Your custom colors have been set.\n"
|
||||
else
|
||||
echo "You are using the default colors set by ShadowFox"
|
||||
echo "You can customize the colors used by editing colorOverrides.css\n"
|
||||
fi
|
||||
|
||||
if [ -s ./ShadowFox_customization/userContent_customization.css ]; then
|
||||
## Append tweaks to the end of userContent.css
|
||||
cat ./ShadowFox_customization/userContent_customization.css >> userContent.css
|
||||
echo "Your custom userContent.css tweaks have been applied.\n"
|
||||
else
|
||||
echo "You do not have any custom userContent.css tweaks."
|
||||
echo "You can customize userContent.css using userContent_customization.css.\n"
|
||||
fi
|
||||
|
||||
if [ -s ./ShadowFox_customization/userChrome_customization.css ]; then
|
||||
## Append tweaks to the end of userContent.css
|
||||
cat ./ShadowFox_customization/userChrome_customization.css >> userChrome.css
|
||||
echo "Your custom userChrome.css tweaks have been applied.\n"
|
||||
else
|
||||
echo "You do not have any custom userChrome.css tweaks."
|
||||
echo "You can customize userChrome.css using userChrome_customization.css.\n"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "Process aborted"
|
||||
fi
|
||||
|
||||
|
||||
## change directory back to the original working directory
|
||||
cd "${currdir}"
|
|
@ -29,21 +29,21 @@
|
|||
|
||||
/* Import Relevant webextension tweaks here
|
||||
* IMPORTANT: If used, change the Internal UUID in the corresponding css file */
|
||||
@import "userContent-files/webextension-tweaks/tree_style_tabs.css";
|
||||
@import "userContent-files/webextension-tweaks/tree_style_tab.css";
|
||||
@import "userContent-files/webextension-tweaks/multiple_tabs_handler.css";
|
||||
@import "userContent-files/webextension-tweaks/dark_mode.css";
|
||||
@import "userContent-files/webextension-tweaks/uBlockOrigin.css";
|
||||
@import "userContent-files/webextension-tweaks/uBO_Scope.css";
|
||||
@import "userContent-files/webextension-tweaks/httpsEverywhere.css";
|
||||
@import "userContent-files/webextension-tweaks/ublock_origin.css";
|
||||
@import "userContent-files/webextension-tweaks/ubo_scope.css";
|
||||
@import "userContent-files/webextension-tweaks/https_everywhere.css";
|
||||
@import "userContent-files/webextension-tweaks/decentraleyes.css";
|
||||
@import "userContent-files/webextension-tweaks/pocket.css";
|
||||
@import "userContent-files/webextension-tweaks/skipredirect.css";
|
||||
@import "userContent-files/webextension-tweaks/skip_redirect.css";
|
||||
@import "userContent-files/webextension-tweaks/request_control.css";
|
||||
@import "userContent-files/webextension-tweaks/multi_account_containers.css";
|
||||
@import "userContent-files/webextension-tweaks/smart_https.css";
|
||||
@import "userContent-files/webextension-tweaks/tab_suspender.css";
|
||||
@import "userContent-files/webextension-tweaks/cookie_autodelete.css";
|
||||
@import "userContent-files/webextension-tweaks/uMatrix.css";
|
||||
@import "userContent-files/webextension-tweaks/umatrix.css";
|
||||
@import "userContent-files/webextension-tweaks/brief.css";
|
||||
@import "userContent-files/webextension-tweaks/vim_vixen.css";
|
||||
@import "userContent-files/webextension-tweaks/neat_url.css";
|
||||
|
|
Loading…
Reference in New Issue