Bash script to fetch and install Brave browser to /opt

Issues and / or general discussion relating to Puppy

Moderator: Forum moderators

Post Reply
User avatar
FloraMae
Posts: 71
Joined: Thu May 02, 2024 3:13 am
Has thanked: 11 times
Been thanked: 17 times

Bash script to fetch and install Brave browser to /opt

Post by FloraMae »

So, was bored and did a script.

This script gets the current latest release of Brave browser for amd64 and puts it at /opt/brave-browser and mods the launcher to include the --no-sandbox thing it wants to run as root.

Still need to do something about a menu item and maybe some checks and failsafes and such, but version one if anyone wants to mess with it/try it.

Code: Select all

#!/bin/bash
########################################################################
##
## Brave browser fetch for Puppy
##
## Tested: Bookwormpup64
##
## Requires: bash, curl, jq, grep, head
##
## Version: 1
##
########################################################################

## Basic deps check
APPARRAY=(curl jq grep head)
function check_deps(){
    for APP in "${APPARRAY[@]}"
    do
        which $APP > /dev/null 2>&1
        rc=$?
        if [ $rc == 0 ]; then
            continue
        fi

		echo "deps not satisfied, please open script to verify"
        exit 1
    done
}

check_deps

## Get the latest url release
url=$(curl --silent "https://api.github.com/repos/brave/brave-browser/releases/latest" | jq --raw-output '.assets[] .browser_download_url' | grep 'linux-amd64' | head -n1)

## Get it
wget -O './brave.zip' "$url" -q --show-progress

## "install it"
mkdir -p /opt/brave-browser
unzip brave.zip -d /opt/brave-browser

## make it run in root
sed -i '$ d' /opt/brave-browser/brave-browser
echo '"$HERE/brave" --no-sandbox "$@" || true' >> /opt/brave-browser/brave-browser
Post Reply

Return to “Users”