diff --git a/base/.config/bash/bashrc.d/aliases.sh b/base/.config/bash/bashrc.d/aliases.sh index 8b0a8ea..ab2c47d 100644 --- a/base/.config/bash/bashrc.d/aliases.sh +++ b/base/.config/bash/bashrc.d/aliases.sh @@ -12,7 +12,6 @@ alias +x='chmod +x' alias rsync-win='rsync --recursive --verbose --times --modify-window=1 ' alias simple-http-server='python3 -m http.server' -# shellcheck disable=SC1004 alias wget-opendir='wget --recursive --level 0 --continue --no-clobber \ --no-parent --execute robots=off --random-wait --limit-rate=800k \ --reject=html,htm,index' @@ -22,8 +21,8 @@ alias take='sudo chown $(whoami):$(whoami) ' alias pretty_json='jq --compact-output | prettier --parser json | bat --language json' if [[ $(uname) == Linux ]]; then - alias ls='ls --color=auto' - alias grep='grep --color=auto' - alias fgrep='fgrep --color=auto' - alias egrep='egrep --color=auto' + alias ls='ls --color=auto' + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' fi diff --git a/base/.config/bash/bashrc.d/bash.sh b/base/.config/bash/bashrc.d/bash.sh index 2196687..df78a9a 100644 --- a/base/.config/bash/bashrc.d/bash.sh +++ b/base/.config/bash/bashrc.d/bash.sh @@ -2,23 +2,23 @@ #ft=bash # always save bash history before showing prompt; allow reloading bashrc -if [[ ! "$PROMPT_COMMAND" =~ "history -a" ]]; then - PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" +if [[ ! $PROMPT_COMMAND =~ "history -a" ]]; then + PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND" fi # Disable capslock if [[ -x $(which setxkbmap) ]] && [[ $(uname) == Linux ]]; then - setxkbmap -option ctrl:nocaps + setxkbmap -option ctrl:nocaps fi # make less more friendly for non-text input files, see lesspipe(1) if [ -x /usr/bin/lesspipe ]; then - eval "$(SHELL=/bin/sh lesspipe)" + eval "$(SHELL=/bin/sh lesspipe)" fi # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then - if test -r ~/.dircolors ; then - eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" - fi + if test -r ~/.dircolors; then + eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + fi fi diff --git a/base/.config/bash/bashrc.d/completion.sh b/base/.config/bash/bashrc.d/completion.sh index 649c01a..498ded4 100644 --- a/base/.config/bash/bashrc.d/completion.sh +++ b/base/.config/bash/bashrc.d/completion.sh @@ -2,27 +2,27 @@ # shellcheck disable=SC1091 if [ -f /etc/bash_completion ]; then - source /etc/bash_completion + source /etc/bash_completion fi # shellcheck disable=SC1091 if [ -f /usr/local/etc/bash_completion ]; then - source /usr/local/etc/bash_completion + source /usr/local/etc/bash_completion fi COMPLETION_DIR=/usr/local/etc/bash_completion.d/ if [ -d "$COMPLETION_DIR" ]; then - # shellcheck disable=SC2045 - for i in $(ls "$COMPLETION_DIR"); do - file="$COMPLETION_DIR/$i" - if [ -r "${file}" ]; then - # shellcheck disable=SC1090 - source "${file}" - fi - unset file - done - unset i + # shellcheck disable=SC2045 + for i in $(ls "$COMPLETION_DIR"); do + file="$COMPLETION_DIR/$i" + if [ -r "${file}" ]; then + # shellcheck disable=SC1090 + source "${file}" + fi + unset file + done + unset i fi unset COMPLETION_DIR diff --git a/base/.config/bash/bashrc.d/functions.sh b/base/.config/bash/bashrc.d/functions.sh index 1ac565b..384bb55 100644 --- a/base/.config/bash/bashrc.d/functions.sh +++ b/base/.config/bash/bashrc.d/functions.sh @@ -2,29 +2,17 @@ #ft=bash function min-jpg { - if ! command -v jpegtran &> /dev/null ; then - echo "jpegtran not installed" - fi - tmpfile="$(mktemp)" - ogfile="$1" - jpegtran -optimize -perfect -outfile "$tmpfile" "$ogfile" - mv "$tmpfile" "$ogfile" + min_jpg "${@}" } function min-png { - if ! command -v pngcrush &> /dev/null ; then - echo "pngcrush not installed" - fi - tmpfile="$(mktemp)" - ogfile="$1" - pngcrush -rem alla -reduce -brute "$ogfile" "$tmpfile" - mv "$tmpfile" "$ogfile" + min_png "${@}" } function get-create-date { - date -r "$1" +"%F" + get_create_date "${@}" } function add-date-prefix { - add_date_prefix "$1" "$2" + add_date_prefix "${@}" } diff --git a/base/.config/bash/bashrc.d/jetbrains.sh b/base/.config/bash/bashrc.d/jetbrains.sh index 35b7281..5af6e87 100644 --- a/base/.config/bash/bashrc.d/jetbrains.sh +++ b/base/.config/bash/bashrc.d/jetbrains.sh @@ -2,7 +2,7 @@ #ft=bash if [[ -d "${XDG_DATA_HOME}/JetBrains/Toolbox/scripts" ]]; then - if [[ ":${PATH}:" != *":${XDG_DATA_HOME}/JetBrains/Toolbox/scripts:"* ]]; then - export PATH="${PATH}:${XDG_DATA_HOME}/JetBrains/Toolbox/scripts" - fi + if [[ ":${PATH}:" != *":${XDG_DATA_HOME}/JetBrains/Toolbox/scripts:"* ]]; then + export PATH="${PATH}:${XDG_DATA_HOME}/JetBrains/Toolbox/scripts" + fi fi diff --git a/base/.config/bash/bashrc.d/opts.sh b/base/.config/bash/bashrc.d/opts.sh index 273b733..4787b67 100644 --- a/base/.config/bash/bashrc.d/opts.sh +++ b/base/.config/bash/bashrc.d/opts.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash #ft=bash -if [[ ! "${BASH_VERSION}" = "3.2*" ]]; then - shopt -s autocd +if [[ ${BASH_VERSION} != "3.2*" ]]; then + shopt -s autocd fi # append to the history file, don't overwrite it diff --git a/base/.config/profile/profile.d/base.sh b/base/.config/profile/profile.d/base.sh index 157d873..fc10aad 100644 --- a/base/.config/profile/profile.d/base.sh +++ b/base/.config/profile/profile.d/base.sh @@ -1,83 +1,121 @@ #ft=sh +#shellcheck shell=sh -if type nvim >/dev/null 2>/dev/null ; then - export EDITOR=nvim - alias vim=nvim +if type nvim >/dev/null 2>/dev/null; then + export EDITOR=nvim + alias vim=nvim else - export EDITOR=vim + export EDITOR=vim 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() { + if [ ! -f "${1}" ]; then + return + fi + eval "$( + grep -v '^\s*\#' "${1}" | + grep -v '^\s*$' | + sed 's/^\s*export//g' | + sed 's/^/export /g' + )" +} + +add_date_prefix() ( + DIR=$(dirname "$1") + FILE=$(basename "$1") + DATE=$(date -r "$1" +"%F") + if [ ! -f "$1" ]; then + echo "unknown file: $1" + exit 1 + fi + mv "$1" "$DIR/${DATE}_${FILE}" ) -source_env_file () { - if [ ! -f "${1}" ]; then - return - fi - eval "$( - grep -v '^\s*\#' "${1}" | - grep -v '^\s*$' | - sed 's/^\s*export//g' | - sed 's/^/export /g' - )" -} +get_bitrate() ( + if [ ! -f "$1" ]; then + echo "[ERROR] unknown file: $1" + exit 1 + fi + if ! command -v exiftool >/dev/null; then + echo "[ERROR] exiftool not installed" + exit 1 + fi + exiftool -AudioBitrate "$1" | awk '{print $4}' +) + +json_to_yaml() ( + ARG=${1-} + if [ -z "${ARG}" ]; then + dasel --read json --write yaml | bat --language yaml + elif [ -f "${ARG}" ]; then + dasel --read json --write yaml --file "${ARG}" | bat --language yaml + else + echo "${ARG}" | dasel --read json --write yaml | bat --language yaml + fi +) + +yaml_to_json() ( + ARG=${1-} + if [ -z "${ARG}" ]; then + dasel --read yaml --write json | bat --language json + elif [ -f "${ARG}" ]; then + dasel --read yaml --write json --file "${ARG}" | bat --language json + else + echo "${ARG}" | dasel --read yaml --write json | bat --language json + fi +) + +github_releases() ( + USER=${1} + 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" \ + "https://api.github.com/repos/${USER}/${REPO}/releases" +) -add_date_prefix () ( - DIR=$(dirname "$1") - FILE=$(basename "$1") - DATE=$(date -r "$1" +"%F") - if [ ! -f "$1" ] ; then - echo "unknown file: $1" - exit 1 - fi - mv "$1" "$DIR/${DATE}_${FILE}" +command_installed() ( + set -ue + cmd=${1} + if ! command -v "${cmd}" 1>&2 >/dev/null; then + echo "${cmd} not installed" 1>&2 + exit 1 + fi ) -get_bitrate () ( - if [ ! -f "$1" ] ; then - echo "[ERROR] unknown file: $1" - exit 1 - fi - if ! command -v exiftool > /dev/null ; then - echo "[ERROR] exiftool not installed" - exit 1 - fi - exiftool -AudioBitrate "$1" | awk '{print $4}' +min_jpg() ( + set -ue + command_installed jpegtran + file=$1 + out_file=$(mktemp) + jpegtran -optimize -perfect -outfile "$out_file" "$file" + mv "$out_file" "$file" ) -json_to_yaml () ( - ARG=${1:-} - if [ -z "${ARG}" ] ; then - dasel --read json --write yaml | bat --language yaml - elif [ -f "${ARG}" ] ; then - dasel --read json --write yaml --file "${ARG}" | bat --language yaml - else - echo "${ARG}" | dasel --read json --write yaml | bat --language yaml - fi +min_png() ( + set -ue + command_installed pngcrush + out_file=$(mktemp) + file=$1 + pngcrush -rem alla -reduce -brute "$file" "$out_file" + mv "$out_file" "$file" ) -yaml_to_json () ( - ARG=${1:-} - if [ -z "${ARG}" ] ; then - dasel --read yaml --write json | bat --language json - elif [ -f "${ARG}" ] ; then - dasel --read yaml --write json --file "${ARG}" | bat --language json - else - echo "${ARG}" | dasel --read yaml --write json | bat --language json - fi +get_create_date() ( + date -r "$1" +"%F" ) -github_releases () ( - USER=${1} - REPO=${2} - curl --silent --header "Accept: application/vnd.github.v3+json" \ - "https://api.github.com/repos/${USER}/${REPO}/releases" +#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 ) diff --git a/base/.local/share/buddy-up/includes/github.sh b/base/.local/share/buddy-up/includes/github.sh index bfce802..8b038cd 100644 --- a/base/.local/share/buddy-up/includes/github.sh +++ b/base/.local/share/buddy-up/includes/github.sh @@ -1,31 +1,31 @@ #!/usr/bin/env bash -latest_download () ( - FILTER='import "github" as gh; gh::latest_download(env.OS; env.ARCH)' - OS=${2} ARCH="${3}" jq --raw-output "${FILTER}" <"$(release_json "${1}")" +latest_download() ( + FILTER='import "github" as gh; gh::latest_download(env.OS; env.ARCH)' + OS=${2} ARCH="${3}" jq --raw-output "${FILTER}" <"$(release_json "${1}")" ) -latest_type () ( - FILTER='import "github" as gh; gh::latest_type(env.OS; env.ARCH)' - OS=${2} ARCH="${3}" jq --raw-output "${FILTER}" <"$(release_json "${1}")" +latest_type() ( + FILTER='import "github" as gh; gh::latest_type(env.OS; env.ARCH)' + OS=${2} ARCH="${3}" jq --raw-output "${FILTER}" <"$(release_json "${1}")" ) -latest_version () ( - FILTER='import "github" as gh; gh::latest_version' - jq --raw-output "${FILTER}" <"$(release_json "${1}")" +latest_version() ( + FILTER='import "github" as gh; gh::latest_version' + jq --raw-output "${FILTER}" <"$(release_json "${1}")" ) -age_in_seconds () ( - echo $(( $(date +"%s") - $(stat -c "%Y" "${1}") )) +age_in_seconds() ( + echo $(($(date +"%s") - $(stat -c "%Y" "${1}"))) ) -release_json () ( - DAY=$((60 * 60 * 24)) - PROJECT=$1 - JSON=${XDG_CACHE_HOME}/apps/meta/${PROJECT}/releases.json - mkdir -p "$(dirname "${JSON}")" - if [[ ! -f "${JSON}" || "$(age_in_seconds "${JSON}")" -gt "${DAY}" ]]; then - curl --silent --output "${JSON}" "https://api.github.com/repos/${PROJECT}/releases" - fi - echo "${JSON}" +release_json() ( + DAY=$((60 * 60 * 24)) + PROJECT=$1 + JSON=${XDG_CACHE_HOME}/apps/meta/${PROJECT}/releases.json + mkdir -p "$(dirname "${JSON}")" + if [[ ! -f ${JSON} || "$(age_in_seconds "${JSON}")" -gt ${DAY} ]]; then + curl --silent --output "${JSON}" "https://api.github.com/repos/${PROJECT}/releases" + fi + echo "${JSON}" ) diff --git a/base/.local/share/buddy-up/includes/utils.sh b/base/.local/share/buddy-up/includes/utils.sh index 803bbd3..83c22bb 100644 --- a/base/.local/share/buddy-up/includes/utils.sh +++ b/base/.local/share/buddy-up/includes/utils.sh @@ -1,178 +1,184 @@ #ft=bash -bail () ( - >&2 echo "ERROR: $1" - exit 1 +bail() ( + echo >&2 "ERROR: $1" + exit 1 ) -must_be_root () ( - if [ "$(id --user)" != 0 ]; then - bail "must run as root" - fi +must_be_root() ( + if [ "$(id --user)" != 0 ]; then + bail "must run as root" + fi ) -set_link () ( - TARGET=${1} - APP_DIR=${2} - APP_PATH=${3:-} +set_link() ( + TARGET=${1} + APP_DIR=${2} + APP_PATH=${3-} - pushd "$(dirname "${TARGET}")" >/dev/null || exit 1 - unlink_if_set "${TARGET}" - REL_PATH=$(relative_path "$(dirname "${TARGET}")" "${APP_DIR}/current/${APP_PATH}") - ln -s "${REL_PATH}" "$(basename "${TARGET}")" - popd >/dev/null || exit 1 + pushd "$(dirname "${TARGET}")" >/dev/null || exit 1 + unlink_if_set "${TARGET}" + REL_PATH=$(relative_path "$(dirname "${TARGET}")" "${APP_DIR}/current/${APP_PATH}") + ln -s "${REL_PATH}" "$(basename "${TARGET}")" + popd >/dev/null || exit 1 ) -get_os () ( - case $(uname -s) in - Linux*) echo linux;; - Darwin*) echo darwin;; - Dragonfly*) echo dragonfly;; - FreeBSD*) echo freebsd;; - NetBSD*) echo netbsd;; - OpenBSD*) echo openbsd;; - SunOS*) echo solaris;; - Windows_NT*) echo windows;; - CYGWIN_NT*) echo windows;; - *) >&2 echo "unsupported os"; return; - esac +get_os() ( + case $(uname -s) in + Linux*) echo linux ;; + Darwin*) echo darwin ;; + Dragonfly*) echo dragonfly ;; + FreeBSD*) echo freebsd ;; + NetBSD*) echo netbsd ;; + OpenBSD*) echo openbsd ;; + SunOS*) echo solaris ;; + Windows_NT*) echo windows ;; + CYGWIN_NT*) echo windows ;; + *) + echo >&2 "unsupported os" + return + ;; + esac ) -get_arch () ( - case $(uname -m) in - x86_64*) echo amd64;; - amd64*) echo amd64;; - i386*) echo 386;; - i686*) echo 386;; - arm) echo arm;; - armv7*) echo arm;; - armv6*) echo arm;; - armv8*) echo arm;; - aarch64*) echo arm64;; - *) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;; - esac +get_arch() ( + case $(uname -m) in + x86_64*) echo amd64 ;; + amd64*) echo amd64 ;; + i386*) echo 386 ;; + i686*) echo 386 ;; + arm) echo arm ;; + armv7*) echo arm ;; + armv6*) echo arm ;; + armv8*) echo arm ;; + aarch64*) echo arm64 ;; + *) + echo >&2 "unsupported architecture: $(uname -m)" + exit 1 + ;; + esac ) -set_current_link () ( - prefix=${1} - version=${2} - sudo=${3:-} - current="${prefix}/current" - if [ -L "${current}" ] ; then - $sudo unlink "${current}" - fi - rel="$(relative_path "${prefix}" "${prefix}/${version}")" - $sudo ln -s "$rel" "${current}" +set_current_link() ( + prefix=${1} + version=${2} + sudo=${3-} + current="${prefix}/current" + if [ -L "${current}" ]; then + $sudo unlink "${current}" + fi + rel="$(relative_path "${prefix}" "${prefix}/${version}")" + $sudo ln -s "$rel" "${current}" ) -unlink_if_set () ( - dir=$1 - sudo=${2:-} - if [ -L "${dir}" ]; then - # shellcheck disable=SC2086 - ${sudo} unlink "${dir}" - fi +unlink_if_set() ( + dir=$1 + sudo=${2-} + if [ -L "${dir}" ]; then + # shellcheck disable=SC2086 + ${sudo} unlink "${dir}" + fi ) -mkdir_if_missing () ( - dir=${1} - sudo=${2:-} - if [ ! -d "${dir}" ]; then - # shellcheck disable=SC2086 - $sudo mkdir -p "${dir}" - fi +mkdir_if_missing() ( + dir=${1} + sudo=${2-} + if [ ! -d "${dir}" ]; then + # shellcheck disable=SC2086 + $sudo mkdir -p "${dir}" + fi ) -extract_zip () ( - url=${1} - dest=${2} - args=${3:-} - sudo=${4:-} - if [ -d "${dest}" ]; then - return - fi - - mkdir_if_missing "${dest}" "${sudo}" - tmp_dir="$(mktemp -d)" - zipfile=${tmp_dir}/release.zip - curl --silent --location --output "${zipfile}" "${url}" - # shellcheck disable=SC2086 - $sudo unzip -o "${zipfile}" -d "${dest}" ${args} - rm -rf "${tmp_dir}" +extract_zip() ( + url=${1} + dest=${2} + args=${3-} + sudo=${4-} + if [ -d "${dest}" ]; then + return + fi + + mkdir_if_missing "${dest}" "${sudo}" + tmp_dir="$(mktemp -d)" + zipfile=${tmp_dir}/release.zip + curl --silent --location --output "${zipfile}" "${url}" + # shellcheck disable=SC2086 + $sudo unzip -o "${zipfile}" -d "${dest}" ${args} + rm -rf "${tmp_dir}" ) -extract_tarball () ( - url=${1} - dest=${2} - args=${3:-} - sudo=${4:-} - if [ -d "${dest}" ]; then - return - fi - - mkdir_if_missing "${dest}" "${sudo}" - tmp_dir="$(mktemp -d)" - tarball=${tmp_dir}/release.tar.gz - curl --silent --location --output "${tarball}" "${url}" - # shellcheck disable=SC2086 - $sudo tar xf "${tarball}" --directory "${dest}" ${args} - rm -rf "${tmp_dir}" +extract_tarball() ( + url=${1} + dest=${2} + args=${3-} + sudo=${4-} + if [ -d "${dest}" ]; then + return + fi + + mkdir_if_missing "${dest}" "${sudo}" + tmp_dir="$(mktemp -d)" + tarball=${tmp_dir}/release.tar.gz + curl --silent --location --output "${tarball}" "${url}" + # shellcheck disable=SC2086 + $sudo tar xf "${tarball}" --directory "${dest}" ${args} + rm -rf "${tmp_dir}" ) -extract_binary () ( - url=${1} - dest=${2} - sudo=${3:-} - if [ -f "${dest}" ]; then - return - fi - mkdir_if_missing "$(dirname "${dest}")" "${sudo}" - tmp_file="$(mktemp)" - curl --silent --location --output "${tmp_file}" "${url}" - $sudo chmod +x "${tmp_file}" - $sudo mv "${tmp_file}" "${dest}" +extract_binary() ( + url=${1} + dest=${2} + sudo=${3-} + if [ -f "${dest}" ]; then + return + fi + mkdir_if_missing "$(dirname "${dest}")" "${sudo}" + tmp_file="$(mktemp)" + curl --silent --location --output "${tmp_file}" "${url}" + $sudo chmod +x "${tmp_file}" + $sudo mv "${tmp_file}" "${dest}" ) relative_path() ( - # both $1 and $2 are absolute paths beginning with / - # $1 must be a canonical path; that is none of its directory - # components may be ".", ".." or a symbolic link - # - # returns relative path to $2/$target from $1/$src - src=$1 - target=$2 - - common_part=$src - result= - - while [ "${target#"$common_part"}" = "$target" ]; do - # no match, means that candidate common part is not correct - # go up one level (reduce common part) - common_part=$(dirname "$common_part") - # and record that we went back, with correct / handling - if [ -z "$result" ]; then - result=.. - else - result=../$result - fi - done - - if [ "$common_part" = / ]; then - # special case for root (no common path) - result=$result/ - fi - - # since we now have identified the common part, - # compute the non-common part - forward_part=${target#"$common_part"} - - # and now stick all parts together - if [ -n "$result" ] && [ -n "$forward_part" ]; then - result=$result$forward_part - elif [ -n "$forward_part" ]; then - # extra slash removal - result=${forward_part#?} - fi - - printf '%s' "$result" + # both $1 and $2 are absolute paths beginning with / + # $1 must be a canonical path; that is none of its directory + # components may be ".", ".." or a symbolic link + # + # returns relative path to $2/$target from $1/$src + src=$1 + target=$2 + + common_part=$src + result= + + while [ "${target#"$common_part"}" = "$target" ]; do + # no match, means that candidate common part is not correct + # go up one level (reduce common part) + common_part=$(dirname "$common_part") + # and record that we went back, with correct / handling + if [ -z "$result" ]; then + result=.. + else + result=../$result + fi + done + + if [ "$common_part" = / ]; then + # special case for root (no common path) + result=$result/ + fi + + # since we now have identified the common part, + # compute the non-common part + forward_part=${target#"$common_part"} + + # and now stick all parts together + if [ -n "$result" ] && [ -n "$forward_part" ]; then + result=$result$forward_part + elif [ -n "$forward_part" ]; then + # extra slash removal + result=${forward_part#?} + fi + + printf '%s' "$result" ) diff --git a/install-scripts/.local/bin/install-aax-to-mp3 b/install-scripts/.local/bin/install-aax-to-mp3 index 7cb611b..4aec917 100755 --- a/install-scripts/.local/bin/install-aax-to-mp3 +++ b/install-scripts/.local/bin/install-aax-to-mp3 @@ -2,7 +2,7 @@ set -euo pipefail -# shellcheck disable=SC1090 +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=aax-to-mp3 @@ -10,7 +10,7 @@ VERSION=${VERSION:-1.3} DEST=${XDG_DATA_HOME}/apps/releases/${APP} URL=https://github.com/KrumpetPirate/AAXtoMP3/releases/download/v${VERSION}/AAXtoMP3-v${VERSION}.tar.gz -extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-component 1" +extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-component 1" set_current_link "${DEST}" "${VERSION}" -set_link "${XDG_BIN_HOME}/AAXtoMP3" "${DEST}" AAXtoMP3 +set_link "${XDG_BIN_HOME}/AAXtoMP3" "${DEST}" AAXtoMP3 set_link "${XDG_BIN_HOME}/interactiveAAXtoMP3" "${DEST}" interactiveAAXtoMP3 diff --git a/install-scripts/.local/bin/install-age b/install-scripts/.local/bin/install-age index 0f71c78..fc31359 100755 --- a/install-scripts/.local/bin/install-age +++ b/install-scripts/.local/bin/install-age @@ -1,14 +1,16 @@ #!/usr/bin/env bash -# shellcheck disable=SC1090 +set -euo pipefail + +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=age 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 extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-components 1" set_current_link "${DEST}" "${VERSION}" -set_link "${XDG_BIN_HOME}/age" "${DEST}" age +set_link "${XDG_BIN_HOME}/age" "${DEST}" age set_link "${XDG_BIN_HOME}/age-keygen" "${DEST}" age-keygen diff --git a/install-scripts/.local/bin/install-cert-manager-cmctl b/install-scripts/.local/bin/install-cert-manager-cmctl index 50e51e9..963a41b 100755 --- a/install-scripts/.local/bin/install-cert-manager-cmctl +++ b/install-scripts/.local/bin/install-cert-manager-cmctl @@ -1,21 +1,31 @@ #!/usr/bin/env bash -# shellcheck disable=SC1090 -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 -} +set -euo pipefail +# shellcheck disable=SC1091 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=cmctl VERSION=${VERSION:-1.6.1} -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 +DEST=${XDG_DATA_HOME}/apps/releases/${APP} + +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}" + set_current_link "${DEST}" "${VERSION}" + 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 +) -extract_tarball "${URL}" "${DEST}/${VERSION}" -set_current_link "${DEST}" "${VERSION}" -set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" +main "${@}" diff --git a/install-scripts/.local/bin/install-chezmoi b/install-scripts/.local/bin/install-chezmoi index 021e1e7..eb06897 100755 --- a/install-scripts/.local/bin/install-chezmoi +++ b/install-scripts/.local/bin/install-chezmoi @@ -1,24 +1,34 @@ #!/usr/bin/env bash -# shellcheck disable=SC1090 -source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" +set -euo pipefail -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=chezmoi -VERSION=${VERSION:-2.22.1} -DEST="${XDG_DATA_HOME}/apps/releases/${APP}" -URL=https://github.com/twpayne/chezmoi/releases/download/v${VERSION}/chezmoi_${VERSION}_$(get_os)_$(get_arch).tar.gz +VERSION=${VERSION:-2.33.6} +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 + + extract_tarball "${URL}" "${DEST}/${VERSION}" + set_current_link "${DEST}" "${VERSION}" + set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" + set_link "${XDG_CONFIG_HOME}/bash/bashrc.d/chezmoi.sh" "${DEST}" "completions/chezmoi-completion.bash" + 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_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 +) -extract_tarball "${URL}" "${DEST}/${VERSION}" -set_current_link "${DEST}" "${VERSION}" -set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" -set_link "${XDG_CONFIG_HOME}/bash/bashrc.d/chezmoi.sh" "${DEST}" "completions/chezmoi-completion.bash" -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_DATA_HOME}/doc/chezmoi" "${DEST}" "docs" +main "${@}" diff --git a/install-scripts/.local/bin/install-dasel-home b/install-scripts/.local/bin/install-dasel-home index 5abf243..5279297 100755 --- a/install-scripts/.local/bin/install-dasel-home +++ b/install-scripts/.local/bin/install-dasel-home @@ -1,22 +1,32 @@ #!/usr/bin/env bash -# shellcheck disable=SC1090 -source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" +set -euo pipefail -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=dasel VERSION=${VERSION:-2.2.0} DEST=${XDG_DATA_HOME}/apps/releases/${APP} -URL=https://github.com/TomWright/dasel/releases/download/v${VERSION}/dasel_$(get_os)_$(get_arch) -mkdir_if_missing "${DEST}/${VERSION}" -curl --silent --location --output "${DEST}/${VERSION}/dasel" "${URL}" -chmod 755 "${DEST}/${VERSION}/dasel" -set_current_link "${DEST}" "${VERSION}" -set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" +main() ( + URL=https://github.com/TomWright/dasel/releases/download/v${VERSION}/dasel_$(get_os)_$(get_arch) + + mkdir_if_missing "${DEST}/${VERSION}" + curl --silent --location --output "${DEST}/${VERSION}/dasel" "${URL}" + chmod 755 "${DEST}/${VERSION}/dasel" + set_current_link "${DEST}" "${VERSION}" + 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 "${@}" diff --git a/install-scripts/.local/bin/install-dust b/install-scripts/.local/bin/install-dust index d82efff..295efae 100755 --- a/install-scripts/.local/bin/install-dust +++ b/install-scripts/.local/bin/install-dust @@ -1,20 +1,31 @@ #!/usr/bin/env bash -source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" +set -euo pipefail -function get_os () { - case $(uname -s) in - Linux*) echo unknown-linux-gnu;; - Darwin*) echo apple-darwin;; - *) >&2 echo "unsupported os: $(uname -s)"; exit 1;; - esac -} +# shellcheck disable=SC1091 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=dust -VERSION=${VERSION:-0.6.2} -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" +VERSION=${VERSION:-0.8.6} +DEST=${XDG_DATA_HOME}/apps/releases/${APP} + +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" + set_current_link "${DEST}" "${VERSION}" + 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 +) -extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-component 1" -set_current_link "${DEST}" "${VERSION}" -set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" +main "${@}" diff --git a/install-scripts/.local/bin/install-etcd-system b/install-scripts/.local/bin/install-etcd-system index 145fb13..5e35e10 100755 --- a/install-scripts/.local/bin/install-etcd-system +++ b/install-scripts/.local/bin/install-etcd-system @@ -1,12 +1,12 @@ #!/usr/bin/env bash -set -e +set -euo pipefail -# shellcheck disable=SC1090 +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=etcd -VERSION=${VERSION:-v3.4.15} +VERSION=${VERSION:-v3.5.9} APPS_DIR=/usr/local/apps/${APP} URL=https://github.com/etcd-io/etcd/releases/download/${VERSION}/etcd-${VERSION}-$(get_os)-$(get_arch).tar @@ -16,9 +16,9 @@ set_current_link "${APPS_DIR}" "${VERSION}" sudo apps=$(find ${APPS_DIR}/current/ -maxdepth 1 -executable -type f -exec basename {} \;) cd /usr/local/bin for bin in $apps; do - if [[ ! -s $bin ]]; then - sudo ln --symbolic \ - "$(relative_path "/usr/local/bin" "${APPS_DIR}/current/${bin}")" \ - "${bin}" - fi + if [[ ! -s $bin ]]; then + sudo ln --symbolic \ + "$(relative_path "/usr/local/bin" "${APPS_DIR}/current/${bin}")" \ + "${bin}" + fi done diff --git a/install-scripts/.local/bin/install-evans b/install-scripts/.local/bin/install-evans index 745d698..fbb4913 100755 --- a/install-scripts/.local/bin/install-evans +++ b/install-scripts/.local/bin/install-evans @@ -1,22 +1,30 @@ #!/usr/bin/env bash -set -e +set -euo pipefail -# shellcheck disable=SC1090 +# shellcheck disable=SC1091 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 -VERSION=${VERSION:-0.10.2} -DEST="${XDG_DATA_HOME}/apps/releases/${APP}" -URL=https://github.com/ktr0731/evans/releases/download/${VERSION}/evans_$(get_os)_$(get_arch).tar.gz +VERSION=${VERSION:-v0.10.11} +DEST=${XDG_DATA_HOME}/apps/releases/${APP} + +main() ( + URL=https://github.com/ktr0731/evans/releases/download/${VERSION}/evans_$(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_arch() ( + case $(uname -m) in + x86_64*) echo amd64 ;; + *) + echo >&2 "unsupported architecture: $(uname -m)" + exit 1 + ;; + esac +) -extract_tarball "${URL}" "${DEST}/${VERSION}" -set_current_link "${DEST}" "${VERSION}" -set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" +main "${@}" diff --git a/install-scripts/.local/bin/install-geckodriver b/install-scripts/.local/bin/install-geckodriver index addb721..61286d0 100755 --- a/install-scripts/.local/bin/install-geckodriver +++ b/install-scripts/.local/bin/install-geckodriver @@ -2,35 +2,46 @@ set -euo pipefail -# shellcheck disable=SC1090 +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" -get_os () ( - case $(uname -s) in - Linux*) echo linux;; - Darwin*) echo macos;; - Windows_NT*) echo win;; - CYGWIN_NT*) echo win;; - *) >&2 echo "unsupported os"; exit 1; - esac +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_arch () ( - case $(uname -m) in - x86_64*) echo 64;; - amd64*) echo 64;; - i386*) echo 32;; - i686*) echo 32;; - aarch64*) echo aarch64;; - *) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;; - esac +get_os() ( + case $(uname -s) in + Linux*) echo linux ;; + Darwin*) echo macos ;; + Windows_NT*) echo win ;; + CYGWIN_NT*) echo win ;; + *) + echo >&2 "unsupported os" + exit 1 + ;; + esac ) -APP=geckodriver -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 +get_arch() ( + case $(uname -m) in + x86_64*) echo 64 ;; + amd64*) echo 64 ;; + i386*) echo 32 ;; + i686*) echo 32 ;; + aarch64*) echo aarch64 ;; + *) + echo >&2 "unsupported architecture: $(uname -m)" + exit 1 + ;; + esac +) -extract_tarball "${URL}" "${DEST}/${VERSION}" -set_current_link "${DEST}" "${VERSION}" -set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" ${APP} +main "${@}" diff --git a/install-scripts/.local/bin/install-gitea-home b/install-scripts/.local/bin/install-gitea-home index b89e676..e5828ff 100755 --- a/install-scripts/.local/bin/install-gitea-home +++ b/install-scripts/.local/bin/install-gitea-home @@ -1,36 +1,46 @@ #!/usr/bin/env bash -# shellcheck disable=SC1090 -source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" +set -euo pipefail -function get_os () { - case $(uname -s) in - Linux*) echo linux;; - Darwin*) echo darwin-10.12;; - *) >&2 echo "unsupported os: $(uname -s)"; exit 1;; - esac -} +# shellcheck disable=SC1091 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=gitea DEST=${XDG_DATA_HOME}/apps/releases/${APP} CURRENT=${DEST}/current VERSION=${VERSION:-1.19.0} -URL=https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-$(get_os)-$(get_arch).xz - -if [ ! -d "${DEST}/${VERSION}" ]; then - tmp_dir="$(mktemp -d)" - file=${tmp_dir}/gitea - curl --silent --retry 5 --location --output "${file}.xz" "${URL}" - xz --decompress "${file}.xz" - chmod 755 "${file}" - mkdir -p "${DEST}/${VERSION}" - mv "${file}" "${DEST}/${VERSION}/${APP}" - - rm -rf "${tmp_dir}" -fi -set_current_link "${DEST}" "${VERSION}" - -unlink_if_set "${XDG_BIN_HOME}/${APP}" -cd "${XDG_BIN_HOME}" || exit 1 -ln -s "$(relative_path "${XDG_BIN_HOME}" "${CURRENT}/${APP}")" "${APP}" -cd - &> /dev/null || exit 1 + +main() ( + URL=https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-$(get_os)-$(get_arch).xz + + if [ ! -d "${DEST}/${VERSION}" ]; then + tmp_dir="$(mktemp -d)" + file=${tmp_dir}/gitea + curl --silent --retry 5 --location --output "${file}.xz" "${URL}" + xz --decompress "${file}.xz" + chmod 755 "${file}" + mkdir -p "${DEST}/${VERSION}" + mv "${file}" "${DEST}/${VERSION}/${APP}" + + rm -rf "${tmp_dir}" + fi + set_current_link "${DEST}" "${VERSION}" + + unlink_if_set "${XDG_BIN_HOME}/${APP}" + cd "${XDG_BIN_HOME}" || exit 1 + ln -s "$(relative_path "${XDG_BIN_HOME}" "${CURRENT}/${APP}")" "${APP}" + 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 "${@}" diff --git a/install-scripts/.local/bin/install-gitea-system b/install-scripts/.local/bin/install-gitea-system index 6b83462..7622ec6 100755 --- a/install-scripts/.local/bin/install-gitea-system +++ b/install-scripts/.local/bin/install-gitea-system @@ -1,38 +1,48 @@ #!/usr/bin/env bash -# shellcheck disable=SC1090 -source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" +set -euo pipefail -function get_os () { - case $(uname -s) in - Linux*) echo linux;; - Darwin*) echo darwin-10.12;; - *) >&2 echo "unsupported os: $(uname -s)"; exit 1;; - esac -} +# shellcheck disable=SC1091 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=gitea DEST=/usr/local/apps/${APP} CURRENT=${DEST}/current VERSION=${VERSION:-1.19.0} -URL=https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-$(get_os)-$(get_arch).xz BIN_DIR=/usr/local/bin -if [ ! -d "${DEST}/${VERSION}" ]; then - tmp_dir="$(mktemp -d)" - file=${tmp_dir}/gitea - curl --silent --retry 10 --location --output "${file}.xz" "${URL}" - xz --decompress "${file}.xz" - chmod 755 "${file}" - sudo chown root:root "${file}" - sudo mkdir -p "${DEST}/${VERSION}" - sudo mv "${file}" "${DEST}/${VERSION}/${APP}" - - rm -rf "${tmp_dir}" -fi -set_current_link "${DEST}" "${VERSION}" "sudo" - -unlink_if_set "${BIN_DIR}/${APP}" "sudo" -cd "${BIN_DIR}" || exit 1 -sudo ln -s "$(relative_path "${BIN_DIR}" "${CURRENT}/${APP}")" "${APP}" -cd - &> /dev/null || exit 1 +main() ( + URL=https://dl.gitea.io/gitea/${VERSION}/gitea-${VERSION}-$(get_os)-$(get_arch).xz + + if [ ! -d "${DEST}/${VERSION}" ]; then + tmp_dir="$(mktemp -d)" + file=${tmp_dir}/gitea + curl --silent --retry 10 --location --output "${file}.xz" "${URL}" + xz --decompress "${file}.xz" + chmod 755 "${file}" + sudo chown root:root "${file}" + sudo mkdir -p "${DEST}/${VERSION}" + sudo mv "${file}" "${DEST}/${VERSION}/${APP}" + + rm -rf "${tmp_dir}" + fi + set_current_link "${DEST}" "${VERSION}" "sudo" + + unlink_if_set "${BIN_DIR}/${APP}" "sudo" + cd "${BIN_DIR}" || exit 1 + sudo ln -s "$(relative_path "${BIN_DIR}" "${CURRENT}/${APP}")" "${APP}" + 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 "${@}" diff --git a/install-scripts/.local/bin/install-gotemplate b/install-scripts/.local/bin/install-gotemplate index 9989dea..61a8f58 100755 --- a/install-scripts/.local/bin/install-gotemplate +++ b/install-scripts/.local/bin/install-gotemplate @@ -1,20 +1,31 @@ #!/usr/bin/env bash -source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" +set -euo pipefail -function get_os () { - case $(uname -s) in - Linux*) echo linux;; - Darwin*) echo macOS;; - *) >&2 echo "unsupported os: $(uname -s)"; exit 1;; - esac -} +# shellcheck disable=SC1091 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=gotemplate -VERSION=${VERSION:-3.7.0} +VERSION=${VERSION:-3.7.2} DEST="${XDG_DATA_HOME}/apps/releases/${APP}" -URL=https://github.com/coveooss/gotemplate/releases/download/v${VERSION}/gotemplate_${VERSION}_$(get_os)_64-bits.zip -extract_zip "${URL}" "${DEST}/${VERSION}" -set_current_link "${DEST}" "${VERSION}" -set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" +main() ( + URL=https://github.com/coveooss/gotemplate/releases/download/v${VERSION}/gotemplate_${VERSION}_$(get_os)_64-bits.zip + + extract_zip "${URL}" "${DEST}/${VERSION}" + set_current_link "${DEST}" "${VERSION}" + 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 "${@}" diff --git a/install-scripts/.local/bin/install-hugo-home b/install-scripts/.local/bin/install-hugo-home index 3b5a9f3..5c3fb46 100755 --- a/install-scripts/.local/bin/install-hugo-home +++ b/install-scripts/.local/bin/install-hugo-home @@ -1,20 +1,30 @@ #!/usr/bin/env bash -# shellcheck disable=SC1090 -source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" +set -euo pipefail -get_arch () { - case $(uname -m) in - x86_64*) echo 64bit;; - *) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;; - esac -} +# shellcheck disable=SC1091 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=hugo -VERSION=${VERSION:-0.88.1} +VERSION=${VERSION:-0.111.3} DEST="${XDG_DATA_HOME}/apps/releases/${APP}" -URL=https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_extended_${VERSION}_$(uname)-$(get_arch).tar.gz -extract_tarball "${URL}" "${DEST}/${VERSION}" -set_current_link "${DEST}" "${VERSION}" -set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" +main() ( + URL=https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_extended_${VERSION}_$(uname)-$(get_arch).tar.gz + + extract_tarball "${URL}" "${DEST}/${VERSION}" + set_current_link "${DEST}" "${VERSION}" + 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 "${@}" diff --git a/install-scripts/.local/bin/install-kubectl b/install-scripts/.local/bin/install-kubectl index fb30d52..88b2c70 100755 --- a/install-scripts/.local/bin/install-kubectl +++ b/install-scripts/.local/bin/install-kubectl @@ -1,30 +1,37 @@ #!/usr/bin/env bash -# shellcheck disable=SC1090 -source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" - -set -e +set -euo pipefail -get_arch () { - case $(uname -m) in - x86_64*) echo amd64;; - arm64*) echo arm64;; - *) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;; - esac -} +# shellcheck disable=SC1091 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=kubectl # https://dl.k8s.io/release/stable.txt VERSION=${VERSION:-1.26.1} 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 -if [[ ! -f "${APP_PATH}" ]]; then - mkdir -p "${DEST}/${VERSION}" - curl --silent --location --output "${APP_PATH}" "${URL}" - chmod +x "${APP_PATH}" -fi -set_current_link "${DEST}" "${VERSION}" -set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" +main() ( + URL=https://dl.k8s.io/release/v${VERSION}/bin/$(get_os)/$(get_arch)/kubectl + if [[ ! -f ${APP_PATH} ]]; then + mkdir -p "${DEST}/${VERSION}" + curl --silent --location --output "${APP_PATH}" "${URL}" + chmod +x "${APP_PATH}" + fi + + set_current_link "${DEST}" "${VERSION}" + 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 "${@}" diff --git a/install-scripts/.local/bin/install-lego-home b/install-scripts/.local/bin/install-lego-home index b7c5d90..db5767c 100755 --- a/install-scripts/.local/bin/install-lego-home +++ b/install-scripts/.local/bin/install-lego-home @@ -1,12 +1,12 @@ #!/usr/bin/env bash -set -e +set -euo pipefail -# shellcheck disable=SC1090 +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=lego -VERSION=${VERSION:-v4.10.2} +VERSION=${VERSION:-v4.11.0} 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 diff --git a/install-scripts/.local/bin/install-lego-system b/install-scripts/.local/bin/install-lego-system index 3a17d4b..5974a17 100755 --- a/install-scripts/.local/bin/install-lego-system +++ b/install-scripts/.local/bin/install-lego-system @@ -1,12 +1,12 @@ #!/usr/bin/env bash -set -e +set -euo pipefail -# shellcheck disable=SC1090 +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=lego -VERSION=${VERSION:-v4.10.2} +VERSION=${VERSION:-v4.11.0} APPS_DIR=/usr/local/apps/${APP} URL=https://github.com/go-acme/lego/releases/download/${VERSION}/lego_${VERSION}_$(get_os)_$(get_arch).tar.gz @@ -16,9 +16,9 @@ set_current_link "${APPS_DIR}" "${VERSION}" sudo apps=$(find ${APPS_DIR}/current/ -maxdepth 1 -executable -type f -exec basename {} \;) cd /usr/local/bin for bin in $apps; do - if [[ ! -s $bin ]]; then - sudo ln --symbolic \ - "$(relative_path "/usr/local/bin" "${APPS_DIR}/current/${bin}")" \ - "${bin}" - fi + if [[ ! -s $bin ]]; then + sudo ln --symbolic \ + "$(relative_path "/usr/local/bin" "${APPS_DIR}/current/${bin}")" \ + "${bin}" + fi done diff --git a/install-scripts/.local/bin/install-minikube-home b/install-scripts/.local/bin/install-minikube-home index a2cb4fe..c2d2f4f 100755 --- a/install-scripts/.local/bin/install-minikube-home +++ b/install-scripts/.local/bin/install-minikube-home @@ -1,16 +1,16 @@ #!/usr/bin/env bash -set -e +set -euo pipefail -# shellcheck disable=SC1090 +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=minikube -VERSION=${VERSION:-1.25.2} +VERSION=${VERSION:-1.30.1} DEST=${XDG_DATA_HOME}/apps/releases/${APP} 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" 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 diff --git a/install-scripts/.local/bin/install-minikube-system b/install-scripts/.local/bin/install-minikube-system index b256d8f..28a3b9c 100755 --- a/install-scripts/.local/bin/install-minikube-system +++ b/install-scripts/.local/bin/install-minikube-system @@ -1,12 +1,12 @@ #!/usr/bin/env bash -set -e +set -euo pipefail -# shellcheck disable=SC1090 +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=minikube -VERSION=${VERSION:-v1.25.2} +VERSION=${VERSION:-1.30.1} APPS_DIR=/usr/local/apps/${APP} URL=https://github.com/kubernetes/minikube/releases/download/${VERSION}/minikube-$(get_os)-$(get_arch).tar.gz @@ -16,13 +16,13 @@ set_current_link "${APPS_DIR}" "${VERSION}" sudo cd /usr/local/bin if [[ ! -L minikube ]]; then - sudo ln --symbolic \ - "$(relative_path "/usr/local/bin" "${APPS_DIR}/current/minikube-linux-amd64")" \ - minikube + sudo ln --symbolic \ + "$(relative_path "/usr/local/bin" "${APPS_DIR}/current/minikube-linux-amd64")" \ + minikube fi if [[ ! -L docker-machine-driver-kvm2 ]]; then - sudo ln --symbolic \ - "$(relative_path "/usr/local/bin" "${APPS_DIR}/current/docker-machine-driver-kvm2")" \ - docker-machine-driver-kvm2 + sudo ln --symbolic \ + "$(relative_path "/usr/local/bin" "${APPS_DIR}/current/docker-machine-driver-kvm2")" \ + docker-machine-driver-kvm2 fi diff --git a/install-scripts/.local/bin/install-node-exporter-system b/install-scripts/.local/bin/install-node-exporter-system index 271575a..f382ce3 100755 --- a/install-scripts/.local/bin/install-node-exporter-system +++ b/install-scripts/.local/bin/install-node-exporter-system @@ -1,13 +1,12 @@ #!/usr/bin/env bash -set -e -set -x +set -euo pipefail -# shellcheck disable=SC1090 +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=node_exporter -VERSION=${VERSION:-1.1.2} +VERSION=${VERSION:-1.5.0} 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 @@ -17,9 +16,9 @@ set_current_link "${APPS_DIR}" "${VERSION}" sudo apps=$(find ${APPS_DIR}/current/ -maxdepth 1 -executable -type f -exec basename {} \;) cd /usr/local/bin for bin in $apps; do - if [[ ! -s $bin ]]; then - sudo ln --symbolic \ - "$(relative_path "/usr/local/bin" "${APPS_DIR}/current/${bin}")" \ - "${bin}" - fi + if [[ ! -s $bin ]]; then + sudo ln --symbolic \ + "$(relative_path "/usr/local/bin" "${APPS_DIR}/current/${bin}")" \ + "${bin}" + fi done diff --git a/install-scripts/.local/bin/install-procs b/install-scripts/.local/bin/install-procs index 2e13ae7..a748ecc 100755 --- a/install-scripts/.local/bin/install-procs +++ b/install-scripts/.local/bin/install-procs @@ -1,20 +1,32 @@ #!/usr/bin/env bash -source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" +set -euo pipefail -function get_os () ( - case $(uname -s) in - Linux*) echo lnx;; - Darwin*) echo mac;; - *) >&2 echo "unsupported os: $(uname -s)"; exit 1;; - esac -) +# shellcheck disable=SC1091 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=procs -VERSION=${VERSION:-0.12.0} +VERSION=${VERSION:-0.14.0} DEST=${XDG_DATA_HOME}/apps/releases/${APP} -URL=https://github.com/dalance/procs/releases/download/v${VERSION}/procs-v${VERSION}-$(uname -m)-$(get_os).zip -extract_zip "${URL}" "${DEST}/${VERSION}" -set_current_link "${DEST}" "${VERSION}" -set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" +main() ( + set -x + URL=https://github.com/dalance/procs/releases/download/v${VERSION}/procs-v${VERSION}-$(uname -m)-$(get_os).zip + + extract_zip "${URL}" "${DEST}/${VERSION}" + set_current_link "${DEST}" "${VERSION}" + 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 "${@}" diff --git a/install-scripts/.local/bin/install-prometheus-system b/install-scripts/.local/bin/install-prometheus-system index 6527981..c043507 100755 --- a/install-scripts/.local/bin/install-prometheus-system +++ b/install-scripts/.local/bin/install-prometheus-system @@ -1,13 +1,12 @@ #!/usr/bin/env bash -set -e -set -x +set -euo pipefail -# shellcheck disable=SC1090 +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=prometheus -VERSION=${VERSION:-2.26.0} +VERSION=${VERSION:-2.44.0} APPS_DIR=/usr/local/apps/${APP} URL=https://github.com/prometheus/prometheus/releases/download/v${VERSION}/prometheus-${VERSION}.$(get_os)-$(get_arch).tar.gz @@ -17,9 +16,9 @@ set_current_link "${APPS_DIR}" "${VERSION}" sudo apps=$(find ${APPS_DIR}/current/ -maxdepth 1 -executable -type f -exec basename {} \;) cd /usr/local/bin for bin in $apps; do - if [[ ! -s $bin ]]; then - sudo ln --symbolic \ - "$(relative_path "/usr/local/bin" "${APPS_DIR}/current/${bin}")" \ - "${bin}" - fi + if [[ ! -s $bin ]]; then + sudo ln --symbolic \ + "$(relative_path "/usr/local/bin" "${APPS_DIR}/current/${bin}")" \ + "${bin}" + fi done diff --git a/install-scripts/.local/bin/install-protoc-home b/install-scripts/.local/bin/install-protoc-home index 968de8a..874a43c 100755 --- a/install-scripts/.local/bin/install-protoc-home +++ b/install-scripts/.local/bin/install-protoc-home @@ -1,59 +1,66 @@ #!/usr/bin/env bash -set -e +set -euo pipefail -# shellcheck disable=SC1090 +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" -get_os () ( - case $(uname -s) in - Linux*) echo linux;; - Darwin*) echo osx;; - *) >&2 echo "unsupported os"; return; - esac +VERSION=${VERSION:-23.1} +APP=protoc +APPS_DIR=${XDG_DATA_HOME}/apps/releases/${APP} +VER_DIR=${APPS_DIR}/${VERSION} + +main() ( + ZIP=protoc-${VERSION}-$(get_os)-$(get_arch).zip + TMP_DIR=$(mktemp -d) + DEST_FILE=$TMP_DIR/$ZIP + URL=https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/${ZIP} + + if [[ ! -d ${VER_DIR} ]]; then + curl --output "${DEST_FILE}" --location "${URL}" + mkdir -p "${VER_DIR}" + unzip -o "${DEST_FILE}" -d "${VER_DIR}" + find "${VER_DIR}" -type f -exec chmod 644 {} \; + find "${VER_DIR}" -type d -exec chmod 755 {} \; + find "${VER_DIR}/bin" -type f -exec chmod 755 {} \; + fi + rm -rfv "$TMP_DIR" + + set_current_link "${APPS_DIR}" "${VERSION}" + + apps=$(find "${APPS_DIR}/current/bin" -maxdepth 1 -type f -exec basename {} \;) + pushd "${XDG_BIN_HOME}" + for bin in $apps; do + if [[ ! -s $bin ]]; then + ln -s \ + "$(relative_path "${XDG_BIN_HOME}" "${APPS_DIR}/current/bin/${bin}")" \ + "${bin}" + fi + done + popd + + pushd "${XDG_INCLUDE_HOME}" + if [[ ! -s google ]]; then + ln -s \ + "$(relative_path "${XDG_INCLUDE_HOME}" "${APPS_DIR}/current/include/google")" \ + google + fi + popd ) -get_arch () ( - uname -m +get_os() ( + case $(uname -s) in + Linux*) echo linux ;; + Darwin*) echo osx ;; + *) + echo >&2 "unsupported os" + return + ;; + esac ) -VERSION=${VERSION:-22.3} -APP=protoc -APPS_DIR=${XDG_DATA_HOME}/apps/releases/${APP} -VER_DIR=${APPS_DIR}/${VERSION} +get_arch() ( + uname -m +) -ZIP=protoc-${VERSION}-$(get_os)-$(get_arch).zip -TMP_DIR=$(mktemp -d) -DEST_FILE=$TMP_DIR/$ZIP -URL=https://github.com/protocolbuffers/protobuf/releases/download/v${VERSION}/${ZIP} - -if [[ ! -d "${VER_DIR}" ]]; then - curl --output "${DEST_FILE}" --location "${URL}" - mkdir -p "${VER_DIR}" - unzip -o "${DEST_FILE}" -d "${VER_DIR}" - find "${VER_DIR}" -type f -exec chmod 644 {} \; - find "${VER_DIR}" -type d -exec chmod 755 {} \; - find "${VER_DIR}/bin" -type f -exec chmod 755 {} \; -fi -rm -rfv "$TMP_DIR" - -set_current_link "${APPS_DIR}" "${VERSION}" - -apps=$(find "${APPS_DIR}/current/bin" -maxdepth 1 -type f -exec basename {} \;) -pushd "${XDG_BIN_HOME}" -for bin in $apps; do - if [[ ! -s $bin ]]; then - ln -s \ - "$(relative_path "${XDG_BIN_HOME}" "${APPS_DIR}/current/bin/${bin}")" \ - "${bin}" - fi -done -popd - -pushd "${XDG_INCLUDE_HOME}" -if [[ ! -s google ]]; then - ln -s \ - "$(relative_path "${XDG_INCLUDE_HOME}" "${APPS_DIR}/current/include/google")" \ - google -fi -popd +main "${@}" diff --git a/install-scripts/.local/bin/install-protoc-system b/install-scripts/.local/bin/install-protoc-system index 1714893..33a88a7 100755 --- a/install-scripts/.local/bin/install-protoc-system +++ b/install-scripts/.local/bin/install-protoc-system @@ -1,12 +1,11 @@ #!/usr/bin/env bash -set -x -set -e +set -euo pipefail -# shellcheck disable=SC1090 +# shellcheck disable=SC1091 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 TMP_DIR=$(mktemp --directory) 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 d -exec chmod 755 {} \; rm -rfv "$TMP_DIR" + +main "${@}" diff --git a/install-scripts/.local/bin/install-pulumi b/install-scripts/.local/bin/install-pulumi index 3e14539..417d091 100755 --- a/install-scripts/.local/bin/install-pulumi +++ b/install-scripts/.local/bin/install-pulumi @@ -2,33 +2,45 @@ set -euo pipefail +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" -function get_os () ( - case $(uname -s) in - Linux*) echo linux;; - Darwin*) echo darwin;; - *) >&2 echo "unsupported os: $(uname -s)"; exit 1;; - esac -) - -function get_arch () ( - case $(uname -m) in - x86_64) echo x64;; - arm64) echo arm64;; - aarch64) echo arm64;; - *) >&2 echo "unsupported arch: $(uname -m)"; exit 1;; - esac -) - APP=pulumi 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}" +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 + Linux*) echo linux ;; + Darwin*) echo darwin ;; + *) + echo >&2 "unsupported os: $(uname -s)" + exit 1 + ;; + esac +) + +get_arch() ( + case $(uname -m) in + x86_64) echo x64 ;; + arm64) echo arm64 ;; + aarch64) echo arm64 ;; + *) + echo >&2 "unsupported arch: $(uname -m)" + exit 1 + ;; + esac +) -for PULUMI_APP in $(find "${DEST}/${VERSION}" -type f -exec basename "{}" \; | sort); do - set_link "${XDG_BIN_HOME}/${PULUMI_APP}" "${DEST}" "${PULUMI_APP}" -done +main "${@}" diff --git a/install-scripts/.local/bin/install-shellcheck-home b/install-scripts/.local/bin/install-shellcheck-home index 1b4aeed..198b95c 100755 --- a/install-scripts/.local/bin/install-shellcheck-home +++ b/install-scripts/.local/bin/install-shellcheck-home @@ -1,10 +1,12 @@ #!/usr/bin/env bash -# shellcheck disable=SC1090 +set -euo pipefail + +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=shellcheck -VERSION=${VERSION:-0.7.2} +VERSION=${VERSION:-0.9.0} 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 diff --git a/install-scripts/.local/bin/install-shfmt b/install-scripts/.local/bin/install-shfmt index 1aa98e7..06a982f 100755 --- a/install-scripts/.local/bin/install-shfmt +++ b/install-scripts/.local/bin/install-shfmt @@ -1,22 +1,32 @@ #!/usr/bin/env bash -# shellcheck disable=SC1090 -source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" +set -euo pipefail -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=shfmt -VERSION=${VERSION:-3.3.1} -DEST="${XDG_DATA_HOME}/apps/releases/${APP}" -URL=https://github.com/mvdan/sh/releases/download/v${VERSION}/shfmt_v${VERSION}_$(get_os)_$(get_arch) +VERSION=${VERSION:-3.6.0} +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) + + 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() ( + case $(uname -m) in + x86_64*) echo amd64 ;; + *) + echo >&2 "unsupported architecture: $(uname -m)" + exit 1 + ;; + esac +) -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}" +main "${@}" diff --git a/install-scripts/.local/bin/install-sqlc b/install-scripts/.local/bin/install-sqlc index fe0b351..4a99e7b 100755 --- a/install-scripts/.local/bin/install-sqlc +++ b/install-scripts/.local/bin/install-sqlc @@ -1,8 +1,8 @@ #!/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" APP=sqlc diff --git a/install-scripts/.local/bin/install-tile38 b/install-scripts/.local/bin/install-tile38 index 5d17975..762f5f7 100755 --- a/install-scripts/.local/bin/install-tile38 +++ b/install-scripts/.local/bin/install-tile38 @@ -1,12 +1,28 @@ #!/usr/bin/env bash +set -euo pipefail + +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=tile38 -VERSION=${VERSION:-1.30.2} +VERSION=${VERSION:-1.31.0} DEST=${XDG_DATA_HOME}/apps/releases/${APP} -install_zip () ( +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() ( URL=https://github.com/tidwall/tile38/releases/download/${VERSION}/tile38-${VERSION}-$(get_os)-$(get_arch).zip extract_zip "${URL}" "${DEST}/${VERSION}" set_current_link "${DEST}" "${VERSION}" @@ -14,25 +30,19 @@ install_zip () ( pushd "${DEST_DIR}" || exit 1 mv -v ./* ../ popd || exit 1 - rmdir "${DEST_DIR}" + rmdir "${DEST_DIR}" set_link "${XDG_BIN_HOME}/tile38-benchmark" "${DEST}" tile38-benchmark - set_link "${XDG_BIN_HOME}/tile38-cli" "${DEST}" tile38-cli - set_link "${XDG_BIN_HOME}/tile38-server" "${DEST}" tile38-server + set_link "${XDG_BIN_HOME}/tile38-cli" "${DEST}" tile38-cli + set_link "${XDG_BIN_HOME}/tile38-server" "${DEST}" tile38-server ) -install_targz () ( +install_targz() ( URL=https://github.com/tidwall/tile38/releases/download/${VERSION}/tile38-${VERSION}-$(get_os)-$(get_arch).tar.gz extract_tarball "${URL}" "${DEST}/${VERSION}" "--strip-component 1" set_current_link "${DEST}" "${VERSION}" set_link "${XDG_BIN_HOME}/tile38-benchmark" "${DEST}" tile38-benchmark - set_link "${XDG_BIN_HOME}/tile38-cli" "${DEST}" tile38-cli - set_link "${XDG_BIN_HOME}/tile38-server" "${DEST}" tile38-server + set_link "${XDG_BIN_HOME}/tile38-cli" "${DEST}" tile38-cli + set_link "${XDG_BIN_HOME}/tile38-server" "${DEST}" tile38-server ) -case $(get_os) in - darwin) install_zip;; - freebsd) install_zip;; - windows) install_zip;; - linux) install_targz;; - *) >&2 echo "unsupported os $(uname -s)"; exit 1;; -esac +main "${@}" diff --git a/install-scripts/.local/bin/install-trubka b/install-scripts/.local/bin/install-trubka index 343004e..6fee8bc 100755 --- a/install-scripts/.local/bin/install-trubka +++ b/install-scripts/.local/bin/install-trubka @@ -1,8 +1,8 @@ #!/usr/bin/env bash -set -e +set -euo pipefail -# shellcheck disable=SC1090 +# shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=trubka diff --git a/install-scripts/.local/bin/install-ttyd b/install-scripts/.local/bin/install-ttyd index 30e2a4c..47b2cf9 100755 --- a/install-scripts/.local/bin/install-ttyd +++ b/install-scripts/.local/bin/install-ttyd @@ -1,27 +1,37 @@ #!/usr/bin/env bash -# shellcheck disable=SC1090 -source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" +set -euo pipefail -get_arch () ( - case $(uname -m) in - x86_64*) echo i686;; - amd64*) echo i686;; - i386*) echo i686;; - i686*) echo i686;; - arm) echo arm;; - aarch64*) echo aarch64;; - *) >&2 echo "unsupported architecture: $(uname -m)"; exit 1;; - esac -) +# shellcheck disable=SC1091 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=ttyd 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}" +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() ( + case $(uname -m) in + x86_64*) echo i686 ;; + amd64*) echo i686 ;; + i386*) echo i686 ;; + i686*) echo i686 ;; + arm) echo arm ;; + aarch64*) echo aarch64 ;; + *) + echo >&2 "unsupported architecture: $(uname -m)" + exit 1 + ;; + esac +) + +main "${@}" diff --git a/install-scripts/.local/bin/install-vegeta-home b/install-scripts/.local/bin/install-vegeta-home index 95d3537..98e4e36 100755 --- a/install-scripts/.local/bin/install-vegeta-home +++ b/install-scripts/.local/bin/install-vegeta-home @@ -1,20 +1,30 @@ #!/usr/bin/env bash -# shellcheck disable=SC1090 -source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" +set -euo pipefail -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=vegeta VERSION=${VERSION:-12.8.4} -DEST="${XDG_DATA_HOME}/apps/releases/${APP}" -URL=https://github.com/tsenart/vegeta/releases/download/v${VERSION}/vegeta_${VERSION}_$(get_os)_$(get_arch).tar.gz +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 + + extract_tarball "${URL}" "${DEST}/${VERSION}" + set_current_link "${DEST}" "${VERSION}" + 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 +) -extract_tarball "${URL}" "${DEST}/${VERSION}" -set_current_link "${DEST}" "${VERSION}" -set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" +main "${@}"