Update shell script styles and update versions

main
Buddy Sandidge 2 years ago
parent c9004e963e
commit 5f5e995fbd

@ -12,7 +12,6 @@ alias +x='chmod +x'
alias rsync-win='rsync --recursive --verbose --times --modify-window=1 ' alias rsync-win='rsync --recursive --verbose --times --modify-window=1 '
alias simple-http-server='python3 -m http.server' alias simple-http-server='python3 -m http.server'
# shellcheck disable=SC1004
alias wget-opendir='wget --recursive --level 0 --continue --no-clobber \ alias wget-opendir='wget --recursive --level 0 --continue --no-clobber \
--no-parent --execute robots=off --random-wait --limit-rate=800k \ --no-parent --execute robots=off --random-wait --limit-rate=800k \
--reject=html,htm,index' --reject=html,htm,index'

@ -2,7 +2,7 @@
#ft=bash #ft=bash
# always save bash history before showing prompt; allow reloading bashrc # always save bash history before showing prompt; allow reloading bashrc
if [[ ! "$PROMPT_COMMAND" =~ "history -a" ]]; then if [[ ! $PROMPT_COMMAND =~ "history -a" ]]; then
PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
fi fi

@ -2,29 +2,17 @@
#ft=bash #ft=bash
function min-jpg { function min-jpg {
if ! command -v jpegtran &> /dev/null ; then min_jpg "${@}"
echo "jpegtran not installed"
fi
tmpfile="$(mktemp)"
ogfile="$1"
jpegtran -optimize -perfect -outfile "$tmpfile" "$ogfile"
mv "$tmpfile" "$ogfile"
} }
function min-png { function min-png {
if ! command -v pngcrush &> /dev/null ; then min_png "${@}"
echo "pngcrush not installed"
fi
tmpfile="$(mktemp)"
ogfile="$1"
pngcrush -rem alla -reduce -brute "$ogfile" "$tmpfile"
mv "$tmpfile" "$ogfile"
} }
function get-create-date { function get-create-date {
date -r "$1" +"%F" get_create_date "${@}"
} }
function add-date-prefix { function add-date-prefix {
add_date_prefix "$1" "$2" add_date_prefix "${@}"
} }

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
#ft=bash #ft=bash
if [[ ! "${BASH_VERSION}" = "3.2*" ]]; then if [[ ${BASH_VERSION} != "3.2*" ]]; then
shopt -s autocd shopt -s autocd
fi fi

@ -1,4 +1,5 @@
#ft=sh #ft=sh
#shellcheck shell=sh
if type nvim >/dev/null 2>/dev/null; then if type nvim >/dev/null 2>/dev/null; then
export EDITOR=nvim export EDITOR=nvim
@ -7,17 +8,6 @@ else
export EDITOR=vim export EDITOR=vim
fi fi
slugify () (
if [ "$#" -ne 0 ] ; then
echo "$@" | slugify
else
iconv --to-code ascii//TRANSLIT |
sed -E 's/[^a-zA-Z0-9]+/-/g' |
sed -E 's/^-+\|-+$//g' |
tr '[:upper:]' '[:lower:]'
fi
)
source_env_file() { source_env_file() {
if [ ! -f "${1}" ]; then if [ ! -f "${1}" ]; then
return return
@ -54,7 +44,7 @@ get_bitrate () (
) )
json_to_yaml() ( json_to_yaml() (
ARG=${1:-} ARG=${1-}
if [ -z "${ARG}" ]; then if [ -z "${ARG}" ]; then
dasel --read json --write yaml | bat --language yaml dasel --read json --write yaml | bat --language yaml
elif [ -f "${ARG}" ]; then elif [ -f "${ARG}" ]; then
@ -65,7 +55,7 @@ json_to_yaml () (
) )
yaml_to_json() ( yaml_to_json() (
ARG=${1:-} ARG=${1-}
if [ -z "${ARG}" ]; then if [ -z "${ARG}" ]; then
dasel --read yaml --write json | bat --language json dasel --read yaml --write json | bat --language json
elif [ -f "${ARG}" ]; then elif [ -f "${ARG}" ]; then
@ -77,7 +67,55 @@ yaml_to_json () (
github_releases() ( github_releases() (
USER=${1} USER=${1}
REPO=${2} REPO=${2-}
if [ -z "${REPO}" ]; then
USER=$(echo "${1}" | sed 's|/| |g' | awk '{print $1}')
REPO=$(echo "${1}" | sed 's|/| |g' | awk '{print $2}')
fi
curl --silent --header "Accept: application/vnd.github.v3+json" \ curl --silent --header "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/${USER}/${REPO}/releases" "https://api.github.com/repos/${USER}/${REPO}/releases"
) )
command_installed() (
set -ue
cmd=${1}
if ! command -v "${cmd}" 1>&2 >/dev/null; then
echo "${cmd} not installed" 1>&2
exit 1
fi
)
min_jpg() (
set -ue
command_installed jpegtran
file=$1
out_file=$(mktemp)
jpegtran -optimize -perfect -outfile "$out_file" "$file"
mv "$out_file" "$file"
)
min_png() (
set -ue
command_installed pngcrush
out_file=$(mktemp)
file=$1
pngcrush -rem alla -reduce -brute "$file" "$out_file"
mv "$out_file" "$file"
)
get_create_date() (
date -r "$1" +"%F"
)
#shellcheck disable=SC2120
slugify() (
if [ "$#" -ne 0 ]; then
#shellcheck disable=SC2119
echo "$@" | slugify
else
iconv --to-code ascii//TRANSLIT |
sed -E 's/[^a-zA-Z0-9]+/-/g' |
sed -E 's/^-+\|-+$//g' |
tr '[:upper:]' '[:lower:]'
fi
)

@ -24,7 +24,7 @@ release_json () (
PROJECT=$1 PROJECT=$1
JSON=${XDG_CACHE_HOME}/apps/meta/${PROJECT}/releases.json JSON=${XDG_CACHE_HOME}/apps/meta/${PROJECT}/releases.json
mkdir -p "$(dirname "${JSON}")" mkdir -p "$(dirname "${JSON}")"
if [[ ! -f "${JSON}" || "$(age_in_seconds "${JSON}")" -gt "${DAY}" ]]; then if [[ ! -f ${JSON} || "$(age_in_seconds "${JSON}")" -gt ${DAY} ]]; then
curl --silent --output "${JSON}" "https://api.github.com/repos/${PROJECT}/releases" curl --silent --output "${JSON}" "https://api.github.com/repos/${PROJECT}/releases"
fi fi
echo "${JSON}" echo "${JSON}"

@ -1,7 +1,7 @@
#ft=bash #ft=bash
bail() ( bail() (
>&2 echo "ERROR: $1" echo >&2 "ERROR: $1"
exit 1 exit 1
) )
@ -14,7 +14,7 @@ must_be_root () (
set_link() ( set_link() (
TARGET=${1} TARGET=${1}
APP_DIR=${2} APP_DIR=${2}
APP_PATH=${3:-} APP_PATH=${3-}
pushd "$(dirname "${TARGET}")" >/dev/null || exit 1 pushd "$(dirname "${TARGET}")" >/dev/null || exit 1
unlink_if_set "${TARGET}" unlink_if_set "${TARGET}"
@ -34,7 +34,10 @@ get_os () (
SunOS*) echo solaris ;; SunOS*) echo solaris ;;
Windows_NT*) echo windows ;; Windows_NT*) echo windows ;;
CYGWIN_NT*) echo windows ;; CYGWIN_NT*) echo windows ;;
*) >&2 echo "unsupported os"; return; *)
echo >&2 "unsupported os"
return
;;
esac esac
) )
@ -49,14 +52,17 @@ get_arch () (
armv6*) echo arm ;; armv6*) echo arm ;;
armv8*) echo arm ;; armv8*) echo arm ;;
aarch64*) echo arm64 ;; aarch64*) echo arm64 ;;
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;; *)
echo >&2 "unsupported architecture: $(uname -m)"
exit 1
;;
esac esac
) )
set_current_link() ( set_current_link() (
prefix=${1} prefix=${1}
version=${2} version=${2}
sudo=${3:-} sudo=${3-}
current="${prefix}/current" current="${prefix}/current"
if [ -L "${current}" ]; then if [ -L "${current}" ]; then
$sudo unlink "${current}" $sudo unlink "${current}"
@ -67,7 +73,7 @@ set_current_link () (
unlink_if_set() ( unlink_if_set() (
dir=$1 dir=$1
sudo=${2:-} sudo=${2-}
if [ -L "${dir}" ]; then if [ -L "${dir}" ]; then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
${sudo} unlink "${dir}" ${sudo} unlink "${dir}"
@ -76,7 +82,7 @@ unlink_if_set () (
mkdir_if_missing() ( mkdir_if_missing() (
dir=${1} dir=${1}
sudo=${2:-} sudo=${2-}
if [ ! -d "${dir}" ]; then if [ ! -d "${dir}" ]; then
# shellcheck disable=SC2086 # shellcheck disable=SC2086
$sudo mkdir -p "${dir}" $sudo mkdir -p "${dir}"
@ -86,8 +92,8 @@ mkdir_if_missing () (
extract_zip() ( extract_zip() (
url=${1} url=${1}
dest=${2} dest=${2}
args=${3:-} args=${3-}
sudo=${4:-} sudo=${4-}
if [ -d "${dest}" ]; then if [ -d "${dest}" ]; then
return return
fi fi
@ -104,8 +110,8 @@ extract_zip () (
extract_tarball() ( extract_tarball() (
url=${1} url=${1}
dest=${2} dest=${2}
args=${3:-} args=${3-}
sudo=${4:-} sudo=${4-}
if [ -d "${dest}" ]; then if [ -d "${dest}" ]; then
return return
fi fi
@ -122,7 +128,7 @@ extract_tarball () (
extract_binary() ( extract_binary() (
url=${1} url=${1}
dest=${2} dest=${2}
sudo=${3:-} sudo=${3-}
if [ -f "${dest}" ]; then if [ -f "${dest}" ]; then
return return
fi fi

@ -2,7 +2,7 @@
set -euo pipefail set -euo pipefail
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=aax-to-mp3 APP=aax-to-mp3

@ -1,11 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1090 set -euo pipefail
# shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=age APP=age
VERSION=${VERSION:-1.1.1} VERSION=${VERSION:-1.1.1}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}" DEST=${XDG_DATA_HOME}/apps/releases/${APP}
URL=https://github.com/FiloSottile/age/releases/download/v${VERSION}/age-v${VERSION}-$(get_os)-$(get_arch).tar.gz URL=https://github.com/FiloSottile/age/releases/download/v${VERSION}/age-v${VERSION}-$(get_os)-$(get_arch).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1" extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1"

@ -1,21 +1,31 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1090 set -euo pipefail
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
get_arch () {
case $(uname -m) in
x86_64*) echo amd64;;
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;;
esac
}
# shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=cmctl APP=cmctl
VERSION=${VERSION:-1.6.1} VERSION=${VERSION:-1.6.1}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}" DEST=${XDG_DATA_HOME}/apps/releases/${APP}
URL=https://github.com/jetstack/cert-manager/releases/download/v${VERSION}/cmctl-$(get_os)-$(get_arch).tar.gz
main() (
set -x
URL=https://github.com/cert-manager/cert-manager/releases/download/v${VERSION}/cmctl-$(get_os)-$(get_arch).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}" extract_tarball "${URL}" "${DEST}/${VERSION}"
set_current_link "${DEST}" "${VERSION}" set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"
)
get_arch() (
case $(uname -m) in
x86_64*) echo amd64 ;;
*)
echo >&2 "unsupported architecture: $(uname -m)"
exit 1
;;
esac
)
main "${@}"

@ -1,18 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1090 set -euo pipefail
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
get_arch () { # shellcheck disable=SC1091
case $(uname -m) in source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
x86_64*) echo amd64;;
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;;
esac
}
APP=chezmoi APP=chezmoi
VERSION=${VERSION:-2.22.1} VERSION=${VERSION:-2.33.6}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}" DEST=${XDG_DATA_HOME}/apps/releases/${APP}
main() (
URL=https://github.com/twpayne/chezmoi/releases/download/v${VERSION}/chezmoi_${VERSION}_$(get_os)_$(get_arch).tar.gz URL=https://github.com/twpayne/chezmoi/releases/download/v${VERSION}/chezmoi_${VERSION}_$(get_os)_$(get_arch).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}" extract_tarball "${URL}" "${DEST}/${VERSION}"
@ -22,3 +19,16 @@ set_link "${XDG_CONFIG_HOME}/bash/bashrc.d/chezmoi.sh" "${DEST}" "comple
set_link "${XDG_CONFIG_HOME}/zsh/zshrc.d/chezmoi.zsh" "${DEST}" "completions/chezmoi.zsh" set_link "${XDG_CONFIG_HOME}/zsh/zshrc.d/chezmoi.zsh" "${DEST}" "completions/chezmoi.zsh"
set_link "${XDG_CONFIG_HOME}/fish/completions/chezmoi.fish" "${DEST}" "completions/chezmoi.fish" set_link "${XDG_CONFIG_HOME}/fish/completions/chezmoi.fish" "${DEST}" "completions/chezmoi.fish"
set_link "${XDG_DATA_HOME}/doc/chezmoi" "${DEST}" "docs" set_link "${XDG_DATA_HOME}/doc/chezmoi" "${DEST}" "docs"
)
get_arch() (
case $(uname -m) in
x86_64*) echo amd64 ;;
*)
echo >&2 "unsupported architecture: $(uname -m)"
exit 1
;;
esac
)
main "${@}"

@ -1,18 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1090 set -euo pipefail
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
get_arch () ( # shellcheck disable=SC1091
case $(uname -m) in source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
x86_64*) echo amd64;;
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;;
esac
)
APP=dasel APP=dasel
VERSION=${VERSION:-2.2.0} VERSION=${VERSION:-2.2.0}
DEST=${XDG_DATA_HOME}/apps/releases/${APP} DEST=${XDG_DATA_HOME}/apps/releases/${APP}
main() (
URL=https://github.com/TomWright/dasel/releases/download/v${VERSION}/dasel_$(get_os)_$(get_arch) URL=https://github.com/TomWright/dasel/releases/download/v${VERSION}/dasel_$(get_os)_$(get_arch)
mkdir_if_missing "${DEST}/${VERSION}" mkdir_if_missing "${DEST}/${VERSION}"
@ -20,3 +17,16 @@ curl --silent --location --output "${DEST}/${VERSION}/dasel" "${URL}"
chmod 755 "${DEST}/${VERSION}/dasel" chmod 755 "${DEST}/${VERSION}/dasel"
set_current_link "${DEST}" "${VERSION}" set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"
)
get_arch() (
case $(uname -m) in
x86_64*) echo amd64 ;;
*)
echo >&2 "unsupported architecture: $(uname -m)"
exit 1
;;
esac
)
main "${@}"

@ -1,20 +1,31 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" set -euo pipefail
function get_os () { # shellcheck disable=SC1091
case $(uname -s) in source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
Linux*) echo unknown-linux-gnu;;
Darwin*) echo apple-darwin;;
*) >&2 echo "unsupported os: $(uname -s)"; exit 1;;
esac
}
APP=dust APP=dust
VERSION=${VERSION:-0.6.2} VERSION=${VERSION:-0.8.6}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}" DEST=${XDG_DATA_HOME}/apps/releases/${APP}
URL="https://github.com/bootandy/dust/releases/download/v${VERSION}/dust-v${VERSION}-$(uname -m)-$(get_os).tar.gz"
main() (
URL=https://github.com/bootandy/dust/releases/download/v${VERSION}/dust-v${VERSION}-$(uname -m)-$(get_os).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-component 1" extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-component 1"
set_current_link "${DEST}" "${VERSION}" set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"
)
get_os() (
case $(uname -s) in
Linux*) echo unknown-linux-gnu ;;
Darwin*) echo apple-darwin ;;
*)
echo >&2 "unsupported os: $(uname -s)"
exit 1
;;
esac
)
main "${@}"

@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -euo pipefail
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=etcd APP=etcd
VERSION=${VERSION:-v3.4.15} VERSION=${VERSION:-v3.5.9}
APPS_DIR=/usr/local/apps/${APP} APPS_DIR=/usr/local/apps/${APP}
URL=https://github.com/etcd-io/etcd/releases/download/${VERSION}/etcd-${VERSION}-$(get_os)-$(get_arch).tar URL=https://github.com/etcd-io/etcd/releases/download/${VERSION}/etcd-${VERSION}-$(get_os)-$(get_arch).tar

@ -1,22 +1,30 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -euo pipefail
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
get_arch () {
case $(uname -m) in
x86_64*) echo amd64;;
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;;
esac
}
APP=evans APP=evans
VERSION=${VERSION:-0.10.2} VERSION=${VERSION:-v0.10.11}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}" DEST=${XDG_DATA_HOME}/apps/releases/${APP}
main() (
URL=https://github.com/ktr0731/evans/releases/download/${VERSION}/evans_$(get_os)_$(get_arch).tar.gz URL=https://github.com/ktr0731/evans/releases/download/${VERSION}/evans_$(get_os)_$(get_arch).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}" extract_tarball "${URL}" "${DEST}/${VERSION}"
set_current_link "${DEST}" "${VERSION}" set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"
)
get_arch() (
case $(uname -m) in
x86_64*) echo amd64 ;;
*)
echo >&2 "unsupported architecture: $(uname -m)"
exit 1
;;
esac
)
main "${@}"

@ -2,16 +2,31 @@
set -euo pipefail set -euo pipefail
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=geckodriver
VERSION=${VERSION:-0.33.0}
DEST=${XDG_DATA_HOME}/apps/releases/${APP}
main() (
URL=https://github.com/mozilla/geckodriver/releases/download/v${VERSION}/geckodriver-v${VERSION}-$(get_os)$(get_arch).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}"
set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" ${APP}
)
get_os() ( get_os() (
case $(uname -s) in case $(uname -s) in
Linux*) echo linux ;; Linux*) echo linux ;;
Darwin*) echo macos ;; Darwin*) echo macos ;;
Windows_NT*) echo win ;; Windows_NT*) echo win ;;
CYGWIN_NT*) echo win ;; CYGWIN_NT*) echo win ;;
*) >&2 echo "unsupported os"; exit 1; *)
echo >&2 "unsupported os"
exit 1
;;
esac esac
) )
@ -22,15 +37,11 @@ get_arch () (
i386*) echo 32 ;; i386*) echo 32 ;;
i686*) echo 32 ;; i686*) echo 32 ;;
aarch64*) echo aarch64 ;; aarch64*) echo aarch64 ;;
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;; *)
echo >&2 "unsupported architecture: $(uname -m)"
exit 1
;;
esac esac
) )
APP=geckodriver main "${@}"
VERSION=${VERSION:-0.31.0}
DEST=${XDG_DATA_HOME}/apps/releases/${APP}
URL=https://github.com/mozilla/geckodriver/releases/download/v${VERSION}/geckodriver-v${VERSION}-$(get_os)$(get_arch).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}"
set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" ${APP}

@ -1,20 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1090 set -euo pipefail
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
function get_os () { # shellcheck disable=SC1091
case $(uname -s) in source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
Linux*) echo linux;;
Darwin*) echo darwin-10.12;;
*) >&2 echo "unsupported os: $(uname -s)"; exit 1;;
esac
}
APP=gitea APP=gitea
DEST=${XDG_DATA_HOME}/apps/releases/${APP} DEST=${XDG_DATA_HOME}/apps/releases/${APP}
CURRENT=${DEST}/current CURRENT=${DEST}/current
VERSION=${VERSION:-1.19.0} VERSION=${VERSION:-1.19.0}
main() (
URL=https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-$(get_os)-$(get_arch).xz URL=https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-$(get_os)-$(get_arch).xz
if [ ! -d "${DEST}/${VERSION}" ]; then if [ ! -d "${DEST}/${VERSION}" ]; then
@ -34,3 +30,17 @@ unlink_if_set "${XDG_BIN_HOME}/${APP}"
cd "${XDG_BIN_HOME}" || exit 1 cd "${XDG_BIN_HOME}" || exit 1
ln -s "$(relative_path "${XDG_BIN_HOME}" "${CURRENT}/${APP}")" "${APP}" ln -s "$(relative_path "${XDG_BIN_HOME}" "${CURRENT}/${APP}")" "${APP}"
cd - &>/dev/null || exit 1 cd - &>/dev/null || exit 1
)
get_os() (
case $(uname -s) in
Linux*) echo linux ;;
Darwin*) echo darwin-10.12 ;;
*)
echo >&2 "unsupported os: $(uname -s)"
exit 1
;;
esac
)
main "${@}"

@ -1,23 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1090 set -euo pipefail
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
function get_os () { # shellcheck disable=SC1091
case $(uname -s) in source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
Linux*) echo linux;;
Darwin*) echo darwin-10.12;;
*) >&2 echo "unsupported os: $(uname -s)"; exit 1;;
esac
}
APP=gitea APP=gitea
DEST=/usr/local/apps/${APP} DEST=/usr/local/apps/${APP}
CURRENT=${DEST}/current CURRENT=${DEST}/current
VERSION=${VERSION:-1.19.0} VERSION=${VERSION:-1.19.0}
URL=https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-$(get_os)-$(get_arch).xz
BIN_DIR=/usr/local/bin BIN_DIR=/usr/local/bin
main() (
URL=https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-$(get_os)-$(get_arch).xz
if [ ! -d "${DEST}/${VERSION}" ]; then if [ ! -d "${DEST}/${VERSION}" ]; then
tmp_dir="$(mktemp -d)" tmp_dir="$(mktemp -d)"
file=${tmp_dir}/gitea file=${tmp_dir}/gitea
@ -36,3 +32,17 @@ unlink_if_set "${BIN_DIR}/${APP}" "sudo"
cd "${BIN_DIR}" || exit 1 cd "${BIN_DIR}" || exit 1
sudo ln -s "$(relative_path "${BIN_DIR}" "${CURRENT}/${APP}")" "${APP}" sudo ln -s "$(relative_path "${BIN_DIR}" "${CURRENT}/${APP}")" "${APP}"
cd - &>/dev/null || exit 1 cd - &>/dev/null || exit 1
)
get_os() (
case $(uname -s) in
Linux*) echo linux ;;
Darwin*) echo darwin-10.12 ;;
*)
echo >&2 "unsupported os: $(uname -s)"
exit 1
;;
esac
)
main "${@}"

@ -1,20 +1,31 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" set -euo pipefail
function get_os () { # shellcheck disable=SC1091
case $(uname -s) in source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
Linux*) echo linux;;
Darwin*) echo macOS;;
*) >&2 echo "unsupported os: $(uname -s)"; exit 1;;
esac
}
APP=gotemplate APP=gotemplate
VERSION=${VERSION:-3.7.0} VERSION=${VERSION:-3.7.2}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}" DEST="${XDG_DATA_HOME}/apps/releases/${APP}"
main() (
URL=https://github.com/coveooss/gotemplate/releases/download/v${VERSION}/gotemplate_${VERSION}_$(get_os)_64-bits.zip URL=https://github.com/coveooss/gotemplate/releases/download/v${VERSION}/gotemplate_${VERSION}_$(get_os)_64-bits.zip
extract_zip "${URL}" "${DEST}/${VERSION}" extract_zip "${URL}" "${DEST}/${VERSION}"
set_current_link "${DEST}" "${VERSION}" set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"
)
get_os() (
case $(uname -s) in
Linux*) echo linux ;;
Darwin*) echo macOS ;;
*)
echo >&2 "unsupported os: $(uname -s)"
exit 1
;;
esac
)
main "${@}"

@ -1,20 +1,30 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1090 set -euo pipefail
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
get_arch () { # shellcheck disable=SC1091
case $(uname -m) in source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
x86_64*) echo 64bit;;
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;;
esac
}
APP=hugo APP=hugo
VERSION=${VERSION:-0.88.1} VERSION=${VERSION:-0.111.3}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}" DEST="${XDG_DATA_HOME}/apps/releases/${APP}"
main() (
URL=https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_extended_${VERSION}_$(uname)-$(get_arch).tar.gz URL=https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_extended_${VERSION}_$(uname)-$(get_arch).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}" extract_tarball "${URL}" "${DEST}/${VERSION}"
set_current_link "${DEST}" "${VERSION}" set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"
)
get_arch() (
case $(uname -m) in
x86_64*) echo 64bit ;;
*)
echo >&2 "unsupported architecture: $(uname -m)"
exit 1
;;
esac
)
main "${@}"

@ -1,26 +1,19 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1090 set -euo pipefail
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
set -e
get_arch () { # shellcheck disable=SC1091
case $(uname -m) in source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
x86_64*) echo amd64;;
arm64*) echo arm64;;
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;;
esac
}
APP=kubectl APP=kubectl
# https://dl.k8s.io/release/stable.txt # https://dl.k8s.io/release/stable.txt
VERSION=${VERSION:-1.26.1} VERSION=${VERSION:-1.26.1}
DEST=${XDG_DATA_HOME}/apps/releases/${APP} DEST=${XDG_DATA_HOME}/apps/releases/${APP}
URL=https://dl.k8s.io/release/v${VERSION}/bin/$(get_os)/$(get_arch)/kubectl
APP_PATH=${DEST}/${VERSION}/kubectl APP_PATH=${DEST}/${VERSION}/kubectl
if [[ ! -f "${APP_PATH}" ]]; then
main() (
URL=https://dl.k8s.io/release/v${VERSION}/bin/$(get_os)/$(get_arch)/kubectl
if [[ ! -f ${APP_PATH} ]]; then
mkdir -p "${DEST}/${VERSION}" mkdir -p "${DEST}/${VERSION}"
curl --silent --location --output "${APP_PATH}" "${URL}" curl --silent --location --output "${APP_PATH}" "${URL}"
chmod +x "${APP_PATH}" chmod +x "${APP_PATH}"
@ -28,3 +21,17 @@ fi
set_current_link "${DEST}" "${VERSION}" set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"
)
get_arch() (
case $(uname -m) in
x86_64*) echo amd64 ;;
arm64*) echo arm64 ;;
*)
echo >&2 "unsupported architecture: $(uname -m)"
exit 1
;;
esac
)
main "${@}"

@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -euo pipefail
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=lego APP=lego
VERSION=${VERSION:-v4.10.2} VERSION=${VERSION:-v4.11.0}
DEST=${XDG_DATA_HOME}/apps/releases/${APP} DEST=${XDG_DATA_HOME}/apps/releases/${APP}
URL=https://github.com/go-acme/lego/releases/download/${VERSION}/lego_${VERSION}_$(get_os)_$(get_arch).tar.gz URL=https://github.com/go-acme/lego/releases/download/${VERSION}/lego_${VERSION}_$(get_os)_$(get_arch).tar.gz

@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -euo pipefail
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=lego APP=lego
VERSION=${VERSION:-v4.10.2} VERSION=${VERSION:-v4.11.0}
APPS_DIR=/usr/local/apps/${APP} APPS_DIR=/usr/local/apps/${APP}
URL=https://github.com/go-acme/lego/releases/download/${VERSION}/lego_${VERSION}_$(get_os)_$(get_arch).tar.gz URL=https://github.com/go-acme/lego/releases/download/${VERSION}/lego_${VERSION}_$(get_os)_$(get_arch).tar.gz

@ -1,16 +1,16 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -euo pipefail
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=minikube APP=minikube
VERSION=${VERSION:-1.25.2} VERSION=${VERSION:-1.30.1}
DEST=${XDG_DATA_HOME}/apps/releases/${APP} DEST=${XDG_DATA_HOME}/apps/releases/${APP}
URL=https://github.com/kubernetes/minikube/releases/download/v${VERSION}/minikube-$(get_os)-$(get_arch).tar.gz URL=https://github.com/kubernetes/minikube/releases/download/v${VERSION}/minikube-$(get_os)-$(get_arch).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1" extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1"
set_current_link "${DEST}" "${VERSION}" set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" minikube-$(get_os)-$(get_arch) set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "minikube-$(get_os)-$(get_arch)"
set_link "${XDG_BIN_HOME}/docker-machine-driver-kvm2" "${DEST}" docker-machine-driver-kvm2 set_link "${XDG_BIN_HOME}/docker-machine-driver-kvm2" "${DEST}" docker-machine-driver-kvm2

@ -1,12 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -euo pipefail
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=minikube APP=minikube
VERSION=${VERSION:-v1.25.2} VERSION=${VERSION:-1.30.1}
APPS_DIR=/usr/local/apps/${APP} APPS_DIR=/usr/local/apps/${APP}
URL=https://github.com/kubernetes/minikube/releases/download/${VERSION}/minikube-$(get_os)-$(get_arch).tar.gz URL=https://github.com/kubernetes/minikube/releases/download/${VERSION}/minikube-$(get_os)-$(get_arch).tar.gz

@ -1,13 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -euo pipefail
set -x
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=node_exporter APP=node_exporter
VERSION=${VERSION:-1.1.2} VERSION=${VERSION:-1.5.0}
APPS_DIR=/usr/local/apps/${APP} APPS_DIR=/usr/local/apps/${APP}
URL=https://github.com/prometheus/node_exporter/releases/download/v${VERSION}/node_exporter-${VERSION}.$(get_os)-$(get_arch).tar.gz URL=https://github.com/prometheus/node_exporter/releases/download/v${VERSION}/node_exporter-${VERSION}.$(get_os)-$(get_arch).tar.gz

@ -1,20 +1,32 @@
#!/usr/bin/env bash #!/usr/bin/env bash
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" set -euo pipefail
function get_os () ( # shellcheck disable=SC1091
case $(uname -s) in source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
Linux*) echo lnx;;
Darwin*) echo mac;;
*) >&2 echo "unsupported os: $(uname -s)"; exit 1;;
esac
)
APP=procs APP=procs
VERSION=${VERSION:-0.12.0} VERSION=${VERSION:-0.14.0}
DEST=${XDG_DATA_HOME}/apps/releases/${APP} DEST=${XDG_DATA_HOME}/apps/releases/${APP}
main() (
set -x
URL=https://github.com/dalance/procs/releases/download/v${VERSION}/procs-v${VERSION}-$(uname -m)-$(get_os).zip URL=https://github.com/dalance/procs/releases/download/v${VERSION}/procs-v${VERSION}-$(uname -m)-$(get_os).zip
extract_zip "${URL}" "${DEST}/${VERSION}" extract_zip "${URL}" "${DEST}/${VERSION}"
set_current_link "${DEST}" "${VERSION}" set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"
)
get_os() (
case $(uname -s) in
Linux*) echo linux ;;
Darwin*) echo mac ;;
*)
echo >&2 "unsupported os: $(uname -s)"
exit 1
;;
esac
)
main "${@}"

@ -1,13 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -euo pipefail
set -x
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=prometheus APP=prometheus
VERSION=${VERSION:-2.26.0} VERSION=${VERSION:-2.44.0}
APPS_DIR=/usr/local/apps/${APP} APPS_DIR=/usr/local/apps/${APP}
URL=https://github.com/prometheus/prometheus/releases/download/v${VERSION}/prometheus-${VERSION}.$(get_os)-$(get_arch).tar.gz URL=https://github.com/prometheus/prometheus/releases/download/v${VERSION}/prometheus-${VERSION}.$(get_os)-$(get_arch).tar.gz

@ -1,33 +1,22 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -euo pipefail
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
get_os () ( VERSION=${VERSION:-23.1}
case $(uname -s) in
Linux*) echo linux;;
Darwin*) echo osx;;
*) >&2 echo "unsupported os"; return;
esac
)
get_arch () (
uname -m
)
VERSION=${VERSION:-22.3}
APP=protoc APP=protoc
APPS_DIR=${XDG_DATA_HOME}/apps/releases/${APP} APPS_DIR=${XDG_DATA_HOME}/apps/releases/${APP}
VER_DIR=${APPS_DIR}/${VERSION} VER_DIR=${APPS_DIR}/${VERSION}
main() (
ZIP=protoc-${VERSION}-$(get_os)-$(get_arch).zip ZIP=protoc-${VERSION}-$(get_os)-$(get_arch).zip
TMP_DIR=$(mktemp -d) TMP_DIR=$(mktemp -d)
DEST_FILE=$TMP_DIR/$ZIP DEST_FILE=$TMP_DIR/$ZIP
URL=https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/${ZIP} URL=https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/${ZIP}
if [[ ! -d "${VER_DIR}" ]]; then if [[ ! -d ${VER_DIR} ]]; then
curl --output "${DEST_FILE}" --location "${URL}" curl --output "${DEST_FILE}" --location "${URL}"
mkdir -p "${VER_DIR}" mkdir -p "${VER_DIR}"
unzip -o "${DEST_FILE}" -d "${VER_DIR}" unzip -o "${DEST_FILE}" -d "${VER_DIR}"
@ -57,3 +46,21 @@ if [[ ! -s google ]]; then
google google
fi fi
popd popd
)
get_os() (
case $(uname -s) in
Linux*) echo linux ;;
Darwin*) echo osx ;;
*)
echo >&2 "unsupported os"
return
;;
esac
)
get_arch() (
uname -m
)
main "${@}"

@ -1,12 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -x set -euo pipefail
set -e
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
PROTOC_VERSION=${VERSION:-20.3} PROTOC_VERSION=${VERSION:-23.1}
PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip
TMP_DIR=$(mktemp --directory) TMP_DIR=$(mktemp --directory)
DEST_FILE=$TMP_DIR/$PROTOC_ZIP DEST_FILE=$TMP_DIR/$PROTOC_ZIP
@ -19,3 +18,5 @@ sudo unzip -o "$DEST_FILE" -d /usr/local 'include/*'
sudo find /usr/local/include/google -type f -exec chmod 644 {} \; sudo find /usr/local/include/google -type f -exec chmod 644 {} \;
sudo find /usr/local/include/google -type d -exec chmod 755 {} \; sudo find /usr/local/include/google -type d -exec chmod 755 {} \;
rm -rfv "$TMP_DIR" rm -rfv "$TMP_DIR"
main "${@}"

@ -2,33 +2,45 @@
set -euo pipefail set -euo pipefail
# shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
function get_os () ( APP=pulumi
VERSION=${VERSION:-3.53.1}
DEST=${XDG_DATA_HOME}/apps/releases/${APP}
main() (
URL=https://get.pulumi.com/releases/sdk/pulumi-v${VERSION}-$(get_os)-$(get_arch).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1"
set_current_link "${DEST}" "${VERSION}"
for PULUMI_APP in $(find "${DEST}/${VERSION}" -type f -exec basename "{}" \; | sort); do
set_link "${XDG_BIN_HOME}/${PULUMI_APP}" "${DEST}" "${PULUMI_APP}"
done
)
get_os() (
case $(uname -s) in case $(uname -s) in
Linux*) echo linux ;; Linux*) echo linux ;;
Darwin*) echo darwin ;; Darwin*) echo darwin ;;
*) >&2 echo "unsupported os: $(uname -s)"; exit 1;; *)
echo >&2 "unsupported os: $(uname -s)"
exit 1
;;
esac esac
) )
function get_arch () ( get_arch() (
case $(uname -m) in case $(uname -m) in
x86_64) echo x64 ;; x86_64) echo x64 ;;
arm64) echo arm64 ;; arm64) echo arm64 ;;
aarch64) echo arm64 ;; aarch64) echo arm64 ;;
*) >&2 echo "unsupported arch: $(uname -m)"; exit 1;; *)
echo >&2 "unsupported arch: $(uname -m)"
exit 1
;;
esac esac
) )
APP=pulumi main "${@}"
VERSION=${VERSION:-3.53.1}
DEST=${XDG_DATA_HOME}/apps/releases/${APP}
URL=https://get.pulumi.com/releases/sdk/pulumi-v${VERSION}-$(get_os)-$(get_arch).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1"
set_current_link "${DEST}" "${VERSION}"
for PULUMI_APP in $(find "${DEST}/${VERSION}" -type f -exec basename "{}" \; | sort); do
set_link "${XDG_BIN_HOME}/${PULUMI_APP}" "${DEST}" "${PULUMI_APP}"
done

@ -1,10 +1,12 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1090 set -euo pipefail
# shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=shellcheck APP=shellcheck
VERSION=${VERSION:-0.7.2} VERSION=${VERSION:-0.9.0}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}" DEST="${XDG_DATA_HOME}/apps/releases/${APP}"
URL=https://github.com/koalaman/shellcheck/releases/download/v${VERSION}/shellcheck-v${VERSION}.$(get_os).$(uname -m).tar.xz URL=https://github.com/koalaman/shellcheck/releases/download/v${VERSION}/shellcheck-v${VERSION}.$(get_os).$(uname -m).tar.xz

@ -1,18 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1090 set -euo pipefail
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
get_arch () { # shellcheck disable=SC1091
case $(uname -m) in source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
x86_64*) echo amd64;;
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;;
esac
}
APP=shfmt APP=shfmt
VERSION=${VERSION:-3.3.1} VERSION=${VERSION:-3.6.0}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}" DEST=${XDG_DATA_HOME}/apps/releases/${APP}
main() (
URL=https://github.com/mvdan/sh/releases/download/v${VERSION}/shfmt_v${VERSION}_$(get_os)_$(get_arch) URL=https://github.com/mvdan/sh/releases/download/v${VERSION}/shfmt_v${VERSION}_$(get_os)_$(get_arch)
mkdir_if_missing "${DEST}/${VERSION}" mkdir_if_missing "${DEST}/${VERSION}"
@ -20,3 +17,16 @@ curl --silent --location --output "${DEST}/${VERSION}/${APP}" "${URL}"
chmod 755 "${DEST}/${VERSION}/${APP}" chmod 755 "${DEST}/${VERSION}/${APP}"
set_current_link "${DEST}" "${VERSION}" set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"
)
get_arch() (
case $(uname -m) in
x86_64*) echo amd64 ;;
*)
echo >&2 "unsupported architecture: $(uname -m)"
exit 1
;;
esac
)
main "${@}"

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -ueo pipefail set -euo pipefail
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=sqlc APP=sqlc

@ -1,11 +1,27 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail
# shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=tile38 APP=tile38
VERSION=${VERSION:-1.30.2} VERSION=${VERSION:-1.31.0}
DEST=${XDG_DATA_HOME}/apps/releases/${APP} DEST=${XDG_DATA_HOME}/apps/releases/${APP}
main() (
case $(get_os) in
darwin) install_zip ;;
freebsd) install_zip ;;
windows) install_zip ;;
linux) install_targz ;;
*)
echo >&2 "unsupported os $(uname -s)"
exit 1
;;
esac
)
install_zip() ( install_zip() (
URL=https://github.com/tidwall/tile38/releases/download/${VERSION}/tile38-${VERSION}-$(get_os)-$(get_arch).zip URL=https://github.com/tidwall/tile38/releases/download/${VERSION}/tile38-${VERSION}-$(get_os)-$(get_arch).zip
extract_zip "${URL}" "${DEST}/${VERSION}" extract_zip "${URL}" "${DEST}/${VERSION}"
@ -29,10 +45,4 @@ install_targz () (
set_link "${XDG_BIN_HOME}/tile38-server" "${DEST}" tile38-server set_link "${XDG_BIN_HOME}/tile38-server" "${DEST}" tile38-server
) )
case $(get_os) in main "${@}"
darwin) install_zip;;
freebsd) install_zip;;
windows) install_zip;;
linux) install_targz;;
*) >&2 echo "unsupported os $(uname -s)"; exit 1;;
esac

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -euo pipefail
# shellcheck disable=SC1090 # shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=trubka APP=trubka

@ -1,8 +1,24 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1090 set -euo pipefail
# shellcheck disable=SC1091
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
APP=ttyd
VERSION=${VERSION:-1.7.2}
DEST=${XDG_DATA_HOME}/apps/releases/${APP}
main() (
URL=https://github.com/tsl0922/ttyd/releases/download/${VERSION}/ttyd.$(get_arch)
mkdir_if_missing "${DEST}/${VERSION}"
curl --silent --location --output "${DEST}/${VERSION}/${APP}" "${URL}"
chmod 755 "${DEST}/${VERSION}/${APP}"
set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"
)
get_arch() ( get_arch() (
case $(uname -m) in case $(uname -m) in
x86_64*) echo i686 ;; x86_64*) echo i686 ;;
@ -11,17 +27,11 @@ get_arch () (
i686*) echo i686 ;; i686*) echo i686 ;;
arm) echo arm ;; arm) echo arm ;;
aarch64*) echo aarch64 ;; aarch64*) echo aarch64 ;;
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;; *)
echo >&2 "unsupported architecture: $(uname -m)"
exit 1
;;
esac esac
) )
APP=ttyd main "${@}"
VERSION=${VERSION:-1.7.2}
DEST=${XDG_DATA_HOME}/apps/releases/${APP}
URL=https://github.com/tsl0922/ttyd/releases/download/${VERSION}/ttyd.$(get_arch)
mkdir_if_missing "${DEST}/${VERSION}"
curl --silent --location --output "${DEST}/${VERSION}/${APP}" "${URL}"
chmod 755 "${DEST}/${VERSION}/${APP}"
set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"

@ -1,20 +1,30 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# shellcheck disable=SC1090 set -euo pipefail
source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
get_arch () { # shellcheck disable=SC1091
case $(uname -m) in source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh"
x86_64*) echo amd64;;
*) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;;
esac
}
APP=vegeta APP=vegeta
VERSION=${VERSION:-12.8.4} VERSION=${VERSION:-12.8.4}
DEST="${XDG_DATA_HOME}/apps/releases/${APP}" DEST=${XDG_DATA_HOME}/apps/releases/${APP}
main() (
URL=https://github.com/tsenart/vegeta/releases/download/v${VERSION}/vegeta_${VERSION}_$(get_os)_$(get_arch).tar.gz URL=https://github.com/tsenart/vegeta/releases/download/v${VERSION}/vegeta_${VERSION}_$(get_os)_$(get_arch).tar.gz
extract_tarball "${URL}" "${DEST}/${VERSION}" extract_tarball "${URL}" "${DEST}/${VERSION}"
set_current_link "${DEST}" "${VERSION}" set_current_link "${DEST}" "${VERSION}"
set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"
)
get_arch() (
case $(uname -m) in
x86_64*) echo amd64 ;;
*)
echo >&2 "unsupported architecture: $(uname -m)"
exit 1
;;
esac
)
main "${@}"

Loading…
Cancel
Save