Brave

Brave is a web browser based on the chromium engine and is supposed to be more focused on security.

You can download the latest version of brave at https://brave-browser-downloads.s3.brave.com/latest/brave_installer-x64.exe

From Wikipedia: "Brave is a free and open-source web browser developed by Brave Software, Inc. based on the Chromium web browser. Brave is a privacy-focused browser, which automatically blocks most advertisements and website trackers in its default settings. Users can turn on optional ads that reward them for their attention in the form of Basic Attention Tokens (BAT), which can be used as a cryptocurrency or to make donations to registered websites and content creators."


Brave Installer

The Brave installer installs by default on a per-user basis. The installer script listed here passes options to install it system-wide. The options for installers are limited at the moment and no msi is currently available. I had trouble installing this package from a network share using wpkg so there is a provision in the install script that copies it to the main drive then installs from there and deletes the installer after everything is done.

I've adapted this process from what was done for the Chrome wpkg script. If you would like to adapt the batch. I intend to do as little work as possible on Windows so I opted for bash instead of vbscript. If you want the vbscript you can adapt the one from the chrome wpkg link and please update it here.

<?xml version="1.0" encoding="UTF-8"?>
 
<!--                                                                                                                                                                                                               
Thie file generated from tools\update-brave.sh and template_brave.xml                                                                                                                                              
Manual edits to packages\brave.xml will be overwritten.                                                                                                                                                            
-->
<packages:packages
        xmlns:packages="http://www.wpkg.org/packages" xmlns:wpkg="http://www.wpkg.org/wpkg" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://www.wpkg.org/packages ../xsd/packages.xsd" >
<package
  id="brave"
  name="Brave Browser"
  revision="%PKG_VERSION%"
  reboot="false">

  <variable name="PKG_VERSION" value="126.1.67.116" />
  <variable architecture="x86" name="progfiles" value="%PROGRAMFILES%" />
  <variable architecture="x64" name="progfiles" value="%PROGRAMFILES(X86)%" />
  <variable name="INSTALL_ARGS" value="-install -system-level -silent" />
  <variable name="REMOVE_ARGS" value="--uninstall --system-level --force-uninstall" />

  <check
    type="uninstall"
    condition="exists"
    path="Brave" />

  <install cmd="taskkill /F /IM brave.exe">
    <exit code="any" />
  </install>

  <install cmd='%ComSpec% /C if not exist "%SYSTEMDRIVE%\temp_brave\" mkdir "%SYSTEMDRIVE%\temp_brave\" ' />

  <install cmd='%COMSPEC% /C xcopy "%SOFTWARE%\brave\brave_installer-x64-%PKG_VERSION%.exe" "%SYSTEMDRIVE%\temp_brave\" /S /V /I /R /Y '/>

  <install cmd='%COMSPEC% /C "%SYSTEMDRIVE%\temp_brave\brave_installer-x64-%PKG_VERSION%.exe" %INSTALL_ARGS% ' />

   <install cmd='%COMSPEC% /C if exist "%SYSTEMDRIVE%\temp_brave\" rmdir /s /q "%SYSTEMDRIVE%\temp_brave\" '/>
  <upgrade include='install' />

  <remove cmd="taskkill /F /IM brave.exe">
    <exit code="any" />
  </remove>
  <remove cmd='"%ProgramFiles%\BraveSoftware\Brave-Browser\Application\%PKG_VERSION%\Installer\setup.exe" %REMOVE_ARGS% ' />

</package>
</packages:packages>

Automated Updates of Brave's WPKG Files

This is a bash script we run on our WPKG server that downloads the current Brave exe, renames it according to the Chrome release number, and updates the package XML files accordingly. This greatly simplifies rolling out new versions of Brave.


update-brave-xml.sh

Just to get an idea how this can be done using bash scripting if your wpkg share is on linux using samba, here is my script which checks if there is a newer version of google chrome. Only then it copies the msi file and creates new xml file from template. It substitutes the __VERSION__ and __MSIKEY__ strings, which are extracted from the msi file. Seems like a quick hack to get the strings out of the MSI file, at least it works at the moment.

#!/bin/bash                                                                                                                                                                                                                                                                                                                                                                                                                        

# Note: MAINPATH needs to define where your wpkg folder resides.
MAINPATH=path to wpkg/wpkg
TMPPATH=$MAINPATH/temp
DESTPATH=$MAINPATH/installers/brave
TEMPLATE=$MAINPATH/packages/Templates/template_brave.xml
FILENAME=brave.xml
TEMPFILE=$TMPPATH/$FILENAME
DESTFILE=$MAINPATH/packages/$FILENAME

DLFILE=brave_installer-x64
DLSOURCE=https://brave-browser-downloads.s3.brave.com/latest/$DLFILE.exe


cd $TMPPATH
rm $DLFILE.exe
/usr/bin/wget --no-check-certificate $DLSOURCE
                                                                                                                         
RAWSTRINGS=`/usr/bin/7z l $DLFILE.exe  | /usr/bin/strings | /usr/bin/grep -x "^Comment = FileVersion:.*$" | tr "\n" " " `

for k in ${RAWSTRINGS} ; do
    unset SUBSTRING1; unset SUBSTRING2 ;
    SUBSTRING1=`expr match "$k" '\([[:digit:].]\{12,16\}\)' `
    if [ -n "${SUBSTRING1}" ] ; then
       GCVERSION="$SUBSTRING1";
       break
    fi
done

echo Version: $GCVERSION                                                                                                                                                                                              

    if [ -z "$GCVERSION" ] ; then
       echo no version found
       exit 2
    fi
# create xml file from template                                                                                                                                                                                    
                                                                                                                 
sed -e "s/__VERSION__/${GCVERSION}/" <$TEMPLATE  | sed -e "s/__VERSION__/${GCVERSION}/"  >$TEMPFILE

diff -wB $TEMPLATE  $TEMPFILE >/dev/null

if [ $? -eq 0 ] ; then
    # version  not changed                                                                                                                                                                                         
    echo string error
    exit 1
fi

diff -wB $TEMPFILE $DESTFILE >/dev/null

if [ $? -eq 0 ] ; then
    # no difference                                                                                                                                                                                                
    echo not newer
    rm $DLFILE.exe
    exit 0
fi

   echo copying files

mv $DLFILE.exe $DESTPATH/$DLFILE-$GCVERSION.exe
cp $TEMPFILE $DESTFILE