#!/bin/bash TARGET="/tmp/$sessionName/Default" SRC_EXTENSIONS="${HOME}/.config/BraveSoftware/Brave-Browser/Default/Extensions/" SRC_CONFIGS="${HOME}/.config/BraveSoftware/Brave-Browser/Default/Local Extension Settings/" extensions=("nngceckbapebfimnlniiiahkandclblb") #list of extensions to be copied REMEMBER="\n##############################################\n#Please restart the browser the first time\n#you create a new session\n#so that the configurations of plugins will be applied\n##############################################\n" if [ "$#" -eq 0 ] then sessionName=dev-session echo -e $REMEMBER else if [ $1 == "-i" ] then if [ "$#" -eq 2 ];then echo -e "{ \"external_update_url\": \"https://clients2.google.com/service/update2/crx\" }" |sudo tee "/usr/share/chromium/extensions/$2.json" > /dev/null exit 1 else echo "wrong count of arguments" exit 1 fi elif [ $1 == "-h" ] then echo -e "script.sh [sessionname]\t creates a new brave session with defaults(unsecure!)\n ${REMEMBER}" echo -e "script.sh -i [id]\t initializes systemwide installation of extension with [id] so that every profile installs the extension on creation" exit 1 else sessionName=$1 fi fi mkdir $TARGET -p for extension in ${extensions[@]}; do echo "ExtensionID: ${extension}" SRC_EXTENSION_WITH_ID="${SRC_EXTENSIONS}/${extension}" echo -e "copy extensions: ${SRC_EXTENSION_WITH_ID} -> ${TARGET}/Extensions/" cp "${SRC_EXTENSION_WITH_ID}" "${TARGET}/Extensions/" -r -P echo -e "copy userdata from extension: ${SRC_CONFIGS}/${extension} -> ${TARGET}/Local Extension Settings/" cp "${SRC_CONFIGS}/${extension}" "${TARGET}/Local Extension Settings/" -r done brave --args --user-data-dir="${HOME}/.sessions/"$sessionName --disable-web-security