Created
September 17, 2020 07:01
-
-
Save brbsix/999c3d4a4a881400f6c8ee5417a66a15 to your computer and use it in GitHub Desktop.
Install shellcheck on Termux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Install shellcheck | |
set -euo pipefail | |
# resynchronize the package index | |
apt-get -qq update | |
# install QEMU Linux user mode emulator (and jq) | |
apt-get -qqy install curl jq qemu-user-x86_64 wget | |
ARCHIVE_URL=$(curl -H 'Accept: application/vnd.github.v3+json' https://api.github.com/repos/koalaman/shellcheck/releases/latest 2>/dev/null | jq -r '.assets[] | select(.name | contains("linux.x86_64")) | .browser_download_url') | |
ARCHIVE_PATH=${ARCHIVE_URL##*/} | |
# create and enter temporary directory | |
tempdir=$(mktemp --directory --tmpdir shellcheck.XXXXXX) | |
cd "$tempdir" | |
# download archive | |
wget -q "$ARCHIVE_URL" | |
# extract binary from archive | |
tar xJf "$ARCHIVE_PATH" --no-anchored --strip-components=1 shellcheck | |
# install x86_64 binary | |
install -D -m 700 -t ~/.local/libexec/ ./shellcheck | |
# create laumcher script | |
cat <<EOF > launcher | |
#!/data/data/com.termux/files/usr/bin/sh | |
exec /data/data/com.termux/files/usr/bin/qemu-x86_64 /data/data/com.termux/files/home/.local/libexec/shellcheck "\$@" | |
EOF | |
# install launcher | |
install -D -m 700 -T ./launcher ~/.local/bin/shellcheck |
tathastu871
commented
Nov 13, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment