ShadowFox/scripts/remove_UUIDs.sh

27 lines
1.1 KiB
Bash
Raw Normal View History

2018-03-11 21:58:02 +00:00
#!/bin/bash
## Mac
## removes UUIDs found in internal_UUIDs.txt in their corresponding file in userContent-files/webextension-tweaks
## designed for users using userContent_imports.css
## entries in internal_UUIDs.txt should take on the following format: webextension_name_UUID=INTERNAL_UUID
## author: @overdodactyl
## version: 1.0
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}")" && cd ..
## 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"
webextension_name=${array[0]%_UUID}
sed -i '' "s/${array[1]}/${array[0]}/" "css/userContent-files/webextension-tweaks/${webextension_name}.css"
done < "internal_UUIDs.txt"