Skip to content

Instantly share code, notes, and snippets.

@Manssizz
Created September 10, 2025 19:35
Show Gist options
  • Select an option

  • Save Manssizz/f7bb1280fb7a78dd18b07a383f80e3a5 to your computer and use it in GitHub Desktop.

Select an option

Save Manssizz/f7bb1280fb7a78dd18b07a383f80e3a5 to your computer and use it in GitHub Desktop.

Revisions

  1. Manssizz created this gist Sep 10, 2025.
    41 changes: 41 additions & 0 deletions install-cloudlfared.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    #!/bin/bash

    # Tentukan URL API GitHub untuk latest release cloudflared
    API_URL="https://api.github.com/repos/cloudflare/cloudflared/releases/latest"

    # Dapatkan arsitektur device
    ARCH=$(uname -m)

    # Mapping arsitektur ke nama file cloudflared di release
    case "$ARCH" in
    x86_64)
    ARCH_NAME="amd64"
    ;;
    aarch64 | arm64)
    ARCH_NAME="arm64"
    ;;
    armv7l)
    ARCH_NAME="arm"
    ;;
    *)
    echo "Arsitektur $ARCH tidak didukung."
    exit 1
    ;;
    esac

    # Ambil URL download dari API GitHub
    DOWNLOAD_URL=$(curl -s $API_URL | grep "browser_download_url" | grep "linux-$ARCH_NAME" | grep -v "sha256" | cut -d '"' -f 4)

    if [ -z "$DOWNLOAD_URL" ]; then
    echo "Gagal mendapatkan URL download untuk arsitektur $ARCH_NAME"
    exit 1
    fi

    # Download file ke /usr/bin/cloudflared
    echo "Downloading cloudflared for $ARCH_NAME..."
    curl -L -o /usr/bin/cloudflared "$DOWNLOAD_URL"

    # Berikan permission execute
    chmod +x /usr/bin/cloudflared

    echo "cloudflared berhasil diinstall di /usr/bin/cloudflared"