summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 48f8db119fbd8a07c2eb7e5a8080e915a92eb6f4 (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
# Maintainer: Winston Astrachan <winston dot astrachan at gmail dot com>

pkgname=google-cloud-cli-gke-gcloud-auth-plugin
pkgver=421.0.0
pkgrel=2
pkgdesc="A google-cloud-cli component that provides a kubectl authentication plugin for GKE."
arch=('x86_64')
url="https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke"
license=('Apache')
depends=('google-cloud-cli')
conflicts=('gooogle-cloud-sdk-gke-gcloud-auth-plugin')
replaces=('gooogle-cloud-sdk-gke-gcloud-auth-plugin')
options=('!strip')
source=(
    "https://dl.google.com/dl/cloudsdk/release/downloads/for_packagers/linux/${pkgname}_${pkgver}.orig_amd64.tar.gz"
    'google-cloud-cli-gke-gcloud-auth-plugin.sh')
sha256sums=('e17cbfbb41f3af81599c5c2d2cc423e8f86f352bab6e20c255973f79945deac7'
            '4432c1e71c39cb0914baa4df6c8699adc7e633163da7be87ac159d5b320cb346')
install="${pkgname}.install"

package() {
    cd "$srcdir/google-cloud-sdk"  # Does not match naming convention google-cloud-cli

    # Install plugin manifests and snapshots
    manifests=(
        "gke-gcloud-auth-plugin-linux-x86_64.manifest"
        "gke-gcloud-auth-plugin-linux-x86_64.snapshot.json"
        "gke-gcloud-auth-plugin.manifest"
        "gke-gcloud-auth-plugin.snapshot.json"
    )
    for item in ${manifests[@]}; do
        install -Dm644 \
            ".install/${item}" \
            "${pkgdir}/opt/google-cloud-cli/.install/${item}"
    done

    # Install plugin binary
    install -Dm755 \
        "bin/gke-gcloud-auth-plugin" \
        "${pkgdir}/opt/google-cloud-cli/bin/gke-gcloud-auth-plugin"

    # Symlink plugin binary
    install -dm755 "${pkgdir}/usr/bin/"
    ln -s \
        "/opt/google-cloud-cli/bin/gke-gcloud-auth-plugin" \
        "${pkgdir}/usr/bin/gke-gcloud-auth-plugin"

    # Install profile.d environment exports
    install -Dm755 \
        "${srcdir}/google-cloud-cli-gke-gcloud-auth-plugin.sh" \
        "${pkgdir}/etc/profile.d/google-cloud-cli-gke-gcloud-auth-plugin.sh"
}