1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
BASEPKGNAME=brave-browser
SUPPORTEDARCHES="x86_64"
PRODUCTALT="'' beta nightly dev"
VERSION="$2"
DESCRIPTION="Brave browser from the official site"
. $(dirname $0)/common.sh
repack=''
# we have workaround for their postinstall script, so always repack rpm package
#[ "$(epm print info -p)" = "deb" ] || repack='--repack'
# repack for deb too, they have broken dependency on brave-keyring
repack='--repack'
# brave-browser-beta-1.51.105-1.x86_64.rpm
# brave-browser-beta_1.51.105_amd64.deb
# rpm packages have a release in their names
[ "$(epm print info -p)" = "rpm" ] && [ "$VERSION" != "*" ] && VERSION="$VERSION-1"
# hack to fix short name issue
[ "$VERSION" = "*" ] && VERSION="[[:digit:]]*"
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
if [ "$PKGNAME" = "$BASEPKGNAME" ] ; then
TOREMOVEPKG=$PKGNAME
PKGNAME=$BASEPKGNAME-beta
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"
echo "Force switching from $TOREMOVEPKG to $PKGNAME ... "
epm installed $TOREMOVEPKG && epm remove $TOREMOVEPKG
else
fatal "Can't get package URL for $PKGNAME-$VERSION"
fi
fi
epm $repack install "$PKGURL"