summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f4f0f045e3a502d561cd32de53e9f0edb4eac2ae (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Maintainer: Leon Mergen <leon@solatis.com>
# Maintainer: unlogicalcode <jearsmail99@gmail.com>
# Maintainer: Noah Kennedy <nomaxx117@gmail.com>
# Maintainer: Arsalan Rezazadeh <arsalanrezazadeh4@gmail.com>
# Maintainer: Jongsik Kim <jjong84@gmail.com>
# Maintainer: <memoryshadow@outlook.com>
# Maintainer: Daffa Haj Tsaqif <narutohaj00@gmail.com>

pkgname=cloudflare-warp-bin
pkgver=2024.6.497
pkgrel=1
pkgdesc="Cloudflare Warp Client"
url="https://1.1.1.1"
license=("unknown")
depends=("glibc" "dbus" "lz4" "zstd" "xz" "nftables" "libgpg-error")
checkdepends=("coreutils")
arch=('x86_64')
provides=('warp-cli' 'warp-diag' 'warp-svc')
conflicts=('cloudflare-warp')

# Function to get latest version from repository
get_latest_version() {
    curl -s https://pkg.cloudflareclient.com/dists/jammy/main/binary-amd64/Packages \
    | grep -E -o 'Version: [0-9]+\.[0-9]+\.[0-9]+' \
    | head -n1 \
    | grep -E -o '[0-9]+\.[0-9]+\.[0-9]+'
}

latest_version=$(get_latest_version)

# Compare latest version with current version
if [[ "$pkgver" != "$latest_version" ]]; then
    pkgver=$latest_version
    pkgrel=1
fi

source=(
    "${pkgname}-${pkgver}-x86_64.deb::https://pkg.cloudflareclient.com/pool/jammy/main/c/cloudflare-warp/cloudflare-warp_${pkgver//-/_}-1_amd64.deb"
    "${pkgname}-${pkgver}-${pkgrel}-Release::https://pkg.cloudflareclient.com/dists/jammy/Release"
    "${pkgname}-${pkgver}-${pkgrel}-x86_64-Packages::https://pkg.cloudflareclient.com/dists/jammy/main/binary-amd64/Packages"
)

md5sums=('SKIP'
         'SKIP'
         'SKIP')
sha256sums=('SKIP'
            'SKIP'
            'SKIP')

prepare() {
    tar -xzOf control.tar.gz ./md5sums \
        | awk '{print $1, "'"${srcdir}"'/build/" $2}' \
        > "${srcdir}/md5sums"
}

build() {
    if [[ -d "${srcdir}/build/" ]]; then
        rm -rf "${srcdir}/build/"
    fi

    mkdir -p "${srcdir}/build/" \
        && tar --extract \
               --gzip \
               --file=data.tar.gz \
               -C "${srcdir}/build/"
}


package() {
    mkdir -p "${pkgdir}/usr/" || true

    cp -R -v "${srcdir}/build/usr/" "${pkgdir}/"

    cp -R -v "${srcdir}/build/"{bin,lib} "${pkgdir}/usr/"

    sed -i \
        -e "s%ExecStart=/bin/warp-svc%ExecStart=/usr/bin/warp-svc%" \
        "${pkgdir}"/usr/lib/systemd/system/warp-svc.service
    sed -i \
        -e "s%ExecStart=/bin/warp-taskbar%ExecStart=/usr/bin/warp-taskbar%" \
        "${pkgdir}"/usr/lib/systemd/user/warp-taskbar.service
}