summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1410afb513e4152aa3acf5a98e553b8e6e107abd (plain)
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
45
46
47
48
49
50
51
52
53
# Maintainer: xihale <xihale.top@qq.com>

## options
: ${_autoupdate:=true}
: ${_pkgtype:=-bin}

pkgname="v2rayn$_pkgtype"
pkgver=7.2.0
pkgrel=1
pkgdesc="A GUI client for Windows and Linux, support Xray core and others"
arch=("x86_64")
license=('GPL3')
url="https://github.com/2dust/v2rayN"
options=('!strip') # TODO: after striping, the file couldn't run

_main(){

    _json=$(curl -s "https://api.github.com/repos/2dust/v2rayN/releases?per_page=1")
    
    _pkgver=$(jq -r '.[0].tag_name' <<< $_json)

    _bin_url=`echo "$_json" | sed -n '/browser_download_url.*v2rayN-linux-64\.zip/p' | awk -F'"' '{print $4}'`

}

pkgver(){

    if [ -z "$_pkgver" ]; then
        echo "Can't get the package info from https://api.github.com/repos/2dust/v2rayN/releases?per_page=1"
        exit
    else
        echo "$_pkgver"
    fi

}

package() {

    # get the package
    filename=`basename $_bin_url`
    echo $_bin_url $filename
    curl -L -o $filename -C - $_bin_url && bsdtar -xf $filename # continuous transmission on the breakpoint if file exist.

    _app_name=$pkgname

    install -Dm644 "../v2rayN.png" -t "$pkgdir/usr/share/pixmaps"
    install -Dm644 "../v2rayN-bin.desktop" -t "$pkgdir/usr/share/applications"
    mkdir -p "$pkgdir/opt/$_app_name"
    mv v2rayN-linux-64/* $pkgdir/opt/$_app_name/
    chmod -R 0777 $pkgdir/opt/$_app_name
}

_main