Created
February 12, 2017 00:48
-
-
Save waghcwb/7a32dfa8848b2bbbb93092935bd3f946 to your computer and use it in GitHub Desktop.
Remove default search engines from Opera (Ubuntu)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
ERROR_REMOVING_OPERA_SEARCH_ENGINE="Error while removing Opera (Linux) default search engine."; | |
OPERA_CONFIG_FOLDER="${HOME}/.config/opera"; | |
OPERA_INSTALLATION_FOLDER="/usr/lib/x86_64-linux-gnu/opera"; | |
BACKUP_PARTNER_JSON=true; | |
init() | |
{ | |
if [[ ${EUID} -ne 0 ]]; then | |
LOG "You must be root"; | |
exit 1; | |
fi | |
} | |
main() | |
{ | |
default_partner_json_filename="default_partner_content.json"; | |
default_partner_json_location="${OPERA_CONFIG_FOLDER}/${default_partner_json_filename}"; | |
site_prefs_json_filename="siteprefs.json"; | |
site_prefs_json_location="${OPERA_CONFIG_FOLDER}/${site_prefs_json_filename}"; | |
if [[ BACKUP_PARTNER_JSON -eq true ]]; then | |
mv ${default_partner_json_location} ${default_partner_json_location}.backup; | |
fi | |
cp ${site_prefs_json_location} ${default_partner_json_location}; | |
chmod 0444 ${default_partner_json_location} | |
cp ${default_partner_json_location} "${OPERA_INSTALLATION_FOLDER}/resources/${default_partner_json_filename}"; | |
cp ${site_prefs_json_location} "${OPERA_INSTALLATION_FOLDER}/resources/${site_prefs_json_filename}"; | |
} | |
exit_program() | |
{ | |
exit; | |
} | |
LOG() | |
{ | |
PATH=$0; | |
MESSAGE=$1; | |
echo "[!]" ${MESSAGE}; | |
} | |
( init && main && exit_program ) || ( LOG ${ERROR_REMOVING_OPERA_SEARCH_ENGINE} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment