From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search

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

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\ and template_brave.xml                                                                                                                                              
Manual edits to packages\brave.xml will be overwritten.                                                                                                                                                            
        xmlns:packages="" xmlns:wpkg="" xmlns:xsi=""
        xsi:schemaLocation=" ../xsd/packages.xsd" >
  name="Brave Browser"

  <variable name="PKG_VERSION" value="" />
  <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" />

    path="Brave" />

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

  <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 cmd='"%ProgramFiles%\BraveSoftware\Brave-Browser\Application\%PKG_VERSION%\Installer\setup.exe" %REMOVE_ARGS% ' />


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.

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.


# Note: MAINPATH needs to define where your wpkg folder resides.
MAINPATH=path to wpkg/wpkg


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

echo Version: $GCVERSION                                                                                                                                                                                              

    if [ -z "$GCVERSION" ] ; then
       echo no version found
       exit 2
# 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

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

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

   echo copying files