brave.sh 1.44 KB
Newer Older
1
#!/bin/sh
2

3
BASEPKGNAME=brave-browser
4
SUPPORTEDARCHES="x86_64"
5
PRODUCTALT="'' beta nightly dev"
6 7
VERSION="$2"
DESCRIPTION="Brave browser from the official site"
8

9
. $(dirname $0)/common.sh
10

11 12
repack=''
# we have workaround for their postinstall script, so always repack rpm package
13 14 15
#[ "$(epm print info -p)" = "deb" ] || repack='--repack'
# repack for deb too, they have broken dependency on brave-keyring
repack='--repack'
16

17 18
# brave-browser-beta-1.51.105-1.x86_64.rpm
# brave-browser-beta_1.51.105_amd64.deb
19

20 21 22 23

# rpm packages have a release in their names
[ "$(epm print info -p)" = "rpm" ] && [ "$VERSION" != "*" ] && VERSION="$VERSION-1"

24 25 26
# hack to fix short name issue
[ "$VERSION" = "*" ] && VERSION="[[:digit:]]*"

27 28 29 30
PKGURL=$(epm tool eget --list --latest https://github.com/brave/brave-browser/releases "$(epm print constructname $PKGNAME "$VERSION")")

if [ -z "$PKGURL" ] ; then
    # force use beta if can't get stable version
31 32 33
    if [ "$PKGNAME" = "$BASEPKGNAME" ] ; then
        TOREMOVEPKG=$PKGNAME
        PKGNAME=$BASEPKGNAME-beta
34 35
        PKGURL=$(epm tool eget --list --latest https://github.com/brave/brave-browser/releases "$(epm print constructname $PKGNAME "$VERSION")")
        [ -n "$PKGURL" ] || fatal "Can't get package URL"
36 37

        echo "Force switching from $TOREMOVEPKG to $PKGNAME ... "
38
        epm installed $TOREMOVEPKG && epm remove $TOREMOVEPKG
39
    else
40
        fatal "Can't get package URL for $PKGNAME-$VERSION"
41 42
    fi
fi
43

44
epm $repack install "$PKGURL"