Skip to content

Instantly share code, notes, and snippets.

@avoidik
Last active February 18, 2023 07:10
Show Gist options
  • Save avoidik/0b6594ce0f42144695b69dd7df1f0821 to your computer and use it in GitHub Desktop.
Save avoidik/0b6594ce0f42144695b69dd7df1f0821 to your computer and use it in GitHub Desktop.
Updater scripts
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "Error: This script must be run as root"
exit 1
fi
PKGARCH="x86_64-unknown-linux-gnu.tar.gz$" # aarch64-unknown-linux-musl.tar.gz
echo "starship"
DURL="$(curl -s https://api.github.com/repos/starship/starship/releases/latest | jq -r --arg arch $PKGARCH '.assets[] | select(.name|match($arch)) | .browser_download_url')"
curl -fsSL "$DURL" -o /tmp/starship.tar.gz
tar -zxf /tmp/starship.tar.gz -C /usr/local/bin starship
chmod +x /usr/local/bin/starship
chown root:root /usr/local/bin/starship
rm -f /tmp/starship.tar.gz
PKGARCH="linux-amd64$" # "linux-arm64$"
echo "aws-sso-cli"
DURL="$(curl -s https://api.github.com/repos/synfinatic/aws-sso-cli/releases/latest | jq -r --arg arch $PKGARCH '.assets[] | select(.name|match($arch)) | .browser_download_url')"
curl -fsSL "$DURL" -o /usr/local/bin/aws-sso
chmod +x /usr/local/bin/aws-sso
chown root:root /usr/local/bin/aws-sso
PKGARCH="linux-amd64$" # "linux-arm64$"
echo "direnv"
DURL="$(curl -s https://api.github.com/repos/direnv/direnv/releases/latest | jq -r --arg arch $PKGARCH '.assets[] | select(.name|match($arch)) | .browser_download_url')"
curl -fsSL "$DURL" -o /usr/local/bin/direnv
chmod +x /usr/local/bin/direnv
chown root:root /usr/local/bin/direnv
PKGARCH="linux-amd64$" # "linux-arm64$"
echo "k3d"
DURL="$(curl -s https://api.github.com/repos/k3d-io/k3d/releases/latest | jq -r --arg arch $PKGARCH '.assets[] | select(.name|match($arch)) | .browser_download_url')"
curl -fsSL "$DURL" -o /usr/local/bin/k3d
chmod +x /usr/local/bin/k3d
chown root:root /usr/local/bin/k3d
PKGARCH="linux-amd64$" # "linux-arm64$"
echo "kind"
DURL="$(curl -s https://api.github.com/repos/kubernetes-sigs/kind/releases/latest | jq -r --arg arch $PKGARCH '.assets[] | select(.name|match($arch)) | .browser_download_url')"
curl -fsSL "$DURL" -o /usr/local/bin/kind
chmod +x /usr/local/bin/kind
chown root:root /usr/local/bin/kind
PKGARCH="linux_amd64$" # "linux_arm64$"
echo "aws-iam-authenticator"
DURL="$(curl -s https://api.github.com/repos/kubernetes-sigs/aws-iam-authenticator/releases/latest | jq -r --arg arch $PKGARCH '.assets[] | select(.name|match($arch)) | .browser_download_url')"
curl -fsSL "$DURL" -o /usr/local/bin/aws-iam-authenticator
chmod +x /usr/local/bin/aws-iam-authenticator
chown root:root /usr/local/bin/aws-iam-authenticator
PKGARCH="linux-x86_64$" # "linux-aarch64$"
echo "docker-compose"
mkdir -p /usr/local/lib/docker/cli-plugins/
DURL="$(curl -s https://api.github.com/repos/docker/compose/releases/latest | jq -r --arg arch $PKGARCH '.assets[] | select(.name|match($arch)) | .browser_download_url')"
curl -fsSL "$DURL" -o /usr/local/lib/docker/cli-plugins/docker-compose
chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
chown root:root /usr/local/lib/docker/cli-plugins/docker-compose
PKGARCH="linux.x86_64.tar.xz$" # "linux.aarch64.tar.xz$"
echo "shellcheck"
DURL="$(curl -s https://api.github.com/repos/koalaman/shellcheck/releases/latest | jq -r --arg arch $PKGARCH '.assets[] | select(.name|match($arch)) | .browser_download_url')"
curl -fsSL "$DURL" -o /tmp/shellcheck.tar.xz
mkdir -p /tmp/shellcheck
tar -xf /tmp/shellcheck.tar.xz --strip-components=1 -C /tmp/shellcheck
mv /tmp/shellcheck/shellcheck /usr/local/bin/shellcheck
chmod +x /usr/local/bin/shellcheck
chown root:root /usr/local/bin/shellcheck
rm -rf /tmp/shellcheck
rm -f /tmp/shellcheck.tar.xz
PKGARCH="pass.*?linux-amd64$" # "pass.*?linux-arm64$"
echo "docker-credential-helpers"
DURL="$(curl -s https://api.github.com/repos/docker/docker-credential-helpers/releases/latest | jq -r --arg arch $PKGARCH '.assets[] | select(.name|match($arch)) | .browser_download_url')"
curl -fsSL "$DURL" -o /usr/local/bin/docker-credential-pass
chmod +x /usr/local/bin/docker-credential-pass
chown root:root /usr/local/bin/docker-credential-pass
PKGARCH="linux-amd64" # "linux-arm64"
echo "docker-credential-ecr-login"
PKGVER="$(curl -sL https://raw.githubusercontent.com/awslabs/amazon-ecr-credential-helper/main/VERSION)"
curl -fsSL https://amazon-ecr-credential-helper-releases.s3.us-east-2.amazonaws.com/${PKGVER}/${PKGARCH}/docker-credential-ecr-login -o /usr/local/bin/docker-credential-ecr-login
chmod +x /usr/local/bin/docker-credential-ecr-login
PKGARCH="linux-amd64.tar.gz$" # "linux-arm64.tar.gz$"
echo "minikube"
DURL="$(curl -s https://api.github.com/repos/kubernetes/minikube/releases/latest | jq -r --arg arch $PKGARCH '.assets[] | select(.name|match($arch)) | .browser_download_url')"
curl -fsSL "$DURL" -o /tmp/minikube.tar.gz
tar -zxf /tmp/minikube.tar.gz --strip-components=1 -C /usr/local/bin out/minikube-linux-amd64 # linux-arm64
mv /usr/local/bin/minikube-linux-amd64 /usr/local/bin/minikube
chmod +x /usr/local/bin/minikube
chown root:root /usr/local/bin/minikube
rm -f /tmp/minikube.tar.gz
PKGARCH="linux_amd64.tar.gz$" # "linux_arm64.tar.gz$"
echo "yq"
DURL="$(curl -s https://api.github.com/repos/mikefarah/yq/releases/latest | jq -r --arg arch $PKGARCH '.assets[] | select(.name|match($arch)) | .browser_download_url')"
curl -fsSL "$DURL" -o /tmp/yq.tar.gz
tar -zxf /tmp/yq.tar.gz -C /usr/local/bin ./yq_linux_amd64 # yq_linux_arm64
mv /usr/local/bin/yq_linux_amd64 /usr/local/bin/yq
chmod +x /usr/local/bin/yq
chown root:root /usr/local/bin/yq
rm -f /tmp/yq.tar.gz
PKGARCH="Linux_amd64.tar.gz$" # "Linux_arm64.tar.gz$"
echo "eksctl"
DURL="$(curl -s https://api.github.com/repos/weaveworks/eksctl/releases/latest | jq -r --arg arch $PKGARCH '.assets[] | select(.name|match($arch)) | .browser_download_url')"
curl -fsSL "$DURL" -o /tmp/eksctl.tar.gz
tar -zxf /tmp/eksctl.tar.gz -C /usr/local/bin eksctl
chmod +x /usr/local/bin/eksctl
chown root:root /usr/local/bin/eksctl
rm -f /tmp/eksctl.tar.gz
PKGARCH="linux-amd64.tar.gz$" # "linux-arm64.tar.gz$"
echo "terraform-docs"
DURL="$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | jq -r --arg arch $PKGARCH '.assets[] | select(.name|match($arch)) | .browser_download_url')"
curl -fsSL "$DURL" -o /tmp/terraform-docs.tar.gz
tar -zxf /tmp/terraform-docs.tar.gz -C /usr/local/bin terraform-docs
chmod +x /usr/local/bin/terraform-docs
chown root:root /usr/local/bin/terraform-docs
rm -f /tmp/terraform-docs.tar.gz
PKGARCH="linux_amd64.*?.deb$" # nope
echo "git-credentials-manager"
DURL="$(curl -s https://api.github.com/repos/GitCredentialManager/git-credential-manager/releases/latest | jq -r --arg arch $PKGARCH '.assets[] | select(.name|match($arch)) | .browser_download_url')"
curl -fsSL "$DURL" -o /tmp/gcm.deb
dpkg --force-confold -i /tmp/gcm.deb
PKGARCH="ubuntu_64bit" # "ubuntu_arm64"
echo "session-manager-plugin"
curl -fsSL https://s3.amazonaws.com/session-manager-downloads/plugin/latest/${PKGARCH}/session-manager-plugin.deb -o /tmp/session-manager-plugin.deb
dpkg -i /tmp/session-manager-plugin.deb
PKGARCH="linux-x86_64" # "linux-aarch64"
echo "awscliv2"
curl -fsSL https://awscli.amazonaws.com/awscli-exe-${PKGARCH}.zip -o /tmp/awscliv2.zip
unzip -qod /tmp/awscli /tmp/awscliv2.zip
bash /tmp/awscli/aws/install --update
PKGARCH="linux-amd64" # "linux-arm64"
echo "lightsailctl"
curl -fsSL https://s3.us-west-2.amazonaws.com/lightsailctl/latest/${PKGARCH}/lightsailctl -o /usr/local/bin/lightsailctl
chmod +x /usr/local/bin/lightsailctl
chown root:root /usr/local/bin/lightsailctl
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "Error: This script must be run as root"
exit 1
fi
GO_VER="$(curl -fsSL https://go.dev/VERSION?m=text)"
curl -fsSL "https://go.dev/dl/${GO_VER}.linux-amd64.tar.gz" -o /tmp/golang.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf /tmp/golang.tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment