summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzachir <zachir@librem.one>2025-07-15 21:04:55 -0500
committerzachir <zachir@librem.one>2025-07-15 21:04:55 -0500
commitca62db64baa2b9a8cffcd57155ae7744f4301065 (patch)
tree0de9629880aeb6e859a296bff476777f3ace5f23
parent6a085b3865a575fa669ebd1a957e268e29ff57a2 (diff)
Add brave-profiles script
-rw-r--r--LICENSE-brave-profiles21
-rw-r--r--brave-profiles78
2 files changed, 99 insertions, 0 deletions
diff --git a/LICENSE-brave-profiles b/LICENSE-brave-profiles
new file mode 100644
index 0000000..69dc907
--- /dev/null
+++ b/LICENSE-brave-profiles
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021 equk
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/brave-profiles b/brave-profiles
new file mode 100644
index 0000000..31f805a
--- /dev/null
+++ b/brave-profiles
@@ -0,0 +1,78 @@
+#!/bin/bash
+##
+#*****************************************************************
+# brave-profiles - equk.co.uk
+#*****************************************************************
+#
+# This script was created to simplify and standardize brave configuration
+# across profiles.
+#
+##
+# equk 2018 - equk.co.uk
+##
+# License: MIT (LICENSE file should be included with script)
+
+## variables
+
+profile_name=${0##*/}
+profile_folder="$HOME/.brave_profiles/$profile_name"
+brave_bin="/usr/bin/brave"
+brave_flags="--ssl-version-min=tls1 --enable-smooth-scrolling --enable-tab-audio-muting"
+
+# color / colour
+blue="\033[1;34m"
+green="\033[1;32m"
+red="\033[1;31m"
+bold="\033[1;37m"
+reset="\033[0m"
+
+# CLI feedback
+cl_error="[$red ERROR $reset]"
+gplus="[$green+$reset]"
+bplus="[$blue+$reset]"
+
+# Check if running within X Window Session
+if [ "x$DISPLAY" = "x" ]; then
+ echo "must be run within the X Window System." >&2
+ echo "Exiting." >&2
+ exit 1
+fi
+
+# Check for root ( quit if root :x )
+if [ $(whoami) = "root" ]; then
+ echo -e "$cl_error do not run this script as root"
+ exit 1
+fi
+
+# Check if user namespaces is enabled (for sandbox)
+# Note: this is to enforce user namespaces for sandbox
+if [[ ! (-r /proc/sys/kernel/unprivileged_userns_clone && $(</proc/sys/kernel/unprivileged_userns_clone) == 1 && -n $(zcat /proc/config.gz | grep CONFIG_USER_NS=y)) ]]; then
+ echo "User namespaces are not detected as enabled on your system, this is required for sandbox"
+ exit 1
+fi
+
+# Check if jq installed
+if ! [ -x "$(command -v jq)" ]; then
+ echo -e "$cl_error jq not installed"
+ echo -e "$cl_error exiting ...."
+ exit 1
+fi
+
+# Create profile directory if it doesn't exist
+if [[ ! -e $profile_folder ]]; then
+ echo -e "$gplus creating profile folder: $profile_folder"
+ mkdir -p $profile_folder
+fi
+
+# Check for Google Account
+if [[ -r $profile_folder/Default/Preferences ]]; then
+ result=$(cat $profile_folder/Default/Preferences | jq ".gaia_cookie")
+ if [ "$result" != "null" ]; then
+ echo -e "$gplus Google Account Detected!"
+ notify-send "Brave Profile $profile_name Started" "This Profile Has An Associated Google Account" -i brave-desktop
+ fi
+fi
+
+# Execute brave
+exec $brave_bin "$@" --user-data-dir=$profile_folder $brave_flags
+