From 46445e9382905a52e770d44191235be179616049 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Mon, 26 Apr 2021 07:03:47 +0000 Subject: [PATCH] cleanup: shfmt, shellcheck, and whitespace --- _example/install.sh | 2 +- _vim-example/install.sh | 2 +- _webi/bootstrap.sh | 22 +- _webi/example_install_safe_copy.sh | 18 +- _webi/template.sh | 595 ++++++++++++++--------------- _webi/ua-detect.js | 2 +- arc/install.sh | 2 +- awless/install.ps1 | 2 +- awless/install.sh | 2 +- bat/README.md | 2 +- bat/install.ps1 | 2 +- bat/install.sh | 10 +- brew/install.sh | 5 +- caddy/install.ps1 | 2 +- caddy/install.sh | 2 +- chromedriver/install.sh | 2 +- comrak/install.sh | 10 +- curlie/install.ps1 | 2 +- curlie/install.sh | 14 +- deno/install.sh | 2 +- dotenv-linter/install.sh | 2 +- dotenv/install.sh | 2 +- fd/install.ps1 | 2 +- fd/install.sh | 10 +- ffmpeg/install.sh | 2 +- fish/install.sh | 2 +- flutter/install.sh | 3 +- fzf/install.ps1 | 2 +- fzf/install.sh | 10 +- gitdeploy/install.sh | 2 +- gitea/install.sh | 2 +- golang/install.ps1 | 14 +- golang/install.sh | 2 +- goreleaser/install.sh | 2 +- gprox/README.md | 2 +- gprox/install.ps1 | 4 +- gprox/install.sh | 2 +- hexyl/install.sh | 10 +- hugo/install.sh | 2 +- jq/install.sh | 10 +- k9s/README.md | 2 +- k9s/install.ps1 | 2 +- k9s/install.sh | 2 +- keypairs/install.sh | 2 +- kubectx/install.ps1 | 2 +- kubectx/install.sh | 2 +- kubens/install.ps1 | 2 +- kubens/install.sh | 2 +- kubens/releases.js | 2 +- lf/install.sh | 2 +- lsd/install.ps1 | 4 +- lsd/install.sh | 2 +- macos/install.sh | 24 +- mutagen/install.sh | 2 +- myip/install.sh | 2 +- myip/myip.sh | 8 +- nerdfont/install.ps1 | 25 +- nerdfont/install.sh | 35 +- node/install.sh | 2 +- pandoc/install.ps1 | 4 +- pandoc/install.sh | 2 +- pathman/install.sh | 2 +- postgres/install.sh | 13 +- powershell/install.sh | 8 +- prettier/install.sh | 2 +- pyenv/install.sh | 4 +- rclone/install.sh | 2 +- rg/install.ps1 | 4 +- rg/install.sh | 2 +- sass/install.sh | 2 +- sclient/install.sh | 2 +- sd/install.ps1 | 2 +- sd/install.sh | 5 +- serviceman/install.sh | 2 +- shfmt/install.sh | 38 +- ssh-pubkey/install.sh | 2 +- ssh-utils/install.sh | 6 +- ssh-utils/ssh-adduser.sh | 8 +- ssh-utils/ssh-pubkey.sh | 12 +- sudo/install.sh | 4 +- syncthing/install.sh | 2 +- vim-ale/install.sh | 2 +- vim-beyondcode/install.sh | 28 +- vim-devicons/install.sh | 2 +- vim-essentials/install.sh | 20 +- vim-lastplace/install.sh | 2 +- vim-nerdtree/install.sh | 2 +- vim-prettier/install.sh | 6 +- vim-shfmt/install.sh | 6 +- vps-addswap/install.sh | 8 +- watchexec/install.sh | 4 +- webi/install.sh | 24 +- xz/install.sh | 2 +- yq/install.sh | 2 +- 94 files changed, 575 insertions(+), 572 deletions(-) diff --git a/_example/install.sh b/_example/install.sh index 280997c..07e9694 100644 --- a/_example/install.sh +++ b/_example/install.sh @@ -33,7 +33,7 @@ function __init_foobar() { # foobar 0.99.9 (rev abcdef0123) # This trims it down to just the version number: # 0.99.9 - echo $(foo --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2) + echo $(foo --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2) } } diff --git a/_vim-example/install.sh b/_vim-example/install.sh index 55cd88d..4a8cdb9 100644 --- a/_vim-example/install.sh +++ b/_vim-example/install.sh @@ -18,7 +18,7 @@ function __init_vim_example() { curl -fsSL -o ~/.vim/plugins/example.vim "$WEBI_HOST/packages/vim-example/example.vim" fi - if ! grep 'source.*plugins.example.vim' -r ~/.vimrc >/dev/null 2>/dev/null; then + if ! grep 'source.*plugins.example.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then set +e mkdir -p ~/.vim/plugins printf '\n" example: reasonable defaults from webinstall.dev/vim-example\n' >> ~/.vimrc diff --git a/_webi/bootstrap.sh b/_webi/bootstrap.sh index 877ad81..dfbf9de 100644 --- a/_webi/bootstrap.sh +++ b/_webi/bootstrap.sh @@ -2,16 +2,16 @@ { -set -e -set -u + set -e + set -u -#WEBI_PKG= -#WEBI_HOST=https://webinstall.dev -export WEBI_HOST + #WEBI_PKG= + #WEBI_HOST=https://webinstall.dev + export WEBI_HOST -mkdir -p "$HOME/.local/bin" + mkdir -p "$HOME/.local/bin" -cat << EOF > "$HOME/.local/bin/webi" + cat << EOF > "$HOME/.local/bin/webi" #!/bin/bash set -e @@ -139,10 +139,10 @@ show_path_updates EOF -chmod a+x "$HOME/.local/bin/webi" + chmod a+x "$HOME/.local/bin/webi" -if [ -n "${WEBI_PKG:-}" ]; then - "$HOME/.local/bin/webi" "${WEBI_PKG}" -fi + if [ -n "${WEBI_PKG:-}" ]; then + "$HOME/.local/bin/webi" "${WEBI_PKG}" + fi } diff --git a/_webi/example_install_safe_copy.sh b/_webi/example_install_safe_copy.sh index c52b018..e1600bb 100644 --- a/_webi/example_install_safe_copy.sh +++ b/_webi/example_install_safe_copy.sh @@ -1,14 +1,14 @@ # For installing from the extracted package tmp directory pkg_install() { - pushd "$WEBI_TMP" 2>&1 >/dev/null + pushd "$WEBI_TMP" 2>&1 > /dev/null - if [ -n "$(command -v rsync 2>/dev/null | grep rsync)" ]; then - rsync -Krl ./xmpl*/ "$pkg_src/" 2>/dev/null - else - cp -Hr ./xmpl*/* "$pkg_src/" 2>/dev/null - cp -Hr ./xmpl*/.* "$pkg_src/" 2>/dev/null - fi - rm -rf ./xmpl* + if [ -n "$(command -v rsync 2> /dev/null | grep rsync)" ]; then + rsync -Krl ./xmpl*/ "$pkg_src/" 2> /dev/null + else + cp -Hr ./xmpl*/* "$pkg_src/" 2> /dev/null + cp -Hr ./xmpl*/.* "$pkg_src/" 2> /dev/null + fi + rm -rf ./xmpl* - popd 2>&1 >/dev/null + popd 2>&1 > /dev/null } diff --git a/_webi/template.sh b/_webi/template.sh index 643be6c..1823945 100644 --- a/_webi/template.sh +++ b/_webi/template.sh @@ -2,188 +2,187 @@ function __bootstrap_webi() { -set -e -set -u -#set -x - -#WEBI_PKG= -#PKG_NAME= -# TODO should this be BASEURL instead? -#WEBI_OS= -#WEBI_ARCH= -#WEBI_HOST= -#WEBI_RELEASES= -#WEBI_CSV= -#WEBI_TAG= -#WEBI_VERSION= -#WEBI_MAJOR= -#WEBI_MINOR= -#WEBI_PATCH= -# TODO not sure if BUILD is the best name for this -#WEBI_BUILD= -#WEBI_LTS= -#WEBI_CHANNEL= -#WEBI_EXT= -#WEBI_FORMATS= -#WEBI_PKG_URL= -#WEBI_PKG_FILE= -#PKG_OSES= -#PKG_ARCHES= -#PKG_FORMATS= -WEBI_UA="$(uname -a)" -export WEBI_HOST - -## -## Set up tmp, download, and install directories -## - -WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-${WEBI_PKG:-}.XXXXXXXX)"} -export _webi_tmp="${_webi_tmp:-"$HOME/.local/opt/webi-tmp.d"}" - -mkdir -p "$HOME/Downloads" -mkdir -p "$HOME/.local/bin" -mkdir -p "$HOME/.local/opt" - -## -## Detect http client -## -set +e -export WEBI_CURL="$(command -v curl)" -export WEBI_WGET="$(command -v wget)" -set -e - - -# get the special formatted version (i.e. "go is go1.14" while node is "node v12.10.8") -my_versioned_name="" -_webi_canonical_name() { - if [ -n "$my_versioned_name" ]; then - echo "$my_versioned_name" - return 0 - fi + set -e + set -u + #set -x + + #WEBI_PKG= + #PKG_NAME= + # TODO should this be BASEURL instead? + #WEBI_OS= + #WEBI_ARCH= + #WEBI_HOST= + #WEBI_RELEASES= + #WEBI_CSV= + #WEBI_TAG= + #WEBI_VERSION= + #WEBI_MAJOR= + #WEBI_MINOR= + #WEBI_PATCH= + # TODO not sure if BUILD is the best name for this + #WEBI_BUILD= + #WEBI_LTS= + #WEBI_CHANNEL= + #WEBI_EXT= + #WEBI_FORMATS= + #WEBI_PKG_URL= + #WEBI_PKG_FILE= + #PKG_OSES= + #PKG_ARCHES= + #PKG_FORMATS= + WEBI_UA="$(uname -a)" + export WEBI_HOST + + ## + ## Set up tmp, download, and install directories + ## + + WEBI_TMP=${WEBI_TMP:-"$(mktemp -d -t webinstall-${WEBI_PKG:-}.XXXXXXXX)"} + export _webi_tmp="${_webi_tmp:-"$HOME/.local/opt/webi-tmp.d"}" + + mkdir -p "$HOME/Downloads" + mkdir -p "$HOME/.local/bin" + mkdir -p "$HOME/.local/opt" + + ## + ## Detect http client + ## + set +e + export WEBI_CURL="$(command -v curl)" + export WEBI_WGET="$(command -v wget)" + set -e - if [ -n "$(command -v pkg_format_cmd_version)" ]; then - my_versioned_name="$(pkg_format_cmd_version "$WEBI_VERSION")" - else - my_versioned_name="'$pkg_cmd_name' v$WEBI_VERSION" - fi + # get the special formatted version (i.e. "go is go1.14" while node is "node v12.10.8") + my_versioned_name="" + _webi_canonical_name() { + if [ -n "$my_versioned_name" ]; then + echo "$my_versioned_name" + return 0 + fi - echo "$my_versioned_name" -} + if [ -n "$(command -v pkg_format_cmd_version)" ]; then + my_versioned_name="$(pkg_format_cmd_version "$WEBI_VERSION")" + else + my_versioned_name="'$pkg_cmd_name' v$WEBI_VERSION" + fi -# update symlinks according to $HOME/.local/opt and $HOME/.local/bin install paths. -webi_link() { - if [ -n "$(command -v pkg_link)" ]; then - pkg_link - return 0 - fi + echo "$my_versioned_name" + } - if [ -n "$WEBI_SINGLE" ] || [ "single" == "${1:-}" ]; then - rm -rf "$pkg_dst_cmd" - ln -s "$pkg_src_cmd" "$pkg_dst_cmd" - else - # 'pkg_dst' will default to $HOME/.local/opt/ - # 'pkg_src' will be the installed version, such as to $HOME/.local/opt/- - rm -rf "$pkg_dst" - ln -s "$pkg_src" "$pkg_dst" - fi -} + # update symlinks according to $HOME/.local/opt and $HOME/.local/bin install paths. + webi_link() { + if [ -n "$(command -v pkg_link)" ]; then + pkg_link + return 0 + fi -# detect if this program is already installed or if an installed version may cause conflict -webi_check() { - # Test for existing version - set +e - my_path="$PATH" - export PATH="$(dirname "$pkg_dst_cmd"):$PATH" - my_current_cmd="$(command -v "$pkg_cmd_name")" - set -e - if [ -n "$my_current_cmd" ]; then - pkg_current_version="$(pkg_get_current_version 2>/dev/null | head -n 1)" - # remove trailing '.0's for golang's sake - my_current_version="$(echo $pkg_current_version | sed 's:\.0::g')" - my_src_version="$(echo $WEBI_VERSION | sed 's:\.0::g')" - my_canonical_name="$(_webi_canonical_name)" - if [ "$my_src_version" == "$my_current_version" ]; then - echo "$my_canonical_name already installed at $my_current_cmd" - exit 0 + if [ -n "$WEBI_SINGLE" ] || [ "single" == "${1:-}" ]; then + rm -rf "$pkg_dst_cmd" + ln -s "$pkg_src_cmd" "$pkg_dst_cmd" else - if [ "$my_current_cmd" != "$pkg_dst_cmd" ]; then - >&2 echo "WARN: possible conflict between $my_canonical_name and $pkg_current_version at $my_current_cmd" - fi - if [ -x "$pkg_src_cmd" ]; then - webi_link - echo "switched to $my_canonical_name at $pkg_src" + # 'pkg_dst' will default to $HOME/.local/opt/ + # 'pkg_src' will be the installed version, such as to $HOME/.local/opt/- + rm -rf "$pkg_dst" + ln -s "$pkg_src" "$pkg_dst" + fi + } + + # detect if this program is already installed or if an installed version may cause conflict + webi_check() { + # Test for existing version + set +e + my_path="$PATH" + export PATH="$(dirname "$pkg_dst_cmd"):$PATH" + my_current_cmd="$(command -v "$pkg_cmd_name")" + set -e + if [ -n "$my_current_cmd" ]; then + pkg_current_version="$(pkg_get_current_version 2> /dev/null | head -n 1)" + # remove trailing '.0's for golang's sake + my_current_version="$(echo $pkg_current_version | sed 's:\.0::g')" + my_src_version="$(echo $WEBI_VERSION | sed 's:\.0::g')" + my_canonical_name="$(_webi_canonical_name)" + if [ "$my_src_version" == "$my_current_version" ]; then + echo "$my_canonical_name already installed at $my_current_cmd" exit 0 + else + if [ "$my_current_cmd" != "$pkg_dst_cmd" ]; then + echo >&2 "WARN: possible conflict between $my_canonical_name and $pkg_current_version at $my_current_cmd" + fi + if [ -x "$pkg_src_cmd" ]; then + webi_link + echo "switched to $my_canonical_name at $pkg_src" + exit 0 + fi fi - fi - fi - export PATH="$my_path" -} - -# detect if file is downloaded, and how to download it -webi_download() { - if [ -n "${1:-}" ]; then - my_url="$1" - else - if [ "error" == "$WEBI_CHANNEL" ]; then - # TODO pass back requested OS / Arch / Version - >&2 echo "Error: no '$PKG_NAME' release for '$WEBI_OS' on '$WEBI_ARCH' as one of '$WEBI_FORMATS' by the tag '$WEBI_TAG'" - >&2 echo " '$PKG_NAME' is available for '$PKG_OSES' on '$PKG_ARCHES' as one of '$PKG_FORMATS'" - >&2 echo " (check that the package name and version are correct)" - >&2 echo "" - >&2 echo " Double check at $(echo "$WEBI_RELEASES" | sed 's:\?.*::')" - >&2 echo "" - exit 1 fi - my_url="$WEBI_PKG_URL" - fi - if [ -n "${2:-}" ]; then - my_dl="$2" - else - my_dl="$HOME/Downloads/$WEBI_PKG_FILE" - fi - - if [ -e "$my_dl" ]; then - echo "Found $my_dl" - return 0 - fi - - echo "Downloading $PKG_NAME from" - echo "$my_url" + export PATH="$my_path" + } - # It's only 2020, we can't expect to have reliable CLI tools - # to tell us the size of a file as part of a base system... - if [ -n "$WEBI_WGET" ]; then - # wget has resumable downloads - # TODO wget -c --content-disposition "$my_url" - set +e - my_show_progress="" - if [[ $- == *i* ]]; then - my_show_progress="--show-progress" + # detect if file is downloaded, and how to download it + webi_download() { + if [ -n "${1:-}" ]; then + my_url="$1" + else + if [ "error" == "$WEBI_CHANNEL" ]; then + # TODO pass back requested OS / Arch / Version + echo >&2 "Error: no '$PKG_NAME' release for '$WEBI_OS' on '$WEBI_ARCH' as one of '$WEBI_FORMATS' by the tag '$WEBI_TAG'" + echo >&2 " '$PKG_NAME' is available for '$PKG_OSES' on '$PKG_ARCHES' as one of '$PKG_FORMATS'" + echo >&2 " (check that the package name and version are correct)" + echo >&2 "" + echo >&2 " Double check at $(echo "$WEBI_RELEASES" | sed 's:\?.*::')" + echo >&2 "" + exit 1 + fi + my_url="$WEBI_PKG_URL" fi - wget -q $my_show_progress --user-agent="wget $WEBI_UA" -c "$my_url" -O "$my_dl.part" - if ! [ $? -eq 0 ]; then - >&2 echo "failed to download from $WEBI_PKG_URL" - exit 1 + if [ -n "${2:-}" ]; then + my_dl="$2" + else + my_dl="$HOME/Downloads/$WEBI_PKG_FILE" fi - set -e - else - # Neither GNU nor BSD curl have sane resume download options, hence we don't bother - # TODO curl -fsSL --remote-name --remote-header-name --write-out "$my_url" - my_show_progress="-#" - if [[ $- == *i* ]]; then - my_show_progress="" + + if [ -e "$my_dl" ]; then + echo "Found $my_dl" + return 0 fi - curl -fSL $my_show_progress -H "User-Agent: curl $WEBI_UA" "$my_url" -o "$my_dl.part" - fi - mv "$my_dl.part" "$my_dl" - echo "" - echo "Saved as $my_dl" -} + echo "Downloading $PKG_NAME from" + echo "$my_url" + + # It's only 2020, we can't expect to have reliable CLI tools + # to tell us the size of a file as part of a base system... + if [ -n "$WEBI_WGET" ]; then + # wget has resumable downloads + # TODO wget -c --content-disposition "$my_url" + set +e + my_show_progress="" + if [[ $- == *i* ]]; then + my_show_progress="--show-progress" + fi + wget -q $my_show_progress --user-agent="wget $WEBI_UA" -c "$my_url" -O "$my_dl.part" + if ! [ $? -eq 0 ]; then + echo >&2 "failed to download from $WEBI_PKG_URL" + exit 1 + fi + set -e + else + # Neither GNU nor BSD curl have sane resume download options, hence we don't bother + # TODO curl -fsSL --remote-name --remote-header-name --write-out "$my_url" + my_show_progress="-#" + if [[ $- == *i* ]]; then + my_show_progress="" + fi + curl -fSL $my_show_progress -H "User-Agent: curl $WEBI_UA" "$my_url" -o "$my_dl.part" + fi + mv "$my_dl.part" "$my_dl" + + echo "" + echo "Saved as $my_dl" + } -# detect which archives can be used -webi_extract() { - pushd "$WEBI_TMP" 2>&1 >/dev/null + # detect which archives can be used + webi_extract() { + pushd "$WEBI_TMP" 2>&1 > /dev/null if [ "tar" == "$WEBI_EXT" ]; then echo "Extracting $HOME/Downloads/$WEBI_PKG_FILE" tar xf "$HOME/Downloads/$WEBI_PKG_FILE" @@ -201,167 +200,167 @@ webi_extract() { echo "Failed to extract $HOME/Downloads/$WEBI_PKG_FILE" exit 1 fi - popd 2>&1 >/dev/null -} - -# use 'pathman' to update $HOME/.config/envman/PATH.env -webi_path_add() { - # make sure that we don't recursively install pathman with webi - my_path="$PATH" - export PATH="$HOME/.local/bin:$PATH" - - # install pathman if not already installed - if [ -z "$(command -v pathman)" ]; then - "$HOME/.local/bin/webi" pathman > /dev/null - fi - - export PATH="$my_path" - - # in case pathman was recently installed and the PATH not updated - mkdir -p "$_webi_tmp" - # prevent "too few arguments" output on bash when there are 0 lines of stdout - "$HOME/.local/bin/pathman" add "$1" | grep "export" 2>/dev/null >> "$_webi_tmp/.PATH.env" || true -} - -# group common pre-install tasks as default -webi_pre_install() { - webi_check - webi_download - webi_extract -} - -# move commands from the extracted archive directory to $HOME/.local/opt or $HOME/.local/bin -webi_install() { - if [ -n "$WEBI_SINGLE" ] || [ "single" == "${1:-}" ]; then - mkdir -p "$(dirname $pkg_src_cmd)" - mv ./"$pkg_cmd_name"* "$pkg_src_cmd" - else - rm -rf "$pkg_src" - mv ./"$pkg_cmd_name"* "$pkg_src" - fi -} - -# run post-install functions - just updating PATH by default -webi_post_install() { - webi_path_add "$(dirname "$pkg_dst_cmd")" -} + popd 2>&1 > /dev/null + } + + # use 'pathman' to update $HOME/.config/envman/PATH.env + webi_path_add() { + # make sure that we don't recursively install pathman with webi + my_path="$PATH" + export PATH="$HOME/.local/bin:$PATH" + + # install pathman if not already installed + if [ -z "$(command -v pathman)" ]; then + "$HOME/.local/bin/webi" pathman > /dev/null + fi -_webi_enable_exec() { - if [ -n "$(command -v spctl)" ] && [ -n "$(command -v xattr)" ] ; then - # note: some packages contain files that cannot be affected by xattr - xattr -r -d com.apple.quarantine "$pkg_src" || true - return 0 - fi - # TODO need to test that the above actually worked - # (and proceed to this below if it did not) - if [ -n "$(command -v spctl)" ]; then - echo "Checking permission to execute '$pkg_cmd_name' on macOS 11+" - set +e - is_allowed="$(spctl -a "$pkg_src_cmd" 2>&1 | grep valid)" - set -e - if [ -z "$is_allowed" ]; then - echo "" - echo "##########################################" - echo "# IMPORTANT: Permission Grant Required #" - echo "##########################################" - echo "" - echo "Requesting permission to execute '$pkg_cmd_name' on macOS 10.14+" - echo "" - sleep 3 - spctl --add "$pkg_src_cmd" + export PATH="$my_path" + + # in case pathman was recently installed and the PATH not updated + mkdir -p "$_webi_tmp" + # prevent "too few arguments" output on bash when there are 0 lines of stdout + "$HOME/.local/bin/pathman" add "$1" | grep "export" 2> /dev/null >> "$_webi_tmp/.PATH.env" || true + } + + # group common pre-install tasks as default + webi_pre_install() { + webi_check + webi_download + webi_extract + } + + # move commands from the extracted archive directory to $HOME/.local/opt or $HOME/.local/bin + webi_install() { + if [ -n "$WEBI_SINGLE" ] || [ "single" == "${1:-}" ]; then + mkdir -p "$(dirname $pkg_src_cmd)" + mv ./"$pkg_cmd_name"* "$pkg_src_cmd" + else + rm -rf "$pkg_src" + mv ./"$pkg_cmd_name"* "$pkg_src" fi - fi -} + } + + # run post-install functions - just updating PATH by default + webi_post_install() { + webi_path_add "$(dirname "$pkg_dst_cmd")" + } + + _webi_enable_exec() { + if [ -n "$(command -v spctl)" ] && [ -n "$(command -v xattr)" ]; then + # note: some packages contain files that cannot be affected by xattr + xattr -r -d com.apple.quarantine "$pkg_src" || true + return 0 + fi + # TODO need to test that the above actually worked + # (and proceed to this below if it did not) + if [ -n "$(command -v spctl)" ]; then + echo "Checking permission to execute '$pkg_cmd_name' on macOS 11+" + set +e + is_allowed="$(spctl -a "$pkg_src_cmd" 2>&1 | grep valid)" + set -e + if [ -z "$is_allowed" ]; then + echo "" + echo "##########################################" + echo "# IMPORTANT: Permission Grant Required #" + echo "##########################################" + echo "" + echo "Requesting permission to execute '$pkg_cmd_name' on macOS 10.14+" + echo "" + sleep 3 + spctl --add "$pkg_src_cmd" + fi + fi + } -# a friendly message when all is well, showing the final install path in $HOME/.local -_webi_done_message() { - echo "Installed $(_webi_canonical_name) as $pkg_dst_cmd" -} + # a friendly message when all is well, showing the final install path in $HOME/.local + _webi_done_message() { + echo "Installed $(_webi_canonical_name) as $pkg_dst_cmd" + } -## -## -## BEGIN custom override functions from /install.sh -## -## + ## + ## + ## BEGIN custom override functions from /install.sh + ## + ## -WEBI_SINGLE= + WEBI_SINGLE= -echo "" -echo "Thanks for using webi to install '$PKG_NAME' on '$WEBI_OS/$WEBI_ARCH'." -echo "Have a problem? Experience a bug? Please let us know:" -echo " https://github.com/webinstall/packages/issues" -echo "" + echo "" + echo "Thanks for using webi to install '$PKG_NAME' on '$WEBI_OS/$WEBI_ARCH'." + echo "Have a problem? Experience a bug? Please let us know:" + echo " https://github.com/webinstall/packages/issues" + echo "" -function __init_installer() { + function __init_installer() { -{{ installer }} + {{ installer }} -} + } -__init_installer + __init_installer -## -## -## END custom override functions -## -## + ## + ## + ## END custom override functions + ## + ## -# run everything with defaults or overrides as needed -if [ -n "$(command -v pkg_get_current_version)" ]; then - pkg_cmd_name="${pkg_cmd_name:-$PKG_NAME}" + # run everything with defaults or overrides as needed + if [ -n "$(command -v pkg_get_current_version)" ]; then + pkg_cmd_name="${pkg_cmd_name:-$PKG_NAME}" - if [ -n "$WEBI_SINGLE" ]; then - pkg_dst_cmd="${pkg_dst_cmd:-$HOME/.local/bin/$pkg_cmd_name}" - pkg_dst="$pkg_dst_cmd" # "$(dirname "$(dirname $pkg_dst_cmd)")" + if [ -n "$WEBI_SINGLE" ]; then + pkg_dst_cmd="${pkg_dst_cmd:-$HOME/.local/bin/$pkg_cmd_name}" + pkg_dst="$pkg_dst_cmd" # "$(dirname "$(dirname $pkg_dst_cmd)")" - #pkg_src_cmd="${pkg_src_cmd:-$HOME/.local/opt/$pkg_cmd_name-v$WEBI_VERSION/bin/$pkg_cmd_name-v$WEBI_VERSION}" - pkg_src_cmd="${pkg_src_cmd:-$HOME/.local/opt/$pkg_cmd_name-v$WEBI_VERSION/bin/$pkg_cmd_name}" - pkg_src="$pkg_src_cmd" # "$(dirname "$(dirname $pkg_src_cmd)")" - else - pkg_dst="${pkg_dst:-$HOME/.local/opt/$pkg_cmd_name}" - pkg_dst_cmd="${pkg_dst_cmd:-$pkg_dst/bin/$pkg_cmd_name}" + #pkg_src_cmd="${pkg_src_cmd:-$HOME/.local/opt/$pkg_cmd_name-v$WEBI_VERSION/bin/$pkg_cmd_name-v$WEBI_VERSION}" + pkg_src_cmd="${pkg_src_cmd:-$HOME/.local/opt/$pkg_cmd_name-v$WEBI_VERSION/bin/$pkg_cmd_name}" + pkg_src="$pkg_src_cmd" # "$(dirname "$(dirname $pkg_src_cmd)")" + else + pkg_dst="${pkg_dst:-$HOME/.local/opt/$pkg_cmd_name}" + pkg_dst_cmd="${pkg_dst_cmd:-$pkg_dst/bin/$pkg_cmd_name}" - pkg_src="${pkg_src:-$HOME/.local/opt/$pkg_cmd_name-v$WEBI_VERSION}" - pkg_src_cmd="${pkg_src_cmd:-$pkg_src/bin/$pkg_cmd_name}" - fi - pkg_src_bin="$(dirname "$pkg_src_cmd")" - pkg_dst_bin="$(dirname "$pkg_dst_cmd")" + pkg_src="${pkg_src:-$HOME/.local/opt/$pkg_cmd_name-v$WEBI_VERSION}" + pkg_src_cmd="${pkg_src_cmd:-$pkg_src/bin/$pkg_cmd_name}" + fi + pkg_src_bin="$(dirname "$pkg_src_cmd")" + pkg_dst_bin="$(dirname "$pkg_dst_cmd")" - [ -n "$(command -v pkg_pre_install)" ] && pkg_pre_install || webi_pre_install + [ -n "$(command -v pkg_pre_install)" ] && pkg_pre_install || webi_pre_install - pushd "$WEBI_TMP" 2>&1 >/dev/null + pushd "$WEBI_TMP" 2>&1 > /dev/null echo "Installing to $pkg_src_cmd" [ -n "$(command -v pkg_install)" ] && pkg_install || webi_install chmod a+x "$pkg_src" chmod a+x "$pkg_src_cmd" - popd 2>&1 >/dev/null + popd 2>&1 > /dev/null - webi_link + webi_link - _webi_enable_exec - pushd "$WEBI_TMP" 2>&1 >/dev/null + _webi_enable_exec + pushd "$WEBI_TMP" 2>&1 > /dev/null [ -n "$(command -v pkg_post_install)" ] && pkg_post_install || webi_post_install - popd 2>&1 >/dev/null + popd 2>&1 > /dev/null - pushd "$WEBI_TMP" 2>&1 >/dev/null + pushd "$WEBI_TMP" 2>&1 > /dev/null [ -n "$(command -v pkg_done_message)" ] && pkg_done_message || _webi_done_message - popd 2>&1 >/dev/null + popd 2>&1 > /dev/null - echo "" -fi + echo "" + fi -webi_path_add "$HOME/.local/bin" -if [ -z "${_WEBI_CHILD:-}" ] && [ -f "\$_webi_tmp/.PATH.env" ]; then - echo "You need to update your PATH to use $PKG_NAME:" - echo "" - cat "$_webi_tmp/.PATH.env" | sort -u - rm -f "$_webi_tmp/.PATH.env" -fi + webi_path_add "$HOME/.local/bin" + if [ -z "${_WEBI_CHILD:-}" ] && [ -f '$_webi_tmp/.PATH.env' ]; then + echo "You need to update your PATH to use $PKG_NAME:" + echo "" + cat "$_webi_tmp/.PATH.env" | sort -u + rm -f "$_webi_tmp/.PATH.env" + fi -# cleanup the temp directory -rm -rf "$WEBI_TMP" + # cleanup the temp directory + rm -rf "$WEBI_TMP" -# See? No magic. Just downloading and moving files. + # See? No magic. Just downloading and moving files. } diff --git a/_webi/ua-detect.js b/_webi/ua-detect.js index 426db69..315046c 100644 --- a/_webi/ua-detect.js +++ b/_webi/ua-detect.js @@ -54,7 +54,7 @@ function getArch(ua) { return '-'; } - // quick hack for Apple Silicon M1 + // quick hack for Apple Silicon M1 // Native: Darwin boomer.local 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101 arm64 // Resetta: Darwin boomer.local 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101 x86_64 ua = ua.replace(/xnu-.*RELEASE_[^\s]*/, '') diff --git a/arc/install.sh b/arc/install.sh index fb5f8c2..4d983ee 100644 --- a/arc/install.sh +++ b/arc/install.sh @@ -31,6 +31,6 @@ # arc v3.5.0 (25e050d) 2020-10-30T03:27:58Z # This trims it down to just the version number: # 3.5.0 - echo "$(arc version 2>/dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" + echo "$(arc version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" } } diff --git a/awless/install.ps1 b/awless/install.ps1 index cb44f2b..dbd7a09 100644 --- a/awless/install.ps1 +++ b/awless/install.ps1 @@ -33,7 +33,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) { # Enter tmp pushd .local\tmp - # Remove any leftover tmp cruft + # Remove any leftover tmp cruft Remove-Item -Path ".\awless-v*" -Recurse -ErrorAction Ignore Remove-Item -Path ".\awless.exe" -Recurse -ErrorAction Ignore diff --git a/awless/install.sh b/awless/install.sh index 080859d..089e2c4 100644 --- a/awless/install.sh +++ b/awless/install.sh @@ -19,7 +19,7 @@ pkg_get_current_version() { # v2.1.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8= # This trims it down to just the version number: # 2.1.0 - echo "$(awless version 2>/dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')" + echo "$(awless version 2> /dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')" } pkg_install() { diff --git a/bat/README.md b/bat/README.md index 75d12e5..090f165 100644 --- a/bat/README.md +++ b/bat/README.md @@ -62,4 +62,4 @@ Edit the config file: ```txt # no numbers or headers, just highlighting and such --style="plain" -``` \ No newline at end of file +``` diff --git a/bat/install.ps1 b/bat/install.ps1 index bc99769..5b79cc9 100644 --- a/bat/install.ps1 +++ b/bat/install.ps1 @@ -28,7 +28,7 @@ IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME")) & tar xf "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE" # Move single binary into root of temporary folder & move "$EXENAME" "$VERNAME" - + # Settle unpacked archive into place echo "New Name: $VERNAME" diff --git a/bat/install.sh b/bat/install.sh index 6ae9154..b6f812e 100644 --- a/bat/install.sh +++ b/bat/install.sh @@ -11,11 +11,11 @@ WEBI_SINGLE=true pkg_get_current_version() { - # 'bat --version' has output in this format: - # bat 0.15.4 - # This trims it down to just the version number: - # 0.15.4 - echo $(bat --version 2>/dev/null | head -n 1 | cut -d' ' -f 2) + # 'bat --version' has output in this format: + # bat 0.15.4 + # This trims it down to just the version number: + # 0.15.4 + echo $(bat --version 2> /dev/null | head -n 1 | cut -d' ' -f 2) } pkg_install() { diff --git a/brew/install.sh b/brew/install.sh index 6668e3e..76469b5 100644 --- a/brew/install.sh +++ b/brew/install.sh @@ -7,9 +7,8 @@ function _install_brew() { # Straight from https://brew.sh #/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" - needs_xcode="$(/usr/bin/xcode-select -p >/dev/null 2> /dev/null || echo "true")" - if [[ -n "${needs_xcode}" ]] - then + needs_xcode="$(/usr/bin/xcode-select -p > /dev/null 2> /dev/null || echo "true")" + if [[ -n ${needs_xcode} ]]; then echo "" echo "" echo "ERROR: Run this command to install XCode Command Line Tools first:" diff --git a/caddy/install.ps1 b/caddy/install.ps1 index 5aa15b1..76de03a 100644 --- a/caddy/install.ps1 +++ b/caddy/install.ps1 @@ -33,7 +33,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) { # Enter tmp pushd .local\tmp - # Remove any leftover tmp cruft + # Remove any leftover tmp cruft Remove-Item -Path ".\caddy-v*" -Recurse -ErrorAction Ignore Remove-Item -Path ".\caddy.exe" -Recurse -ErrorAction Ignore diff --git a/caddy/install.sh b/caddy/install.sh index d506229..c0980b9 100644 --- a/caddy/install.sh +++ b/caddy/install.sh @@ -19,7 +19,7 @@ pkg_get_current_version() { # v2.1.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8= # This trims it down to just the version number: # 2.1.0 - echo "$(caddy version 2>/dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')" + echo "$(caddy version 2> /dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')" } pkg_install() { diff --git a/chromedriver/install.sh b/chromedriver/install.sh index d57d8b5..b7e4bbf 100644 --- a/chromedriver/install.sh +++ b/chromedriver/install.sh @@ -33,7 +33,7 @@ # ChromeDriver 88.0.4324.96 (68dba2d8a0b149a1d3afac56fa74648032bcf46b-refs/branch-heads/4324@{#1784}) # This trims it down to just the version number: # 88.0.4324.96 - echo $(chromedriver --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2) + echo $(chromedriver --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2) } } diff --git a/comrak/install.sh b/comrak/install.sh index 8e50352..a51a902 100644 --- a/comrak/install.sh +++ b/comrak/install.sh @@ -11,11 +11,11 @@ WEBI_SINGLE=true pkg_get_current_version() { - # 'comrak --version' has output in this format: - # comrak 0.8.1 - # This trims it down to just the version number: - # 0.8.1 - echo $(comrak --version 2>/dev/null | head -n 1 | cut -d' ' -f 2) + # 'comrak --version' has output in this format: + # comrak 0.8.1 + # This trims it down to just the version number: + # 0.8.1 + echo $(comrak --version 2> /dev/null | head -n 1 | cut -d' ' -f 2) } pkg_install() { diff --git a/curlie/install.ps1 b/curlie/install.ps1 index bc99769..5b79cc9 100644 --- a/curlie/install.ps1 +++ b/curlie/install.ps1 @@ -28,7 +28,7 @@ IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME")) & tar xf "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE" # Move single binary into root of temporary folder & move "$EXENAME" "$VERNAME" - + # Settle unpacked archive into place echo "New Name: $VERNAME" diff --git a/curlie/install.sh b/curlie/install.sh index ab6f300..f22adbd 100644 --- a/curlie/install.sh +++ b/curlie/install.sh @@ -11,13 +11,13 @@ WEBI_SINGLE=true pkg_get_current_version() { - # 'curlie --version' has output in this format: - # TODO - # This trims it down to just the version number: - # TODO - #echo $(curlie --version 2>/dev/null | head -n 1 | cut -d' ' -f 2) - # See https://github.com/rs/curlie/issues/22 - echo "0.0.0" + # 'curlie --version' has output in this format: + # TODO + # This trims it down to just the version number: + # TODO + #echo $(curlie --version 2>/dev/null | head -n 1 | cut -d' ' -f 2) + # See https://github.com/rs/curlie/issues/22 + echo "0.0.0" } pkg_install() { diff --git a/deno/install.sh b/deno/install.sh index 06d83b2..78fc3d5 100644 --- a/deno/install.sh +++ b/deno/install.sh @@ -19,7 +19,7 @@ pkg_get_current_version() { # typescript 3.9.2 # This trims it down to just the version number: # 1.1.1 - echo "$(deno --version 2>/dev/null | head -n 1 | cut -d' ' -f2)" + echo "$(deno --version 2> /dev/null | head -n 1 | cut -d' ' -f2)" } pkg_install() { diff --git a/dotenv-linter/install.sh b/dotenv-linter/install.sh index 9bff300..8a8c2ad 100644 --- a/dotenv-linter/install.sh +++ b/dotenv-linter/install.sh @@ -33,7 +33,7 @@ # dotenv-linter 0.99.9 (rev abcdef0123) # This trims it down to just the version number: # 0.99.9 - echo $(dotenv-linter --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2) + echo $(dotenv-linter --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2) } } diff --git a/dotenv/install.sh b/dotenv/install.sh index 5a63bec..60bfb3d 100644 --- a/dotenv/install.sh +++ b/dotenv/install.sh @@ -34,7 +34,7 @@ function __init_dotenv() { # dotenv v1.0.0 (17c7677) 2020-10-19T23:43:57Z # This trims it down to just the version number: # 1.0.0 - echo "$(dotenv --version 2>/dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" + echo "$(dotenv --version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" } } diff --git a/fd/install.ps1 b/fd/install.ps1 index bc99769..5b79cc9 100644 --- a/fd/install.ps1 +++ b/fd/install.ps1 @@ -28,7 +28,7 @@ IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME")) & tar xf "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE" # Move single binary into root of temporary folder & move "$EXENAME" "$VERNAME" - + # Settle unpacked archive into place echo "New Name: $VERNAME" diff --git a/fd/install.sh b/fd/install.sh index 92621ef..50af476 100644 --- a/fd/install.sh +++ b/fd/install.sh @@ -11,11 +11,11 @@ WEBI_SINGLE=true pkg_get_current_version() { - # 'fd --version' has output in this format: - # fd 8.1.1 - # This trims it down to just the version number: - # 8.1.1 - echo $(fd --version 2>/dev/null | head -n 1 | cut -d' ' -f 2) + # 'fd --version' has output in this format: + # fd 8.1.1 + # This trims it down to just the version number: + # 8.1.1 + echo $(fd --version 2> /dev/null | head -n 1 | cut -d' ' -f 2) } pkg_install() { diff --git a/ffmpeg/install.sh b/ffmpeg/install.sh index fb0ef78..eaf4e30 100644 --- a/ffmpeg/install.sh +++ b/ffmpeg/install.sh @@ -35,7 +35,7 @@ # ... # This trims it down to just the version number: # 4.3.1 - echo $(ffmpeg -version 2>/dev/null | head -n 1 | cut -d ' ' -f 3) + echo $(ffmpeg -version 2> /dev/null | head -n 1 | cut -d ' ' -f 3) } } diff --git a/fish/install.sh b/fish/install.sh index 097477d..49df30b 100644 --- a/fish/install.sh +++ b/fish/install.sh @@ -80,5 +80,5 @@ function pkg_get_current_version() { # fish, version 3.1.2 # This trims it down to just the version number: # 3.1.2 - echo $(fish --version 2>/dev/null | head -n 1 | cut -d ' ' -f 3) + echo $(fish --version 2> /dev/null | head -n 1 | cut -d ' ' -f 3) } diff --git a/flutter/install.sh b/flutter/install.sh index 82fac23..9626eb3 100644 --- a/flutter/install.sh +++ b/flutter/install.sh @@ -21,7 +21,6 @@ pkg_src_cmd="$HOME/.local/opt/flutter-v$WEBI_VERSION/bin/flutter" pkg_src_dir="$HOME/.local/opt/flutter-v$WEBI_VERSION" pkg_src="$pkg_src_dir" - pkg_get_current_version() { # 'flutter --version' outputs a lot of information: # Flutter 1.19.0-4.1.pre • channel beta • https://github.com/flutter/flutter.git @@ -30,7 +29,7 @@ pkg_get_current_version() { # Tools • Dart 2.9.0 (build 2.9.0-14.1.beta) # This trims it down to just the version number: # 1.19.0-4.1.pre - echo "$(flutter --version 2>/dev/null | head -n 1 | cut -d' ' -f2)" + echo "$(flutter --version 2> /dev/null | head -n 1 | cut -d' ' -f2)" } pkg_format_cmd_version() { diff --git a/fzf/install.ps1 b/fzf/install.ps1 index af36033..5b79cc9 100644 --- a/fzf/install.ps1 +++ b/fzf/install.ps1 @@ -28,7 +28,7 @@ IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME")) & tar xf "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE" # Move single binary into root of temporary folder & move "$EXENAME" "$VERNAME" - + # Settle unpacked archive into place echo "New Name: $VERNAME" diff --git a/fzf/install.sh b/fzf/install.sh index 908001c..6c2145e 100644 --- a/fzf/install.sh +++ b/fzf/install.sh @@ -11,11 +11,11 @@ WEBI_SINGLE=true pkg_get_current_version() { - # 'fzf --version' has output in this format: - # 0.21.1 (334a4fa) - # This trims it down to just the version number: - # 0.21.1 - echo $(fzf --version 2>/dev/null | head -n 1 | cut -d' ' -f 1) + # 'fzf --version' has output in this format: + # 0.21.1 (334a4fa) + # This trims it down to just the version number: + # 0.21.1 + echo $(fzf --version 2> /dev/null | head -n 1 | cut -d' ' -f 1) } pkg_install() { diff --git a/gitdeploy/install.sh b/gitdeploy/install.sh index f7b77c0..6b7965a 100644 --- a/gitdeploy/install.sh +++ b/gitdeploy/install.sh @@ -34,7 +34,7 @@ function __init_gitdeploy() { # gitdeploy v0.7.1 (be68fec) 2020-10-20T22:27:47Z) # This trims it down to just the version number: # 0.7.1 - echo "$(gitdeploy --version 2>/dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" + echo "$(gitdeploy --version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" } } diff --git a/gitea/install.sh b/gitea/install.sh index 6a4d586..bb55c66 100644 --- a/gitea/install.sh +++ b/gitea/install.sh @@ -10,7 +10,7 @@ pkg_get_current_version() { # v2.1.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8= # This trims it down to just the version number: # 2.0.0 - echo "$(gitea --version 2>/dev/null | head -n 1 | cut -d' ' -f3)" + echo "$(gitea --version 2> /dev/null | head -n 1 | cut -d' ' -f3)" } pkg_link() { diff --git a/golang/install.ps1 b/golang/install.ps1 index 8b7f8c2..15b9fa7 100644 --- a/golang/install.ps1 +++ b/golang/install.ps1 @@ -61,19 +61,19 @@ echo "Building go language tools..." echo gopls & "$pkg_dst_cmd" get golang.org/x/tools/gopls echo golint -& "$pkg_dst_cmd" get golang.org/x/lint/golint +& "$pkg_dst_cmd" get golang.org/x/lint/golint echo errcheck -& "$pkg_dst_cmd" get github.com/kisielk/errcheck +& "$pkg_dst_cmd" get github.com/kisielk/errcheck echo gotags -& "$pkg_dst_cmd" get github.com/jstemmer/gotags +& "$pkg_dst_cmd" get github.com/jstemmer/gotags echo goimports -& "$pkg_dst_cmd" get golang.org/x/tools/cmd/goimports +& "$pkg_dst_cmd" get golang.org/x/tools/cmd/goimports echo gorename -& "$pkg_dst_cmd" get golang.org/x/tools/cmd/gorename +& "$pkg_dst_cmd" get golang.org/x/tools/cmd/gorename echo gotype -& "$pkg_dst_cmd" get golang.org/x/tools/cmd/gotype +& "$pkg_dst_cmd" get golang.org/x/tools/cmd/gotype echo stringer -& "$pkg_dst_cmd" get golang.org/x/tools/cmd/stringer +& "$pkg_dst_cmd" get golang.org/x/tools/cmd/stringer # Add to path & "$Env:USERPROFILE\.local\bin\pathman.exe" add ~/.local/opt/go/bin diff --git a/golang/install.sh b/golang/install.sh index 30493cf..01b5a19 100644 --- a/golang/install.sh +++ b/golang/install.sh @@ -19,7 +19,7 @@ pkg_get_current_version() { # go version go1.14.2 darwin/amd64 # This trims it down to just the version number: # 1.14.2 - echo "$(go version 2>/dev/null | head -n 1 | cut -d' ' -f3 | sed 's:go::')" + echo "$(go version 2> /dev/null | head -n 1 | cut -d' ' -f3 | sed 's:go::')" } pkg_format_cmd_version() { diff --git a/goreleaser/install.sh b/goreleaser/install.sh index b11248e..92eb6c9 100644 --- a/goreleaser/install.sh +++ b/goreleaser/install.sh @@ -33,7 +33,7 @@ # goreleaser 0.99.9 (rev abcdef0123) # This trims it down to just the version number: # 0.99.9 - echo $(goreleaser --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2) + echo $(goreleaser --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2) } } diff --git a/gprox/README.md b/gprox/README.md index 9d94565..f8650bb 100644 --- a/gprox/README.md +++ b/gprox/README.md @@ -20,7 +20,7 @@ gprox # example output # 9:12PM INF Running proxy! from=https://localhost:9001 to=http://localhost:9000 ``` -And you're off to the races! +And you're off to the races! That is... if you're app happens to be running on port `9000`. If not, no worries! Simply pass the target port option `-t, --target` and specify the port your app _is_ running on. diff --git a/gprox/install.ps1 b/gprox/install.ps1 index fa581df..b24e770 100644 --- a/gprox/install.ps1 +++ b/gprox/install.ps1 @@ -34,7 +34,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Enter tmp pushd .local\tmp - # Remove any leftover tmp cruft + # Remove any leftover tmp cruft Remove-Item -Path ".\gprox-v*" -Recurse -ErrorAction Ignore Remove-Item -Path ".\gprox.exe" -Recurse -ErrorAction Ignore @@ -46,7 +46,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Windows BSD-tar handles zip. Imagine that. echo "Unpacking $pkg_download" & tar xf "$pkg_download" - + # Settle unpacked archive into place echo "Install Location: $pkg_src_cmd" New-Item "$pkg_src_bin" -ItemType Directory diff --git a/gprox/install.sh b/gprox/install.sh index ab63c80..d78f519 100644 --- a/gprox/install.sh +++ b/gprox/install.sh @@ -33,7 +33,7 @@ # gprox 0.99.9 (rev abcdef0123) # This trims it down to just the version number: # 0.99.9 - echo $(gprox --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2) + echo $(gprox --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2) } } diff --git a/hexyl/install.sh b/hexyl/install.sh index a4b224d..218c0e3 100644 --- a/hexyl/install.sh +++ b/hexyl/install.sh @@ -11,11 +11,11 @@ WEBI_SINGLE=true pkg_get_current_version() { - # 'hexyl --version' has output in this format: - # hexyl 0.8.0 - # This trims it down to just the version number: - # 0.8.0 - echo $(hexyl --version 2>/dev/null | head -n 1 | cut -d' ' -f 2) + # 'hexyl --version' has output in this format: + # hexyl 0.8.0 + # This trims it down to just the version number: + # 0.8.0 + echo $(hexyl --version 2> /dev/null | head -n 1 | cut -d' ' -f 2) } pkg_install() { diff --git a/hugo/install.sh b/hugo/install.sh index 04bc4f7..fce62f4 100644 --- a/hugo/install.sh +++ b/hugo/install.sh @@ -9,5 +9,5 @@ pkg_get_current_version() { # Hugo Static Site Generator v0.72.0-8A7EF3CF darwin/amd64 BuildDate: 2020-05-31T12:07:44Z # This trims it down to just the version number: # 0.72.0 - echo "$(hugo version 2>/dev/null | head -n 1 | cut -d' ' -f5 | cut -d '-' -f1 | sed 's:^v::')" + echo "$(hugo version 2> /dev/null | head -n 1 | cut -d' ' -f5 | cut -d '-' -f1 | sed 's:^v::')" } diff --git a/jq/install.sh b/jq/install.sh index 5a28ed4..a15919d 100644 --- a/jq/install.sh +++ b/jq/install.sh @@ -11,10 +11,10 @@ WEBI_SINGLE=true pkg_get_current_version() { - # 'jq --version' has output in this format: - # jq-1.6 - # This trims it down to just the version number: - # 1.6 - echo $(jq --version 2>/dev/null | head -n 1 | sed 's:^jq-::') + # 'jq --version' has output in this format: + # jq-1.6 + # This trims it down to just the version number: + # 1.6 + echo $(jq --version 2> /dev/null | head -n 1 | sed 's:^jq-::') } } diff --git a/k9s/README.md b/k9s/README.md index cac23c9..c2bbd07 100644 --- a/k9s/README.md +++ b/k9s/README.md @@ -55,4 +55,4 @@ k9s --context coolCtx Start K9s in readonly mode - with all cluster modification commands disabled ```bash k9s --readonly -``` \ No newline at end of file +``` diff --git a/k9s/install.ps1 b/k9s/install.ps1 index 68aca77..9a313a5 100644 --- a/k9s/install.ps1 +++ b/k9s/install.ps1 @@ -45,7 +45,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Settle unpacked archive into place echo "Install Location: $pkg_src_cmd" - New-Item "$pkg_src_bin" -ItemType Directory -Force + New-Item "$pkg_src_bin" -ItemType Directory -Force Move-Item -Path "k9s.exe" -Destination "$pkg_src_bin" # Exit tmp diff --git a/k9s/install.sh b/k9s/install.sh index 62a050e..f027ea1 100644 --- a/k9s/install.sh +++ b/k9s/install.sh @@ -37,7 +37,7 @@ # This trims it down to just the version number: # 0.24.2 - echo $(k9s version 2>/dev/null | grep Version: | cut -d 'v' -f 2) + echo $(k9s version 2> /dev/null | grep Version: | cut -d 'v' -f 2) } } diff --git a/keypairs/install.sh b/keypairs/install.sh index 61bb1ad..38b7fc7 100644 --- a/keypairs/install.sh +++ b/keypairs/install.sh @@ -34,7 +34,7 @@ function __init_keypairs() { # keypairs v0.6.5 (7e6fd17) 2020-10-21T06:26:46Z # This trims it down to just the version number: # 0.6.5 - echo "$(keypairs --version 2>/dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" + echo "$(keypairs --version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" } } diff --git a/kubectx/install.ps1 b/kubectx/install.ps1 index 85e2464..b30c92d 100644 --- a/kubectx/install.ps1 +++ b/kubectx/install.ps1 @@ -45,7 +45,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Settle unpacked archive into place echo "Install Location: $pkg_src_cmd" - New-Item "$pkg_src_bin" -ItemType Directory -Force + New-Item "$pkg_src_bin" -ItemType Directory -Force Move-Item -Path "kubectx.exe" -Destination "$pkg_src_bin" # Exit tmp diff --git a/kubectx/install.sh b/kubectx/install.sh index 40b1801..17b34b8 100644 --- a/kubectx/install.sh +++ b/kubectx/install.sh @@ -30,7 +30,7 @@ # pkg_get_current_version is recommended, but (soon) not required pkg_get_current_version() { # 'kubectx' has no version parameter - echo + echo } } diff --git a/kubens/install.ps1 b/kubens/install.ps1 index 38ae465..b7a4095 100644 --- a/kubens/install.ps1 +++ b/kubens/install.ps1 @@ -45,7 +45,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Settle unpacked archive into place echo "Install Location: $pkg_src_cmd" - New-Item "$pkg_src_bin" -ItemType Directory -Force + New-Item "$pkg_src_bin" -ItemType Directory -Force Move-Item -Path "kubens.exe" -Destination "$pkg_src_bin" # Exit tmp diff --git a/kubens/install.sh b/kubens/install.sh index 21b4ffe..b4cdb15 100644 --- a/kubens/install.sh +++ b/kubens/install.sh @@ -30,7 +30,7 @@ # pkg_get_current_version is recommended, but (soon) not required pkg_get_current_version() { # 'kubens' has no version parameter - echo + echo } } diff --git a/kubens/releases.js b/kubens/releases.js index 009b8b2..09276c9 100644 --- a/kubens/releases.js +++ b/kubens/releases.js @@ -12,7 +12,7 @@ module.exports = function (request) { }); return all; }); -}; +}; if (module === require.main) { module.exports(require('@root/request')).then(function (all) { diff --git a/lf/install.sh b/lf/install.sh index f488eb6..19d63ee 100644 --- a/lf/install.sh +++ b/lf/install.sh @@ -34,7 +34,7 @@ function __init_lf() { # r21 # This treats it as a minor version number: # 0.21.0 - echo "0.$(lf --version 2>/dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^r::').0" + echo "0.$(lf --version 2> /dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^r::').0" } } diff --git a/lsd/install.ps1 b/lsd/install.ps1 index 4b43585..bc74e44 100644 --- a/lsd/install.ps1 +++ b/lsd/install.ps1 @@ -34,7 +34,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Enter tmp pushd .local\tmp - # Remove any leftover tmp cruft + # Remove any leftover tmp cruft Remove-Item -Path ".\lsd-v*" -Recurse -ErrorAction Ignore Remove-Item -Path ".\lsd.exe" -Recurse -ErrorAction Ignore @@ -42,7 +42,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Windows BSD-tar handles zip. Imagine that. echo "Unpacking $pkg_download" & tar xf "$pkg_download" - + # Settle unpacked archive into place echo "Install Location: $pkg_src_cmd" diff --git a/lsd/install.sh b/lsd/install.sh index ac80315..67d5876 100644 --- a/lsd/install.sh +++ b/lsd/install.sh @@ -33,7 +33,7 @@ # lsd 0.17.0 # This trims it down to just the version number: # 0.17.0 - echo $(lsd --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2) + echo $(lsd --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2) } } diff --git a/macos/install.sh b/macos/install.sh index 3848588..d89e520 100644 --- a/macos/install.sh +++ b/macos/install.sh @@ -5,26 +5,26 @@ set -u webi_download -pushd ~/Downloads 2>&1 >/dev/null +pushd ~/Downloads 2>&1 > /dev/null if [ "Darwin" == "$(uname -s)" ]; then - curl -fsSL 'https://gist.githubusercontent.com/solderjs/8c36d132250163011c83bad8284975ee/raw/5a291955813743c20c12ca2d35c7b1bb34f8aecc/create-bootable-installer-for-os-x-el-capitan.sh' -o create-bootable-installer-for-os-x-el-capitan.sh - bash create-bootable-installer-for-os-x-el-capitan.sh + curl -fsSL 'https://gist.githubusercontent.com/solderjs/8c36d132250163011c83bad8284975ee/raw/5a291955813743c20c12ca2d35c7b1bb34f8aecc/create-bootable-installer-for-os-x-el-capitan.sh' -o create-bootable-installer-for-os-x-el-capitan.sh + bash create-bootable-installer-for-os-x-el-capitan.sh else - curl -fsSL 'https://gist.githubusercontent.com/solderjs/9834a45a6c21a41e8882698a00b55787/raw/c43061cd0c53ec675996f5cb66c7077e666aabd4/install-mac-tools.sh' -o install-mac-tools.sh - # TODO add xar to webinstall.dev - sudo apt install libz-dev # needed for xar - bash install-mac-tools.sh - echo "WARN: may need a restart for hfsplus to be recognized by the kernel" + curl -fsSL 'https://gist.githubusercontent.com/solderjs/9834a45a6c21a41e8882698a00b55787/raw/c43061cd0c53ec675996f5cb66c7077e666aabd4/install-mac-tools.sh' -o install-mac-tools.sh + # TODO add xar to webinstall.dev + sudo apt install libz-dev # needed for xar + bash install-mac-tools.sh + echo "WARN: may need a restart for hfsplus to be recognized by the kernel" - curl -fsSL 'https://gist.github.com/solderjs/04fd06560a8465a695337eb502f5b0e9/raw/0a06fb4dce91399d374d9a12958dabb48a9bd42a/empty.7400m.img.bz2' -o empty.7400m.img.bz2 + curl -fsSL 'https://gist.github.com/solderjs/04fd06560a8465a695337eb502f5b0e9/raw/0a06fb4dce91399d374d9a12958dabb48a9bd42a/empty.7400m.img.bz2' -o empty.7400m.img.bz2 - curl -fsSL 'https://gist.githubusercontent.com/solderjs/9834a45a6c21a41e8882698a00b55787/raw/c43061cd0c53ec675996f5cb66c7077e666aabd4/linux-create-bootable-macos-recovery-image.sh' -o linux-create-bootable-macos-recovery-image.sh - bash linux-create-bootable-macos-recovery-image.sh + curl -fsSL 'https://gist.githubusercontent.com/solderjs/9834a45a6c21a41e8882698a00b55787/raw/c43061cd0c53ec675996f5cb66c7077e666aabd4/linux-create-bootable-macos-recovery-image.sh' -o linux-create-bootable-macos-recovery-image.sh + bash linux-create-bootable-macos-recovery-image.sh fi echo "" echo "Created $HOME/Downloads/el-capitan.iso" echo "" -popd 2>&1 >/dev/null +popd 2>&1 > /dev/null diff --git a/mutagen/install.sh b/mutagen/install.sh index 39e5a66..033eb0b 100644 --- a/mutagen/install.sh +++ b/mutagen/install.sh @@ -33,7 +33,7 @@ function __init_mutagen() { # 0.11.8 # This trims it down to just the version number: # 0.11.8 - echo $(mutagen version 2>/dev/null | head -n 1 | cut -d ' ' -f1) + echo $(mutagen version 2> /dev/null | head -n 1 | cut -d ' ' -f1) } } diff --git a/myip/install.sh b/myip/install.sh index 2965145..0d261e5 100644 --- a/myip/install.sh +++ b/myip/install.sh @@ -5,7 +5,7 @@ set -u rm -f "$HOME/.local/bin/myip" - webi_download "$WEBI_HOST/packages/myip/myip.sh" "$HOME/.local/bin/myip" + webi_download "$WEBI_HOST/packages/myip/myip.sh" "$HOME/.local/bin/myip" chmod a+x "$HOME/.local/bin/myip" "$HOME/.local/bin/myip" diff --git a/myip/myip.sh b/myip/myip.sh index 1fb90ee..ca57d6c 100644 --- a/myip/myip.sh +++ b/myip/myip.sh @@ -7,16 +7,16 @@ function __show_my_ip { ipv4=$(curl -s https://api.ipify.org || true) ipv6=$(curl -s https://api6.ipify.org || true) - if [[ -n "${ipv4}" ]]; then + if [[ -n ${ipv4} ]]; then echo "IPv4 (A) : $ipv4" fi - if [[ -n "$ipv6" ]] && [[ "ipv6" != "ipv4" ]]; then + if [[ -n $ipv6 ]] && [[ "ipv6" != "ipv4" ]]; then echo "IPv6 (AAAA): $ipv6" fi - if [[ -z "$ipv4" ]] && [[ -z "ipv6" ]]; then - >&2 echo "error: no public IP address" + if [[ -z $ipv4 ]] && [[ -z "ipv6" ]]; then + echo >&2 "error: no public IP address" fi } diff --git a/nerdfont/install.ps1 b/nerdfont/install.ps1 index 35ecc2c..668c758 100644 --- a/nerdfont/install.ps1 +++ b/nerdfont/install.ps1 @@ -7,20 +7,29 @@ New-Item -Path "$my_fontdir" -ItemType Directory -Force IF (!(Test-Path -Path "$my_fontdir\$my_nerdfont_otf")) { - & curl.exe -fsSLo "$my_nerdfont_otf" 'https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete%20Windows%20Compatible.otf' + & curl.exe -fsSLo "$my_nerdfont_otf" 'https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete +/Droid%20Sans%20Mono%20Nerd%20Font%20Complete%20Windows%20Compatible.otf' & move "$my_nerdfont_otf" "$my_fontdir" } -# See https://superuser.com/a/1306464/73857 pushd "$my_fontdir" -Add-Type -Name Session -Namespace "" -Member @" -[DllImport("gdi32.dll")] -public static extern int AddFontResource(string filePath); -"@ -$null = foreach($font in Get-ChildItem -Recurse -Include *.ttf, *.otf) { - [Session]::AddFontResource($font.FullName) +$regFontPath = "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" +$fontRegistryPath = "HKCU:$regFontPath" +$fontFiles = Get-ChildItem -Recurse -Include *.ttf, *.otf +$null = foreach($font in $fontFiles) { + # See https://github.com/PPOSHGROUP/PPoShTools/blob/master/PPoShTools/Public/FileSystem/Add-Font.ps1#L80 + Add-Type -AssemblyName System.Drawing + $objFontCollection = New-Object System.Drawing.Text.PrivateFontCollection + $objFontCollection.AddFontFile($font.FullName) + $FontName = $objFontCollection.Families.Name + + $regTest = Get-ItemProperty -Path $fontRegistryPath -Name "*$FontName*" -ErrorAction SilentlyContinue + if (-not ($regTest)) { + New-ItemProperty -Name $FontName -Path $fontRegistryPath -PropertyType string -Value $font.FullName + Write-Output "Registering font {$($font.Name)} in registry with name {$FontName}" + } } echo "Installed $my_nerdfont_otf to $my_fontdir" diff --git a/nerdfont/install.sh b/nerdfont/install.sh index 446a22f..b281c8f 100644 --- a/nerdfont/install.sh +++ b/nerdfont/install.sh @@ -1,25 +1,24 @@ install() { - set -e - set -u + set -e + set -u - my_nerdfont="Droid Sans Mono for Powerline Nerd Font Complete.otf" - curl -fsSLo "$my_nerdfont" \ - 'https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete.otf' + my_nerdfont="Droid Sans Mono for Powerline Nerd Font Complete.otf" + curl -fsSLo "$my_nerdfont" \ + 'https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/DroidSansMono/complete/Droid%20Sans%20Mono%20Nerd%20Font%20Complete.otf' + my_fontdir="" + if [ -e "$HOME/Library/Fonts" ]; then + # OS X + mv "$my_nerdfont" ~/Library/Fonts/ + my_fontdir="~/Library/Fonts/" + else + # Linux + mkdir -p ~/.local/share/fonts + mv "$my_nerdfont" ~/.local/share/fonts/ + my_fontdir="~/.local/share/fonts/" + fi - my_fontdir="" - if [ -e "$HOME/Library/Fonts" ]; then - # OS X - mv "$my_nerdfont" ~/Library/Fonts/ - my_fontdir="~/Library/Fonts/" - else - # Linux - mkdir -p ~/.local/share/fonts - mv "$my_nerdfont" ~/.local/share/fonts/ - my_fontdir="~/.local/share/fonts/" - fi - - echo "Installed $my_nerdfont to $my_fontdir" + echo "Installed $my_nerdfont to $my_fontdir" } install diff --git a/node/install.sh b/node/install.sh index add5022..ecc20dd 100644 --- a/node/install.sh +++ b/node/install.sh @@ -17,7 +17,7 @@ pkg_get_current_version() { # v12.8.0 # This trims it down to just the version number: # 12.8.0 - echo "$(node --version 2>/dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')" + echo "$(node --version 2> /dev/null | head -n 1 | cut -d' ' -f1 | sed 's:^v::')" } pkg_install() { diff --git a/pandoc/install.ps1 b/pandoc/install.ps1 index 4f48056..709e910 100644 --- a/pandoc/install.ps1 +++ b/pandoc/install.ps1 @@ -34,7 +34,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Enter tmp pushd .local\tmp - # Remove any leftover tmp cruft + # Remove any leftover tmp cruft Remove-Item -Path ".\pandoc-v*" -Recurse -ErrorAction Ignore Remove-Item -Path ".\pandoc.exe" -Recurse -ErrorAction Ignore @@ -42,7 +42,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Windows BSD-tar handles zip. Imagine that. echo "Unpacking $pkg_download" & tar xf "$pkg_download" - + # Settle unpacked archive into place echo "Install Location: $pkg_src_cmd" diff --git a/pandoc/install.sh b/pandoc/install.sh index b69a585..5141a0f 100644 --- a/pandoc/install.sh +++ b/pandoc/install.sh @@ -38,6 +38,6 @@ # for a particular purpose. # This trims it down to just the version number: # 2.10.1 - echo $(pandoc --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2) + echo $(pandoc --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2) } } diff --git a/pathman/install.sh b/pathman/install.sh index 9fc604c..0d93ef5 100644 --- a/pathman/install.sh +++ b/pathman/install.sh @@ -7,7 +7,7 @@ pkg_cmd_name="pathman" WEBI_SINGLE=true pkg_get_current_version() { - echo $(pathman version 2>/dev/null | head -n 1 | cut -d ' ' -f2 | sed 's:^v::') + echo $(pathman version 2> /dev/null | head -n 1 | cut -d ' ' -f2 | sed 's:^v::') } pkg_done_message() { diff --git a/postgres/install.sh b/postgres/install.sh index a8769f5..f0336fe 100644 --- a/postgres/install.sh +++ b/postgres/install.sh @@ -11,7 +11,7 @@ pkg_get_current_version() { # postgres (PostgreSQL) 10.13 # This trims it down to just the version number: # 10.13 - echo "$(postgres --version 2>/dev/null | head -n 1 | cut -d' ' -f3)" + echo "$(postgres --version 2> /dev/null | head -n 1 | cut -d' ' -f3)" } pkg_install() { @@ -42,11 +42,11 @@ pkg_post_install() { chmod 0700 "$POSTGRES_DATA_DIR" if [ ! -f "$POSTGRES_DATA_DIR/postgresql.conf" ]; then - echo "postgres" > "$PWFILE" - "$pkg_src/bin/initdb" \ - -D "$POSTGRES_DATA_DIR/" \ - --username postgres --pwfile "$PWFILE" \ - --auth-local=password --auth-host=password + echo "postgres" > "$PWFILE" + "$pkg_src/bin/initdb" \ + -D "$POSTGRES_DATA_DIR/" \ + --username postgres --pwfile "$PWFILE" \ + --auth-local=password --auth-host=password fi } @@ -63,4 +63,3 @@ pkg_done_message() { echo " psql 'postgres://postgres:postgres@localhost:5432/postgres'" echo "" } - diff --git a/powershell/install.sh b/powershell/install.sh index ac1a36c..5a81b9b 100644 --- a/powershell/install.sh +++ b/powershell/install.sh @@ -14,7 +14,7 @@ # PowerShell 7.0.2 # This trims it down to just the version number: # 7.0.2 - echo "$(pwsh --version 2>/dev/null | head -n 1 | cut -d' ' -f2)" + echo "$(pwsh --version 2> /dev/null | head -n 1 | cut -d' ' -f2)" } pkg_install() { @@ -23,9 +23,9 @@ mv ./* "$pkg_src" # symlink powershell to pwsh - pushd "$pkg_src" >/dev/null - ln -s pwsh powershell - popd >/dev/null + pushd "$pkg_src" > /dev/null + ln -s pwsh powershell + popd > /dev/null } pkg_link() { diff --git a/prettier/install.sh b/prettier/install.sh index 86e8028..7df196f 100644 --- a/prettier/install.sh +++ b/prettier/install.sh @@ -1,6 +1,6 @@ #!/bin/bash -if [ -z "$(npm --version 2>/dev/null)" ]; then +if [ -z "$(npm --version 2> /dev/null)" ]; then webi node export PATH="$HOME/.local/opt/node/bin:$PATH" fi diff --git a/pyenv/install.sh b/pyenv/install.sh index 0b53630..98b1a3e 100644 --- a/pyenv/install.sh +++ b/pyenv/install.sh @@ -9,8 +9,8 @@ function __init_pyenv() { if [ ! -f ~/.bashrc ] || [ -z "$(grep 'pyenv init' ~/.bashrc)" ]; then echo '' >> ~/.bashrc echo '# added by Webi for pyenv' >> ~/.bashrc - echo 'eval "$(pyenv init -)"'>> ~/.bashrc - echo 'eval "$(pyenv virtualenv-init -)"'>> ~/.bashrc + echo 'eval "$(pyenv init -)"' >> ~/.bashrc + echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc fi if [ -n "$(command -v zsh)" ]; then diff --git a/rclone/install.sh b/rclone/install.sh index d00f404..c116b8c 100644 --- a/rclone/install.sh +++ b/rclone/install.sh @@ -36,7 +36,7 @@ function __init_rclone() { # - go version: go1.15.7 # This trims it down to just the version number: # 1.54.0 - echo "$(rclone --version 2>/dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" + echo "$(rclone --version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" } } diff --git a/rg/install.ps1 b/rg/install.ps1 index 32581fd..f6da869 100644 --- a/rg/install.ps1 +++ b/rg/install.ps1 @@ -34,7 +34,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Enter tmp pushd .local\tmp - # Remove any leftover tmp cruft + # Remove any leftover tmp cruft Remove-Item -Path ".\ripgrep-v*" -Recurse -ErrorAction Ignore Remove-Item -Path ".\rg.exe" -Recurse -ErrorAction Ignore @@ -42,7 +42,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Windows BSD-tar handles zip. Imagine that. echo "Unpacking $pkg_download" & tar xf "$pkg_download" - + # Settle unpacked archive into place echo "Install Location: $pkg_src_cmd" diff --git a/rg/install.sh b/rg/install.sh index 3646e03..f979399 100644 --- a/rg/install.sh +++ b/rg/install.sh @@ -33,6 +33,6 @@ # +SIMD -AVX (runtime) # This trims it down to just the version number: # 12.1.1 - echo $(rg --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2) + echo $(rg --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2) } } diff --git a/sass/install.sh b/sass/install.sh index 801cd10..eca55d3 100644 --- a/sass/install.sh +++ b/sass/install.sh @@ -26,7 +26,7 @@ function __init_sass() { } pkg_get_current_version() { - echo $(sass --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2) + echo $(sass --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2) } } diff --git a/sclient/install.sh b/sclient/install.sh index 3cebf38..ee6693b 100644 --- a/sclient/install.sh +++ b/sclient/install.sh @@ -34,7 +34,7 @@ function __init_sclient() { # sclient 1.3.3 (455db50) 2020-12-02T22:05:35Z # This trims it down to just the version number: # 1.3.3 - echo "$(sclient --version 2>/dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" + echo "$(sclient --version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" } } diff --git a/sd/install.ps1 b/sd/install.ps1 index 8d170ca..ca86b8a 100644 --- a/sd/install.ps1 +++ b/sd/install.ps1 @@ -42,7 +42,7 @@ IF (!(Test-Path -Path "$pkg_src_cmd")) # Windows BSD-tar handles zip. Imagine that. echo "Unpacking $pkg_download" & tar xf "$pkg_download" - + # Settle unpacked archive into place echo "Install Location: $pkg_src_cmd" diff --git a/sd/install.sh b/sd/install.sh index af2bba1..fb4ea8a 100644 --- a/sd/install.sh +++ b/sd/install.sh @@ -23,7 +23,7 @@ # ~/.local/opt/sd-v0.99.9/bin mkdir -p "$(dirname $pkg_src_cmd)" # mv ./sd-*/sd "$pkg_src_cmd" - mv sd-* "$pkg_src_cmd" + mv sd-* "$pkg_src_cmd" } # pkg_get_current_version is recommended, but (soon) not required @@ -32,8 +32,7 @@ # sd 0.99.9 (rev abcdef0123) # This trims it down to just the version number: # 0.99.9 - echo $(sd --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2) + echo $(sd --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2) } - } diff --git a/serviceman/install.sh b/serviceman/install.sh index 3602521..ae14c59 100644 --- a/serviceman/install.sh +++ b/serviceman/install.sh @@ -34,7 +34,7 @@ function __init_serviceman() { # serviceman v0.8.0 (f3ab547) 2020-12-02T16:19:10-07:00 # This trims it down to just the version number: # 0.8.0 - echo "$(serviceman --version 2>/dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" + echo "$(serviceman --version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" } } diff --git a/shfmt/install.sh b/shfmt/install.sh index 90176a8..016b420 100644 --- a/shfmt/install.sh +++ b/shfmt/install.sh @@ -1,30 +1,30 @@ #!/bin/bash { - set -e - set -u + set -e + set -u - ################## - # Install shfmt # - ################## + ################## + # Install shfmt # + ################## - pkg_cmd_name="shfmt" + pkg_cmd_name="shfmt" - pkg_dst_cmd="$HOME/.local/bin/shfmt" - pkg_dst="$pkg_dst_cmd" + pkg_dst_cmd="$HOME/.local/bin/shfmt" + pkg_dst="$pkg_dst_cmd" - pkg_src_cmd="$HOME/.local/opt/shfmt-v$WEBI_VERSION/bin/shfmt" - pkg_src_dir="$HOME/.local/opt/shfmt-v$WEBI_VERSION" - pkg_src="$pkg_src_cmd" + pkg_src_cmd="$HOME/.local/opt/shfmt-v$WEBI_VERSION/bin/shfmt" + pkg_src_dir="$HOME/.local/opt/shfmt-v$WEBI_VERSION" + pkg_src="$pkg_src_cmd" - pkg_install() { - # ~/.local/opt/shfmt-v0.99.9/bin - mkdir -p "$(dirname $pkg_src_cmd)" - mv ./"$pkg_cmd_name"* "$pkg_src_cmd" - } + pkg_install() { + # ~/.local/opt/shfmt-v0.99.9/bin + mkdir -p "$(dirname $pkg_src_cmd)" + mv ./"$pkg_cmd_name"* "$pkg_src_cmd" + } - pkg_get_current_version() { - echo $(shfmt --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2) - } + pkg_get_current_version() { + echo $(shfmt --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2) + } } diff --git a/ssh-pubkey/install.sh b/ssh-pubkey/install.sh index 805f789..db9dc3f 100644 --- a/ssh-pubkey/install.sh +++ b/ssh-pubkey/install.sh @@ -7,7 +7,7 @@ MY_CMD="ssh-pubkey" rm -f "$HOME/.local/bin/$MY_CMD" - webi_download "$WEBI_HOST/packages/$MY_CMD/$MY_CMD.sh" "$HOME/.local/bin/$MY_CMD" + webi_download "$WEBI_HOST/packages/$MY_CMD/$MY_CMD.sh" "$HOME/.local/bin/$MY_CMD" chmod a+x "$HOME/.local/bin/$MY_CMD" # run the command diff --git a/ssh-utils/install.sh b/ssh-utils/install.sh index 08b3f8a..811377f 100644 --- a/ssh-utils/install.sh +++ b/ssh-utils/install.sh @@ -1,7 +1,7 @@ { rm -f "$HOME/.local/bin/ssh-pubkey" "$HOME/.local/bin/ssh-setpass" "$HOME/.local/bin/ssh-adduser" - webi_download "$WEBI_HOST/packages/ssh-utils/ssh-pubkey.sh" "$HOME/.local/bin/ssh-pubkey" - webi_download "$WEBI_HOST/packages/ssh-utils/ssh-setpass.sh" "$HOME/.local/bin/ssh-setpass" - webi_download "$WEBI_HOST/packages/ssh-utils/ssh-adduser.sh" "$HOME/.local/bin/ssh-adduser" + webi_download "$WEBI_HOST/packages/ssh-utils/ssh-pubkey.sh" "$HOME/.local/bin/ssh-pubkey" + webi_download "$WEBI_HOST/packages/ssh-utils/ssh-setpass.sh" "$HOME/.local/bin/ssh-setpass" + webi_download "$WEBI_HOST/packages/ssh-utils/ssh-adduser.sh" "$HOME/.local/bin/ssh-adduser" chmod a+x "$HOME/.local/bin/ssh-"* } diff --git a/ssh-utils/ssh-adduser.sh b/ssh-utils/ssh-adduser.sh index e3ee4ff..e14efb8 100644 --- a/ssh-utils/ssh-adduser.sh +++ b/ssh-utils/ssh-adduser.sh @@ -8,8 +8,8 @@ # TODO would $EUID be better? if [ "root" != "$(whoami)" ]; then - echo "webi adduser: running user is already a non-root user" - exit 0 + echo "webi adduser: running user is already a non-root user" + exit 0 fi #apt-get -y update @@ -41,8 +41,8 @@ # Install webi for the new 'app' user WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"} - sudo -i -u "$my_name" bash -c "curl -fsSL '$WEBI_HOST/webi' | bash" \ - || sudo -i -u "$my_name" bash -c "wget -q -O - '$WEBI_HOST/webi' | bash" + sudo -i -u "$my_name" bash -c "curl -fsSL '$WEBI_HOST/webi' | bash" || + sudo -i -u "$my_name" bash -c "wget -q -O - '$WEBI_HOST/webi' | bash" # TODO ensure that ssh-password login is off diff --git a/ssh-utils/ssh-pubkey.sh b/ssh-utils/ssh-pubkey.sh index ed5c345..d15cac5 100644 --- a/ssh-utils/ssh-pubkey.sh +++ b/ssh-utils/ssh-pubkey.sh @@ -22,20 +22,20 @@ if [ ! -f "$HOME/.ssh/id_rsa" ]; then ssh-keygen -b 2048 -t rsa -f "$HOME/.ssh/id_rsa" -q -N "" - >&2 echo "" + echo >&2 "" fi if [ ! -f "$HOME/.ssh/id_rsa.pub" ]; then ssh-keygen -y -f "$HOME/.ssh/id_rsa" > "$HOME/.ssh/id_rsa.pub" - >&2 echo "" + echo >&2 "" fi # TODO use the comment (if any) for the name of the file - >&2 echo "" - >&2 echo "~/Downloads/id_rsa.$(whoami).pub": - >&2 echo "" + echo >&2 "" + echo >&2 "~/Downloads/id_rsa.$(whoami).pub": + echo >&2 "" rm -f "$HOME/Downloads/id_rsa.$(whoami).pub" cp -r "$HOME/.ssh/id_rsa.pub" "$HOME/Downloads/id_rsa.$(whoami).pub" cat "$HOME/Downloads/id_rsa.$(whoami).pub" - >&2 echo "" + echo >&2 "" } diff --git a/sudo/install.sh b/sudo/install.sh index 6b37060..4724b3d 100644 --- a/sudo/install.sh +++ b/sudo/install.sh @@ -4,8 +4,8 @@ set -u { if [ -z "$(command -v sudo)" ]; then - >&2 echo "Error: on Linux and BSD you should install sudo via the native package manager" - >&2 echo " for example: apt install -y sudo" + echo >&2 "Error: on Linux and BSD you should install sudo via the native package manager" + echo >&2 " for example: apt install -y sudo" exit 1 else echo "'sudo' already installed" diff --git a/syncthing/install.sh b/syncthing/install.sh index 9599648..96bcca7 100644 --- a/syncthing/install.sh +++ b/syncthing/install.sh @@ -35,7 +35,7 @@ function __init_syncthing() { # syncthing v1.12.1 "Fermium Flea" (go1.15.5 darwin-amd64) teamcity@build.syncthing.net 2020-12-06 12:46:27 UTC # This trims it down to just the version number: # 1.12.1 - echo "$(syncthing --version 2>/dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" + echo "$(syncthing --version 2> /dev/null | head -n 1 | cut -d' ' -f2 | sed 's:^v::')" } } diff --git a/vim-ale/install.sh b/vim-ale/install.sh index 4cb252f..caf161a 100644 --- a/vim-ale/install.sh +++ b/vim-ale/install.sh @@ -18,7 +18,7 @@ function __init_vim_ale() { curl -fsSL -o ~/.vim/plugins/ale.vim "$WEBI_HOST/packages/vim-ale/ale.vim" fi - if ! grep 'source.*plugins.ale.vim' -r ~/.vimrc >/dev/null 2>/dev/null; then + if ! grep 'source.*plugins.ale.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then set +e mkdir -p ~/.vim/plugins printf '\n" ALE: reasonable defaults from webinstall.dev/vim-ale\n' >> ~/.vimrc diff --git a/vim-beyondcode/install.sh b/vim-beyondcode/install.sh index 3450f9b..ea8bcd0 100644 --- a/vim-beyondcode/install.sh +++ b/vim-beyondcode/install.sh @@ -1,24 +1,24 @@ # mostly lightweight, or essential webi \ - vim-leader \ - vim-shell \ - vim-sensible \ - vim-viminfo \ - vim-lastplace \ - vim-spell \ - vim-ale \ - vim-prettier \ - vim-whitespace + vim-leader \ + vim-shell \ + vim-sensible \ + vim-viminfo \ + vim-lastplace \ + vim-spell \ + vim-ale \ + vim-prettier \ + vim-whitespace # requires special hardware (mouse) or software (nerdfont) webi \ - vim-gui \ - vim-nerdtree \ - nerdfont \ - vim-devicons + vim-gui \ + vim-nerdtree \ + nerdfont \ + vim-devicons if [ -n "$(command -v go)" ]; then - webi vim-go + webi vim-go fi # done diff --git a/vim-devicons/install.sh b/vim-devicons/install.sh index 68d96b7..ce09ef8 100644 --- a/vim-devicons/install.sh +++ b/vim-devicons/install.sh @@ -18,7 +18,7 @@ function __init_vim_devicons() { curl -fsSL -o ~/.vim/plugins/devicons.vim "$WEBI_HOST/packages/vim-devicons/devicons.vim" fi - if ! grep 'source.*plugins.devicons.vim' -r ~/.vimrc >/dev/null 2>/dev/null; then + if ! grep 'source.*plugins.devicons.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then set +e mkdir -p ~/.vim/plugins printf '\n" devicons: reasonable defaults from webinstall.dev/vim-devicons\n' >> ~/.vimrc diff --git a/vim-essentials/install.sh b/vim-essentials/install.sh index bc34f2e..ec453e5 100644 --- a/vim-essentials/install.sh +++ b/vim-essentials/install.sh @@ -1,14 +1,14 @@ webi \ - vim-leader \ - vim-shell \ - vim-sensible \ - vim-viminfo \ - vim-lastplace \ - vim-spell \ - vim-ale \ - vim-prettier \ - vim-whitespace \ - # done + vim-leader \ + vim-shell \ + vim-sensible \ + vim-viminfo \ + vim-lastplace \ + vim-spell \ + vim-ale \ + vim-prettier \ + vim-whitespace +# done printf '\n' printf 'Suggestion: Also check out these great plugins:\n' diff --git a/vim-lastplace/install.sh b/vim-lastplace/install.sh index fa9e82c..90f8189 100644 --- a/vim-lastplace/install.sh +++ b/vim-lastplace/install.sh @@ -18,7 +18,7 @@ function __init_vim_lastplace() { curl -fsSL -o ~/.vim/plugins/lastplace.vim "$WEBI_HOST/packages/vim-lastplace/lastplace.vim" fi - if ! grep 'source.*plugins.lastplace.vim' -r ~/.vimrc >/dev/null 2>/dev/null; then + if ! grep 'source.*plugins.lastplace.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then set +e mkdir -p ~/.vim/plugins printf '\n" lastplace: explicit defaults from webinstall.dev/vim-lastplace\n' >> ~/.vimrc diff --git a/vim-nerdtree/install.sh b/vim-nerdtree/install.sh index 85a620c..193560d 100644 --- a/vim-nerdtree/install.sh +++ b/vim-nerdtree/install.sh @@ -18,7 +18,7 @@ function __init_vim_nerdtree() { curl -fsSL -o ~/.vim/plugins/nerdtree.vim "$WEBI_HOST/packages/vim-nerdtree/nerdtree.vim" fi - if ! grep 'source.*plugins.nerdtree.vim' -r ~/.vimrc >/dev/null 2>/dev/null; then + if ! grep 'source.*plugins.nerdtree.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then set +e mkdir -p ~/.vim/plugins printf '\n" NERDTree: reasonable defaults from webinstall.dev/vim-nerdtree\n' >> ~/.vimrc diff --git a/vim-prettier/install.sh b/vim-prettier/install.sh index eebd1fa..a23337a 100644 --- a/vim-prettier/install.sh +++ b/vim-prettier/install.sh @@ -9,8 +9,8 @@ function __init_vim_prettier() { git clone --depth=1 https://github.com/prettier/vim-prettier.git "$HOME/.vim/pack/plugins/start/vim-prettier" if [ -z "$(command -v node)" ]; then - export PATH="$HOME/.local/opt/node/bin:$HOME/.local/bin:${PATH}" - webi node + export PATH="$HOME/.local/opt/node/bin:$HOME/.local/bin:${PATH}" + webi node fi npm install -g prettier@2 @@ -24,7 +24,7 @@ function __init_vim_prettier() { curl -fsSL -o ~/.vim/plugins/prettier.vim "$WEBI_HOST/packages/vim-prettier/prettier.vim" fi - if ! grep 'source.*plugins.prettier.vim' -r ~/.vimrc >/dev/null 2>/dev/null; then + if ! grep 'source.*plugins.prettier.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then set +e mkdir -p ~/.vim/plugins printf '\n" Prettier: reasonable defaults from webinstall.dev/vim-prettier\n' >> ~/.vimrc diff --git a/vim-shfmt/install.sh b/vim-shfmt/install.sh index 4f276a2..6b8aedd 100644 --- a/vim-shfmt/install.sh +++ b/vim-shfmt/install.sh @@ -9,8 +9,8 @@ function __init_vim_shfmt() { git clone --depth=1 https://github.com/z0mbix/vim-shfmt.git "$HOME/.vim/pack/plugins/start/vim-shfmt" if [ -z "$(command -v shfmt)" ]; then - export PATH="$HOME/.local/bin:${PATH}" - webi shfmt + export PATH="$HOME/.local/bin:${PATH}" + webi shfmt fi if [ ! -f "$HOME/.vimrc" ]; then @@ -23,7 +23,7 @@ function __init_vim_shfmt() { curl -fsSL -o ~/.vim/plugins/shfmt.vim "$WEBI_HOST/packages/vim-shfmt/shfmt.vim" fi - if ! grep 'source.*plugins.shfmt.vim' -r ~/.vimrc >/dev/null 2>/dev/null; then + if ! grep 'source.*plugins.shfmt.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then set +e mkdir -p ~/.vim/plugins printf '\n" shfmt: reasonable defaults from webinstall.dev/vim-shfmt\n' >> ~/.vimrc diff --git a/vps-addswap/install.sh b/vps-addswap/install.sh index e3e3702..dd0bf5b 100644 --- a/vps-addswap/install.sh +++ b/vps-addswap/install.sh @@ -8,13 +8,13 @@ my_size=${1:-$default_size} if [ "0" != "$EUID" ] && [ "0" != "$UID" ]; then - echo Usage: - echo ' sudo env PATH="$PATH" vps-addswap' $my_size - exit 1 + echo Usage: + echo ' sudo env PATH="$PATH" vps-addswap' $my_size + exit 1 fi if [ -f "/var/swapfile" ]; then - swapoff /var/swapfile + swapoff /var/swapfile fi # Allocate a swapfile diff --git a/watchexec/install.sh b/watchexec/install.sh index c51a649..99d4f0d 100644 --- a/watchexec/install.sh +++ b/watchexec/install.sh @@ -30,10 +30,10 @@ # pkg_get_current_version is recommended, but (soon) not required pkg_get_current_version() { # 'watchexec --version' has output in this format: - # watchexec 0.99.9 + # watchexec 0.99.9 # This trims it down to just the version number: # 0.99.9 - echo $(watchexec --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2) + echo $(watchexec --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2) } } diff --git a/webi/install.sh b/webi/install.sh index 6531614..0c26ab4 100644 --- a/webi/install.sh +++ b/webi/install.sh @@ -5,17 +5,17 @@ { -if [ -f "$HOME/.local/bin/webi" ]; then - set +e - cur_webi="$(command -v webi)" - set -e - if [ -z "$cur_webi" ]; then - webi_path_add "$HOME/.local/bin" - fi - echo "Installed 'webi'" -else - # for when this file is run on its own, not from webinstall.dev - echo "Install any other package via https://webinstall.dev and webi will be installed as part of the bootstrap process" -fi + if [ -f "$HOME/.local/bin/webi" ]; then + set +e + cur_webi="$(command -v webi)" + set -e + if [ -z "$cur_webi" ]; then + webi_path_add "$HOME/.local/bin" + fi + echo "Installed 'webi'" + else + # for when this file is run on its own, not from webinstall.dev + echo "Install any other package via https://webinstall.dev and webi will be installed as part of the bootstrap process" + fi } diff --git a/xz/install.sh b/xz/install.sh index 54beb4c..7ff18a5 100644 --- a/xz/install.sh +++ b/xz/install.sh @@ -42,6 +42,6 @@ # liblzma 5.2.5 # This trims it down to just the version number: # 5.2.5 - echo $(xz --version 2>/dev/null | head -n 1 | cut -d ' ' -f 4) + echo $(xz --version 2> /dev/null | head -n 1 | cut -d ' ' -f 4) } } diff --git a/yq/install.sh b/yq/install.sh index 81d3fac..4d3ad85 100644 --- a/yq/install.sh +++ b/yq/install.sh @@ -20,7 +20,7 @@ } pkg_get_current_version() { - echo $(yq --version 2>/dev/null | head -n 1 | cut -d ' ' -f 2) + echo $(yq --version 2> /dev/null | head -n 1 | cut -d ' ' -f 2) } } -- 2.25.1