diff --git a/README.md b/README.md index b8e0388b8..2305e4e75 100755 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ Dorothy maintainers are daily driving Dorothy on: Dorothy users are daily driving Dorothy on: - Manjaro/Arch on Intel/AMD (x86_64) +- Windows 10 via [Ubuntu](https://ubuntu.com/wsl) [WSL2](https://docs.microsoft.com/en-au/windows/wsl/) on Intel/AMD (x86_64) - Windows 11 via [Ubuntu](https://ubuntu.com/wsl) [WSL2](https://docs.microsoft.com/en-au/windows/wsl/) on Intel/AMD (x86_64) Dorothy maintainers and users are occasionally driving Dorothy on: @@ -63,6 +64,15 @@ macOS: xcode-select --install ``` +Windows 10/11: + +```bash +# [Install WSL.](https://learn.microsoft.com/en-au/windows/wsl/install) +wsl --install +wsl --set-default-version 2 +# note that [wsl --version] does not report WSL2, you need to do [wsl -l -v] +``` + Ubuntu / Debian / Kali: ```bash diff --git a/commands/is-linux b/commands/is-linux index 242bd5176..6e52c41b4 100755 --- a/commands/is-linux +++ b/commands/is-linux @@ -20,6 +20,7 @@ function is_linux_test() ( function is_linux() ( source "$DOROTHY/sources/bash.bash" + # this will/should pass on WSL on Windows if test "$(uname -s)" = 'Linux'; then return 0 else diff --git a/commands/setup-util b/commands/setup-util index 4e0245d5c..88ac31632 100755 --- a/commands/setup-util +++ b/commands/setup-util @@ -3342,7 +3342,12 @@ function setup_util() ( # ensure it is executable, then open or run it chmod +x "$filepath" if test "$__open" = 'yes'; then - open "$filepath" + if is-wsl; then + setup-util-wslu --quiet + wslview "$filepath" + else + open "$filepath" + fi else # external installer script "$filepath" diff --git a/commands/setup-util-bat b/commands/setup-util-bat index 3137616e6..0bd0078f8 100755 --- a/commands/setup-util-bat +++ b/commands/setup-util-bat @@ -59,7 +59,7 @@ function setup_util_bat() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='*/bat' + DOWNLOAD_UNZIP_FILTER="*/$2" ) } function add_deb_option { @@ -70,25 +70,25 @@ function setup_util_bat() ( arch="$(get-arch)" if is-mac; then add_download_option '-x86_64-apple-darwin.tar.gz' - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option '-x86_64-pc-windows-msvc.zip' - elif test "$arch" = 'x32'; then - add_download_option '-i686-pc-windows-msvc.zip' - fi - else + elif is-linux; then if test "$arch" = 'a64'; then add_deb_option '_arm64.deb' - add_download_option '-aarch64-unknown-linux-gnu.tar.gz' + add_download_option '-aarch64-unknown-linux-gnu.tar.gz' 'bat' elif test "$arch" = 'a32'; then add_deb_option '_armhf.deb' - add_download_option '-arm-unknown-linux-musl.tar.gz' + add_download_option '-arm-unknown-linux-musl.tar.gz' 'bat' elif test "$arch" = 'x64'; then add_deb_option '_amd64.deb' - add_download_option '-x86_64-unknown-linux-musl.tar.gz' + add_download_option '-x86_64-unknown-linux-musl.tar.gz' 'bat' elif test "$arch" = 'x32'; then add_deb_option '_i686.deb' - add_download_option '-i686-unknown-linux-musl.tar.gz' + add_download_option '-i686-unknown-linux-musl.tar.gz' 'bat' + fi + elif is-wsl; then + if test "$arch" = 'x64'; then + add_download_option '-x86_64-pc-windows-msvc.zip' 'bat.exe' + elif test "$arch" = 'x32'; then + add_download_option '-i686-pc-windows-msvc.zip' 'bat.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-bottom b/commands/setup-util-bottom index ba196f079..e6cd6ede8 100755 --- a/commands/setup-util-bottom +++ b/commands/setup-util-bottom @@ -84,11 +84,7 @@ function setup_util_bottom() ( } if is-mac; then add_download_option '_x86_64-apple-darwin.tar.gz' - elif is-wsl; then - if test "$arch" = 'x64'; then - add_installer_option '_x86_64_installer.msi' - fi - else + elif is-linux; then if test "$arch" = 'a64'; then add_download_option '_aarch64-unknown-linux-gnu.tar.gz' elif test "$arch" = 'a32'; then @@ -101,6 +97,11 @@ function setup_util_bottom() ( add_download_option '_riscv64gc-unknown-linux-gnu.tar.gz' fi fi + # .msi failed with: This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package. + # elif is-wsl; then + # if test "$arch" = 'x64'; then + # add_installer_option '_x86_64_installer.msi' + # fi setup-util "${options[@]}" ) diff --git a/commands/setup-util-carapace b/commands/setup-util-carapace index 541650e82..7fc73fcd0 100755 --- a/commands/setup-util-carapace +++ b/commands/setup-util-carapace @@ -35,12 +35,11 @@ function setup_util_carapace() ( fi # setup + # couldn't get APT to work, APT_REPO was malformed local arch options=( --cli='carapace' "$@" AUR='carapace-bin' # ARCH - APT_REPO='deb [trusted=yes] https://apt.fury.io/rsteube/ /' - APT='carapace-bin' BREW_TAP='rsteube/homebrew-tap' BREW='rsteube/tap/carapace' NIX='carapace' @@ -64,16 +63,10 @@ function setup_util_carapace() ( --release='latest' \ --asset-filter="$(echo-escape-regex -- "$1")$" | echo-first-line || : } - function add_download_option { - options+=( - DOWNLOAD="$(get_github_asset_url "$@")" - DOWNLOAD_UNZIP_FILTER='carapace' - ) - } function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='gum' + DOWNLOAD_UNZIP_FILTER="$2" ) } function add_apk_option { @@ -98,30 +91,30 @@ function setup_util_carapace() ( elif test "$arch" = 'x64'; then add_download_option '_darwin_amd64.tar.gz' fi - elif is-wsl; then - if test "$arch" = 'a64'; then - add_download_option '_windows_arm64.zip' - elif test "$arch" = 'x64'; then - add_download_option '_windows_amd64.zip' - elif test "$arch" = 'x32'; then - add_download_option '_windows_386.zip' - fi - else + elif is-linux; then if test "$arch" = 'a64'; then add_apk_option '_linux_arm64.apk' add_deb_option '_linux_arm64.deb' add_rpm_option '_linux_arm64.rpm' - add_download_option '_linux_arm64.tar.gz' + add_download_option '_linux_arm64.tar.gz' 'carapace' elif test "$arch" = 'x64'; then add_apk_option '_linux_amd64.apk' add_deb_option '_linux_amd64.deb' add_rpm_option '_linux_amd64.rpm' - add_download_option '_linux_amd64.tar.gz' + add_download_option '_linux_amd64.tar.gz' 'carapace' elif test "$arch" = 'x32'; then add_apk_option '_linux_386.apk' add_deb_option '_linux_386.deb' add_rpm_option '_linux_386.rpm' - add_download_option '_linux_386.tar.gz' + add_download_option '_linux_386.tar.gz' 'carapace' + fi + elif is-wsl; then + if test "$arch" = 'a64'; then + add_download_option '_windows_arm64.zip' 'carapace.exe' + elif test "$arch" = 'x64'; then + add_download_option '_windows_amd64.zip' 'carapace.exe' + elif test "$arch" = 'x32'; then + add_download_option '_windows_386.zip' 'carapace.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-cronitor b/commands/setup-util-cronitor index e85f16504..c6cf9b0c5 100755 --- a/commands/setup-util-cronitor +++ b/commands/setup-util-cronitor @@ -31,27 +31,27 @@ function setup_util_cronitor() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='cronitor' + DOWNLOAD_UNZIP_FILTER="$2" ) } arch="$(get-arch)" if is-mac; then if test "$arch" = 'a64'; then - add_download_option 'darwin_arm64.tar.gz' + add_download_option 'darwin_arm64.tar.gz' 'cronitor' else - add_download_option 'darwin_amd64.tar.gz' + add_download_option 'darwin_amd64.tar.gz' 'cronitor' fi - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option 'windows_amd64.tar.gz' - fi - else + elif is-linux; then if test "$arch" = 'a64'; then - add_download_option 'linux_arm64.tar.gz' + add_download_option 'linux_arm64.tar.gz' 'cronitor' elif test "$arch" = 'a32'; then - add_download_option 'linux_arm.tar.gz' + add_download_option 'linux_arm.tar.gz' 'cronitor' elif test "$arch" = 'x64'; then - add_download_option 'linux_amd64.tar.gz' + add_download_option 'linux_amd64.tar.gz' 'cronitor' + fi + elif is-wsl; then + if test "$arch" = 'x64'; then + add_download_option 'windows_amd64.zip' 'cronitor.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-delta b/commands/setup-util-delta index 83a38a8c9..c076aa8a7 100755 --- a/commands/setup-util-delta +++ b/commands/setup-util-delta @@ -53,7 +53,7 @@ function setup_util_delta() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='*/delta' + DOWNLOAD_UNZIP_FILTER="*/$2" ) } function add_deb_option { @@ -64,27 +64,27 @@ function setup_util_delta() ( arch="$(get-arch)" if is-mac; then if test "$arch" = 'a64'; then - add_download_option '-aarch64-apple-darwin.tar.gz' + add_download_option '-aarch64-apple-darwin.tar.gz' 'delta' elif test "$arch" = 'x64'; then - add_download_option '-x86_64-apple-darwin.tar.gz' + add_download_option '-x86_64-apple-darwin.tar.gz' 'delta' fi - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option '-x86_64-pc-windows-msvc.zip' - fi - else + elif is-linux; then if test "$arch" = 'a64'; then add_deb_option '_arm64.deb' - add_download_option '-aarch64-unknown-linux-gnu.tar.gz' + add_download_option '-aarch64-unknown-linux-gnu.tar.gz' 'delta' elif test "$arch" = 'a32'; then add_deb_option '_armhf.deb' - add_download_option '-arm-unknown-linux-gnueabihf.tar.gz' + add_download_option '-arm-unknown-linux-gnueabihf.tar.gz' 'delta' elif test "$arch" = 'x64'; then add_deb_option '_amd64.deb' - add_download_option '-x86_64-unknown-linux-musl.tar.gz' + add_download_option '-x86_64-unknown-linux-musl.tar.gz' 'delta' elif test "$arch" = 'x32'; then add_deb_option '_i386.deb' - add_download_option '-i686-unknown-linux-gnu.tar.gz' + add_download_option '-i686-unknown-linux-gnu.tar.gz' 'delta' + fi + elif is-wsl; then + if test "$arch" = 'x64'; then + add_download_option '-x86_64-pc-windows-msvc.zip' 'delta.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-deno b/commands/setup-util-deno index 0706065e5..f9fd80c7f 100755 --- a/commands/setup-util-deno +++ b/commands/setup-util-deno @@ -50,25 +50,31 @@ function setup_util_deno() ( } function add_download_option { options+=( - DOWNLOAD="$(get_github_asset_url "$@")" - DOWNLOAD_UNZIP_FILTER='deno' + DOWNLOAD="$(get_github_asset_url "$1")" + DOWNLOAD_UNZIP_FILTER="$2" + ) + } + function add_download_option_arm { + options+=( + DOWNLOAD="$(get_github_asset_url "$1" 'LukeChannings/deno-arm64')" + DOWNLOAD_UNZIP_FILTER="$2" ) } if is-mac; then if test "$arch" = 'a64'; then - add_download_option 'deno-aarch64-apple-darwin.zip' + add_download_option 'deno-aarch64-apple-darwin.zip' 'deno' elif test "$arch" = 'x64'; then - add_download_option 'deno-x86_64-apple-darwin.zip' + add_download_option 'deno-x86_64-apple-darwin.zip' 'deno' fi - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option 'deno-x86_64-pc-windows-msvc.zip' - fi - else + elif is-linux; then if test "$arch" = 'a64'; then - add_download_option 'deno-linux-arm64.zip' 'LukeChannings/deno-arm64' + add_download_option_arm 'deno-linux-arm64.zip' 'deno' elif test "$arch" = 'x64'; then - add_download_option 'deno-x86_64-unknown-linux-gnu.zip' + add_download_option 'deno-x86_64-unknown-linux-gnu.zip' 'deno' + fi + elif is-wsl; then + if test "$arch" = 'x64'; then + add_download_option 'deno-x86_64-pc-windows-msvc.zip' 'deno.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-dust b/commands/setup-util-dust index e06f713d7..49e32ff9b 100755 --- a/commands/setup-util-dust +++ b/commands/setup-util-dust @@ -45,7 +45,7 @@ function setup_util_dust() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='*/dust' + DOWNLOAD_UNZIP_FILTER="*/$2" ) } function add_deb_option { @@ -54,24 +54,24 @@ function setup_util_dust() ( ) } if is-mac; then - add_download_option 'x86_64-apple-darwin.tar.gz' - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option '-x86_64-pc-windows-msvc.zip' - elif test "$arch" = 'x32'; then - add_download_option '-i686-pc-windows-msvc.zip' - fi - else + add_download_option 'x86_64-apple-darwin.tar.gz' 'dust' + elif is-linux; then if test "$arch" = 'a64'; then - add_download_option '-aarch64-unknown-linux-musl.tar.gz' + add_download_option '-aarch64-unknown-linux-musl.tar.gz' 'dust' elif test "$arch" = 'a32'; then - add_download_option '-arm-unknown-linux-musl.tar.gz' + add_download_option '-arm-unknown-linux-musl.tar.gz' 'dust' elif test "$arch" = 'x64'; then add_deb_option '_amd64.deb' - add_download_option '-x86_64-unknown-linux-musl.tar.gz' + add_download_option '-x86_64-unknown-linux-musl.tar.gz' 'dust' elif test "$arch" = 'x32'; then add_deb_option '_i386.deb' - add_download_option '-i686-unknown-linux-musl.tar.gz' + add_download_option '-i686-unknown-linux-musl.tar.gz' 'dust' + fi + elif is-wsl; then + if test "$arch" = 'x64'; then + add_download_option '-x86_64-pc-windows-msvc.zip' 'dust.exe' + elif test "$arch" = 'x32'; then + add_download_option '-i686-pc-windows-msvc.zip' 'dust.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-elvish b/commands/setup-util-elvish index 7c7a0abbe..2c569c6e7 100755 --- a/commands/setup-util-elvish +++ b/commands/setup-util-elvish @@ -2,6 +2,8 @@ # https://elv.sh/get/ +# https://github.com/elves/elvish/releases <-- just source + # https://repology.org/project/elvish/versions function setup_util_elvish() ( @@ -29,7 +31,7 @@ function setup_util_elvish() ( function add_download_option { local release url platform="$1" release="$(get-github-release elves/elvish)" # v0.19.2 - url="https://dl.elv.sh/$platform/elvish-$release.tar.gz" + url="https://dl.elv.sh/$platform/elvish-$release.$2" options+=( DOWNLOAD="$url" DOWNLOAD_UNZIP_FORMAT='auto' @@ -38,25 +40,26 @@ function setup_util_elvish() ( arch="$(get-arch)" if is-mac; then if test "$arch" = 'a64'; then - add_download_option 'darwin-arm64' + add_download_option 'darwin-arm64' 'tar.gz' elif test "$arch" = 'x64'; then - add_download_option 'darwin-amd64' - fi - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option 'windows-amd64' - elif test "$arch" = 'x32'; then - add_download_option 'windows-386' + add_download_option 'darwin-amd64' 'tar.gz' fi - else + elif is-linux; then if test "$arch" = 'a64'; then - add_download_option 'linux-arm64' + add_download_option 'linux-arm64' 'tar.gz' elif test "$arch" = 'x64'; then - add_download_option 'linux-amd64' + add_download_option 'linux-amd64' 'tar.gz' elif test "$arch" = 'x32'; then - add_download_option 'linux-386' + add_download_option 'linux-386' 'tar.gz' fi fi + # doesn't work on WSL: Cannot connect to daemon: failed to spawn daemon: fork/exec \\wsl.localhost\Ubuntu\home\balupton\.local\bin\elvish: Incorrect function. + # elif is-wsl; then + # if test "$arch" = 'x64'; then + # add_download_option 'windows-amd64' 'zip' + # elif test "$arch" = 'x32'; then + # add_download_option 'windows-386' 'zip' + # fi setup-util "${options[@]}" ) diff --git a/commands/setup-util-eza b/commands/setup-util-eza index a41bc5a68..7120ef6d5 100755 --- a/commands/setup-util-eza +++ b/commands/setup-util-eza @@ -4,9 +4,6 @@ # ls alternative # https://github.com/eza-community/eza/releases -# aarch64-unknown-linux-gnu-eza -# x86_64-pc-windows-gnu-eza.exe -# x86_64-unknown-linux-gnu-eza # https://repology.org/project/eza/versions @@ -41,19 +38,19 @@ function setup_util_eza() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='*/eza' + DOWNLOAD_UNZIP_FILTER="$2" ) } arch="$(get-arch)" - if is-wsl; then - if test "$arch" = 'x64'; then - add_download_option 'x86_64-pc-windows-gnu-eza.exe' - fi - else + if is-linux; then if test "$arch" = 'a64'; then - add_download_option 'aarch64-unknown-linux-gnu-eza' + add_download_option 'aarch64-unknown-linux-gnu.tar.gz' 'eza' elif test "$arch" = 'x64'; then - add_download_option 'x86_64-unknown-linux-gnu-eza' + add_download_option 'x86_64-unknown-linux-musl.tar.gz' 'eza' + fi + elif is-wsl; then + if test "$arch" = 'x64'; then + add_download_option 'x86_64-pc-windows-gnu.zip' 'eza.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-fd b/commands/setup-util-fd index 54ac76bc0..28312025f 100755 --- a/commands/setup-util-fd +++ b/commands/setup-util-fd @@ -63,7 +63,7 @@ function setup_util_fd() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='*/fd' + DOWNLOAD_UNZIP_FILTER="*/$2" ) } function add_deb_option { @@ -73,26 +73,26 @@ function setup_util_fd() ( } arch="$(get-arch)" if is-mac; then - add_download_option '-x86_64-apple-darwin.tar.gz' - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option '-x86_64-pc-windows-msvc.zip' - elif test "$arch" = 'x32'; then - add_download_option '-i686-pc-windows-msvc.zip' - fi - else + add_download_option '-x86_64-apple-darwin.tar.gz' 'fd' + elif is-linux; then if test "$arch" = 'a64'; then add_deb_option '_arm64.deb' - add_download_option '-aarch64-unknown-linux-gnu.tar.gz' + add_download_option '-aarch64-unknown-linux-gnu.tar.gz' 'fd' elif test "$arch" = 'a32'; then add_deb_option '_armhf.deb' - add_download_option '-arm-unknown-linux-musl.tar.gz' + add_download_option '-arm-unknown-linux-musl.tar.gz' 'fd' elif test "$arch" = 'x64'; then add_deb_option '_amd64.deb' - add_download_option '-x86_64-unknown-linux-musl.tar.gz' + add_download_option '-x86_64-unknown-linux-musl.tar.gz' 'fd' elif test "$arch" = 'x32'; then add_deb_option '_i686.deb' - add_download_option '-i686-unknown-linux-musl.tar.gz' + add_download_option '-i686-unknown-linux-musl.tar.gz' 'fd' + fi + elif is-wsl; then + if test "$arch" = 'x64'; then + add_download_option '-x86_64-pc-windows-msvc.zip' 'fd.exe' + elif test "$arch" = 'x32'; then + add_download_option '-i686-pc-windows-msvc.zip' 'fd.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-fzf b/commands/setup-util-fzf index 509bc782e..55ee204a9 100755 --- a/commands/setup-util-fzf +++ b/commands/setup-util-fzf @@ -67,6 +67,12 @@ function setup_util_fzf() ( DOWNLOAD_UNZIP_FILTER='fzf' ) } + function add_download_option_windows { + options+=( + DOWNLOAD="$(get_github_asset_url "$1")" + DOWNLOAD_UNZIP_FORMAT='zip' + ) + } arch="$(get-arch)" if is-mac; then if test "$arch" = 'x64'; then @@ -74,21 +80,21 @@ function setup_util_fzf() ( elif test "$arch" = 'a64'; then add_download_option '-darwin_arm64.zip' fi - elif is-wsl; then + elif is-linux; then if test "$arch" = 'x64'; then - add_download_option '-windows_amd64.zip' + add_download_option '-linux_amd64.tar.gz' elif test "$arch" = 'a64'; then - add_download_option '-windows_arm64.zip' + add_download_option '-linux_arm64.tar.gz' elif test "$arch" = 'a32'; then - add_download_option '-windows_armv7.zip' + add_download_option '-linux_armv7.tar.gz' fi - else + elif is-wsl; then if test "$arch" = 'x64'; then - add_download_option '-linux_amd64.tar.gz' + add_download_option_windows '-windows_amd64.zip' elif test "$arch" = 'a64'; then - add_download_option '-linux_arm64.tar.gz' + add_download_option_windows '-windows_arm64.zip' elif test "$arch" = 'a32'; then - add_download_option '-linux_armv7.tar.gz' + add_download_option_windows '-windows_armv7.zip' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-gh b/commands/setup-util-gh index 3b3672331..b0c8a6366 100755 --- a/commands/setup-util-gh +++ b/commands/setup-util-gh @@ -60,11 +60,11 @@ function setup_util_gh() ( --release='latest' \ --asset-filter="$(echo-escape-regex -- "$1")$" | echo-first-line || : } - function add_download_option { - options+=( - DOWNLOAD="$(get_github_asset_url "$1")" - ) - } + # function add_download_option { + # options+=( + # DOWNLOAD="$(get_github_asset_url "$1")" + # ) + # } function add_deb_option { options+=( DEB="$(get_github_asset_url "$1")" @@ -82,41 +82,46 @@ function setup_util_gh() ( ) } arch="$(get-arch)" - if is-mac; then - if test "$arch" = 'a64'; then - add_download_option '_macOS_arm64.zip' - elif test "$arch" = 'x64'; then - add_download_option '_macOS_amd64.zip' - fi - elif is-wsl; then - if test "$arch" = 'a64'; then - add_download_option '_windows_arm64.zip' - elif test "$arch" = 'x64'; then - add_download_option '_windows_amd64.zip' - add_installer_option '_windows_amd64.msi' - elif test "$arch" = 'x32'; then - add_download_option '_windows_386.zip' - add_installer_option '_windows_386.msi' - fi - else + # download method error: linux-wsl, and windows-wsl fail with: bash: /home/balupton/.local/bin/gh: cannot execute binary file: Exec format error + # disabling macos download method as well just in case + # + # if is-mac; then + # if test "$arch" = 'a64'; then + # add_download_option '_macOS_arm64.zip' + # elif test "$arch" = 'x64'; then + # add_download_option '_macOS_amd64.zip' + # fi + # el + if is-linux; then if test "$arch" = 'a64'; then add_deb_option '_linux_arm64.deb' add_rpm_option '_linux_arm64.rpm' - add_download_option '_linux_arm64.tar.gz' + # add_download_option '_linux_arm64.tar.gz' elif test "$arch" = 'a32'; then add_deb_option '_linux_armv6.deb' add_rpm_option '_linux_armv6.rpm' - add_download_option '_linux_armv6.tar.gz' + # add_download_option '_linux_armv6.tar.gz' elif test "$arch" = 'x64'; then add_deb_option '_linux_amd64.deb' add_rpm_option '_linux_amd64.rpm' - add_download_option '_linux_amd64.tar.gz' + # add_download_option '_linux_amd64.tar.gz' elif test "$arch" = 'x32'; then add_deb_option '_linux_386.deb' add_rpm_option '_linux_386.rpm' - add_download_option '_linux_386.tar.gz' + # add_download_option '_linux_386.tar.gz' fi fi + # bash: /home/balupton/.local/bin/gh: cannot execute binary file: Exec format error + # elif is-wsl; then + # if test "$arch" = 'a64'; then + # add_download_option '_windows_arm64.zip' + # elif test "$arch" = 'x64'; then + # add_download_option '_windows_amd64.zip' + # add_installer_option '_windows_amd64.msi' + # elif test "$arch" = 'x32'; then + # add_download_option '_windows_386.zip' + # add_installer_option '_windows_386.msi' + # fi setup-util "${options[@]}" ) diff --git a/commands/setup-util-go b/commands/setup-util-go index be8101251..55b30cb69 100755 --- a/commands/setup-util-go +++ b/commands/setup-util-go @@ -5,12 +5,6 @@ function setup_util_go() ( source "$DOROTHY/sources/bash.bash" - # if is-wsl; then - # echo-style --notice="If golang fails to install, install choco first or install go manually:" $'\n' \ - # --code=' https://chocolatey.org/install#individual' $'\n' \ - # --code=' https://go.dev/dl/' > /dev/stderr - # fi - # improve performance if is-needle --quiet "$@" && ! is-needle --upgrade "$@" && ! is-needle --uninstall "$@" && command-exists go; then return 0 @@ -32,6 +26,13 @@ function setup_util_go() ( BREW='go' ) setup-util "${options[@]}" + + # not needed, installed fine via apt on wsl + # if is-wsl; then + # echo-style --notice="If golang fails to install, install choco first or install go manually:" $'\n' \ + # --code=' https://chocolatey.org/install#individual' $'\n' \ + # --code=' https://go.dev/dl/' > /dev/stderr + # fi ) # fire if invoked standalone diff --git a/commands/setup-util-got b/commands/setup-util-got index e4bcbdbfc..d70ebf62c 100755 --- a/commands/setup-util-got +++ b/commands/setup-util-got @@ -48,7 +48,7 @@ function setup_util_got() ( elif test "$arch" = 'x64'; then add_download_option '_Darwin_amd64.tar.gz' fi - else + elif is-linux; then if test "$arch" = 'x64'; then add_download_option '_Linux_amd64.tar.gz' elif test "$arch" = 'x32'; then diff --git a/commands/setup-util-grex b/commands/setup-util-grex index 980006730..3619c6652 100755 --- a/commands/setup-util-grex +++ b/commands/setup-util-grex @@ -36,23 +36,23 @@ function setup_util_grex() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='grex' + DOWNLOAD_UNZIP_FILTER="$2" ) } arch="$(get-arch)" if is-mac; then if test "$arch" = 'a64'; then - add_download_option '-aarch64-apple-darwin.tar.gz' + add_download_option '-aarch64-apple-darwin.tar.gz' 'grex' elif test "$arch" = 'x64'; then - add_download_option '-x86_64-apple-darwin.tar.gz' + add_download_option '-x86_64-apple-darwin.tar.gz' 'grex' fi - elif is-wsl; then + elif is-linux; then if test "$arch" = 'x64'; then - add_download_option '-x86_64-pc-windows-msvc.zip' + add_download_option '-x86_64-unknown-linux-musl.tar.gz' 'grex' fi - else + elif is-wsl; then if test "$arch" = 'x64'; then - add_download_option '-x86_64-unknown-linux-musl.tar.gz' + add_download_option '-x86_64-pc-windows-msvc.zip' 'grex.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-gum b/commands/setup-util-gum index 00a4a319b..cd7bee795 100755 --- a/commands/setup-util-gum +++ b/commands/setup-util-gum @@ -81,7 +81,7 @@ function setup_util_gum() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='gum' + DOWNLOAD_UNZIP_FILTER="$2" ) } function add_apk_option { @@ -102,37 +102,37 @@ function setup_util_gum() ( arch="$(get-arch)" if is-mac; then if test "$arch" = 'a64'; then - add_download_option '_Darwin_arm64.tar.gz' + add_download_option '_Darwin_arm64.tar.gz' 'gum' elif test "$arch" = 'x64'; then - add_download_option '_Darwin_x86_64.tar.gz' + add_download_option '_Darwin_x86_64.tar.gz' 'gum' fi - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option '_Windows_x86_64.zip' - elif test "$arch" = 'x32'; then - add_download_option '_Windows_i386.zip' - fi - else + elif is-linux; then if test "$arch" = 'a64'; then add_apk_option '_aarch64.apk' add_deb_option '_arm64.deb' add_rpm_option '.aarch64.rpm' - add_download_option '_Linux_arm64.tar.gz' + add_download_option '_Linux_arm64.tar.gz' 'gum' elif test "$arch" = 'a32'; then add_apk_option '_armv7.apk' add_deb_option '_armhf.deb' add_rpm_option '.armv7hl.rpm' - add_download_option '_Linux_arm.tar.gz' + add_download_option '_Linux_arm.tar.gz' 'gum' elif test "$arch" = 'x64'; then add_apk_option '_x86_64.apk' add_deb_option '_amd64.deb' add_rpm_option '.x86_64.rpm' - add_download_option '_Linux_x86_64.tar.gz' + add_download_option '_Linux_x86_64.tar.gz' 'gum' elif test "$arch" = 'x32'; then add_apk_option '_x86.apk' add_deb_option '_i386.deb' add_rpm_option '.i386.rpm' - add_download_option '_Linux_i386.tar.gz' + add_download_option '_Linux_i386.tar.gz' 'gum' + fi + elif is-wsl; then + if test "$arch" = 'x64'; then + add_download_option '_Windows_x86_64.zip' 'gum.exe' + elif test "$arch" = 'x32'; then + add_download_option '_Windows_i386.zip' 'gum.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-hyperfine b/commands/setup-util-hyperfine index 5342d39a9..81dda6849 100755 --- a/commands/setup-util-hyperfine +++ b/commands/setup-util-hyperfine @@ -60,7 +60,7 @@ function setup_util_hyperfine() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='*/hyperfine' + DOWNLOAD_UNZIP_FILTER="*/$2" ) } function add_deb_option { @@ -70,26 +70,26 @@ function setup_util_hyperfine() ( } arch="$(get-arch)" if is-mac; then - add_download_option '-x86_64-apple-darwin.tar.gz' - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option '-x86_64-pc-windows-msvc.zip' - elif test "$arch" = 'x32'; then - add_download_option '-i686-pc-windows-msvc.zip' - fi - else + add_download_option '-x86_64-apple-darwin.tar.gz' 'hyperfine' + elif is-linux; then if test "$arch" = 'a64'; then add_deb_option '_arm64.deb' - add_download_option '-aarch64-unknown-linux-gnu.tar.gz' + add_download_option '-aarch64-unknown-linux-gnu.tar.gz' 'hyperfine' elif test "$arch" = 'a32'; then add_deb_option '_armhf.deb' - add_download_option '-arm-unknown-linux-musl.tar.gz' + add_download_option '-arm-unknown-linux-musl.tar.gz' 'hyperfine' elif test "$arch" = 'x64'; then add_deb_option '_amd64.deb' - add_download_option '-x86_64-unknown-linux-musl.tar.gz' + add_download_option '-x86_64-unknown-linux-musl.tar.gz' 'hyperfine' elif test "$arch" = 'x32'; then add_deb_option '_i686.deb' - add_download_option '-i686-unknown-linux-musl.tar.gz' + add_download_option '-i686-unknown-linux-musl.tar.gz' 'hyperfine' + fi + elif is-wsl; then + if test "$arch" = 'x64'; then + add_download_option '-x86_64-pc-windows-msvc.zip' 'hyperfine.exe' + elif test "$arch" = 'x32'; then + add_download_option '-i686-pc-windows-msvc.zip' 'hyperfine.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-jq b/commands/setup-util-jq index 93455789a..d8be0df4e 100755 --- a/commands/setup-util-jq +++ b/commands/setup-util-jq @@ -79,13 +79,7 @@ function setup_util_jq() ( elif test "$arch" = 'x64'; then add_download_option '-macos-amd64' fi - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option '-windows-amd64.exe' - elif test "$arch" = 'x32'; then - add_download_option '-windows-i386.exe' - fi - else + elif is-linux; then if test "$arch" = 'r64'; then add_download_option '-linux-riscv64' elif test "$arch" = 'a64'; then @@ -98,6 +92,13 @@ function setup_util_jq() ( add_download_option '-linux-i386' fi fi + # it runs fine, however it handles encodings/line-endings incorrectly causing bad parsing outputs + # elif is-wsl; then + # if test "$arch" = 'x64'; then + # add_download_option '-windows-amd64.exe' + # elif test "$arch" = 'x32'; then + # add_download_option '-windows-i386.exe' + # fi setup-util "${options[@]}" ) diff --git a/commands/setup-util-micro b/commands/setup-util-micro index a95c5fa42..719f207eb 100755 --- a/commands/setup-util-micro +++ b/commands/setup-util-micro @@ -55,12 +55,12 @@ function setup_util_micro() ( --dry \ --slug='zyedidia/micro' \ --release='latest' \ - --asset-filter="$(echo-escape-regex -- "$1")$" | echo-first-line || : + --asset-filter="$(echo-escape-regex -- "$1")" | echo-first-line || : } function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='*/micro' + DOWNLOAD_UNZIP_FILTER="*/$2" ) } function add_deb_option { @@ -70,23 +70,23 @@ function setup_util_micro() ( } arch="$(get-arch)" if is-mac; then - add_download_option '-osx.tar.gz' - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option '-win64.zip' - elif test "$arch" = 'x32'; then - add_download_option '-win32.zip' - fi - else + add_download_option '-osx.tar.gz' 'micro' + elif is-linux; then if test "$arch" = 'a64'; then - add_download_option '-linux-arm64.tar.gz' + add_download_option '-linux-arm64.tar.gz' 'micro' elif test "$arch" = 'a32'; then - add_download_option '-linux-arm.tar.gz' + add_download_option '-linux-arm.tar.gz' 'micro' elif test "$arch" = 'x64'; then add_deb_option '-amd64.deb' - add_download_option '-linux64.tar.gz' + add_download_option '-linux64.tar.gz' 'micro' + elif test "$arch" = 'x32'; then + add_download_option '-linux32.tar.gz' 'micro' + fi + elif is-wsl; then + if test "$arch" = 'x64'; then + add_download_option '-win64.zip' 'micro.exe' elif test "$arch" = 'x32'; then - add_download_option '-linux32.tar.gz' + add_download_option '-win32.zip' 'micro.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-neovim b/commands/setup-util-neovim index 8c58d6e33..2dc2f5d37 100755 --- a/commands/setup-util-neovim +++ b/commands/setup-util-neovim @@ -60,13 +60,16 @@ function setup_util_neovim() ( ) } arch="$(get-arch)" - if is-wsl; then - if test "$arch" = 'x64'; then - add_installer_option '-win64.msi' - fi - elif is-appimage; then + + if is-appimage; then add_download_appimage_option '.appimage' fi + # .msi failed with: This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package. + # elif is-wsl; then + # if test "$arch" = 'x64'; then + # add_installer_option '-win64.msi' + # fi + # fi setup-util "${options[@]}" # all extras should be optional and below diff --git a/commands/setup-util-nu b/commands/setup-util-nu index 4b8ad1f8f..c7256a329 100755 --- a/commands/setup-util-nu +++ b/commands/setup-util-nu @@ -94,7 +94,7 @@ function setup_util_nu() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='*/nu' + DOWNLOAD_UNZIP_FILTER="$2" ) } function add_installer_option { @@ -106,28 +106,29 @@ function setup_util_nu() ( arch="$(get-arch)" if is-mac; then if test "$arch" = 'a64'; then - add_download_option '-aarch64-apple-darwin.tar.gz' + add_download_option '-aarch64-apple-darwin.tar.gz' '*/nu' else - add_download_option '-x86_64-apple-darwin.tar.gz' + add_download_option '-x86_64-apple-darwin.tar.gz' '*/nu' fi - elif is-wsl; then - if test "$arch" = 'a64'; then - add_download_option '-aarch64-pc-windows-msvc.zip' - add_installer_option '-aarch64-pc-windows-msvc.msi' - elif test "$arch" = 'x64'; then - add_download_option '-x86_64-pc-windows-msvc.zip' - add_installer_option '-x86_64-pc-windows-msvc.msi' - fi - else + elif is-linux; then # includes wsl if test "$arch" = 'r64'; then - add_download_option '-riscv64gc-unknown-linux-gnu.tar.gz' + add_download_option '-riscv64gc-unknown-linux-gnu.tar.gz' '*/nu' elif test "$arch" = 'a64'; then - add_download_option '-aarch64-unknown-linux-gnu.tar.gz' + add_download_option '-aarch64-unknown-linux-gnu.tar.gz' '*/nu' elif test "$arch" = 'a32'; then - add_download_option '-armv7-unknown-linux-gnueabihf.tar.gz' + add_download_option '-armv7-unknown-linux-gnueabihf.tar.gz' '*/nu' + elif test "$arch" = 'x64'; then + # add_download_option '-x86_64-unknown-linux-gnu.tar.gz' '*/nu' + add_download_option '-x86_64-unknown-linux-musl.tar.gz' '*/nu' + fi + elif is-wsl; then + # .msi failed with: This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package. + if test "$arch" = 'a64'; then + add_download_option '-aarch64-pc-windows-msvc.zip' 'nu.exe' # uses windows config, rather than wsl config + # add_installer_option '-aarch64-pc-windows-msvc.msi' elif test "$arch" = 'x64'; then - # add_download_option '-x86_64-unknown-linux-gnu.tar.gz' - add_download_option '-x86_64-unknown-linux-musl.tar.gz' + add_download_option '-x86_64-pc-windows-msvc.zip' 'nu.exe' # uses windows config, rather than wsl config + # add_installer_option '-x86_64-pc-windows-msvc.msi' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-obs b/commands/setup-util-obs index ceebb918b..3fdbd944a 100755 --- a/commands/setup-util-obs +++ b/commands/setup-util-obs @@ -42,7 +42,7 @@ function setup_util_obs() ( function add_installer_option { options+=( INSTALLER="$(get_github_asset_url "$1")" - INsTALLER_OPEN=yes + INSTALLER_OPEN=yes ) } function add_deb_option { @@ -57,11 +57,19 @@ function setup_util_obs() ( elif test "$arch" = 'x64'; then add_download_app_option '-macos-x86_64.dmg' fi - elif is-wsl; then - add_installer_option '-Full-Installer-x64.exe' elif is-ubuntu && test "$arch" = 'x64'; then add_deb_option ".$(get-ubuntu-release-name)_amd64.deb" fi + # .exe failed with: + # Start : This command cannot be run due to the error: Incorrect function. + # At line:1 char:128 + # + ... oding(850); Start "\\wsl.localhost\Ubuntu\home\balupton\.cache\doroth ... + # + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # + CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException + # + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand + # + # elif is-wsl; then + # add_installer_option '-Full-Installer-x64.exe' setup-util "${options[@]}" ) diff --git a/commands/setup-util-procs b/commands/setup-util-procs index 8047c82b6..7c7280cdd 100755 --- a/commands/setup-util-procs +++ b/commands/setup-util-procs @@ -43,7 +43,7 @@ function setup_util_procs() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='procs' + DOWNLOAD_UNZIP_FILTER="$2" ) } function add_rpm_option { @@ -53,15 +53,15 @@ function setup_util_procs() ( } arch="$(get-arch)" if is-mac; then - add_download_option '-x86_64-mac.zip' - elif is-wsl; then + add_download_option '-x86_64-mac.zip' 'procs' + elif is-linux; then if test "$arch" = 'x64'; then - add_download_option '-x86_64-windows.zip' + add_rpm_option '.x86_64.rpm' + add_download_option '-x86_64-linux.zip' 'procs' fi - else + elif is-wsl; then if test "$arch" = 'x64'; then - add_rpm_option '.x86_64.rpm' - add_download_option '-x86_64-linux.zip' + add_download_option '-x86_64-windows.zip' 'procs.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-ripgrep b/commands/setup-util-ripgrep index aee4dfde8..a67b2e816 100755 --- a/commands/setup-util-ripgrep +++ b/commands/setup-util-ripgrep @@ -63,33 +63,33 @@ function setup_util_ripgrep() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='rg' + DOWNLOAD_UNZIP_FILTER="$2" ) } arch="$(get-arch)" if is-mac; then if test "$arch" = 'a64'; then - add_download_option '-aarch64-apple-darwin.tar.gz' + add_download_option '-aarch64-apple-darwin.tar.gz' 'rg' elif test "$arch" = 'x64'; then - add_download_option '-x86_64-apple-darwin.tar.gz' + add_download_option '-x86_64-apple-darwin.tar.gz' 'rg' fi - elif is-wsl; then + elif is-linux; then if test "$arch" = 'a64'; then - add_download_option '-aarch64-pc-windows-msvc.zip' + add_download_option '-aarch64-unknown-linux-musl.tar.gz' 'rg' + elif test "$arch" = 'a32'; then + add_download_option '-arm-unknown-linux-gnueabihf.tar.gz' 'rg' elif test "$arch" = 'x64'; then - add_download_option '-x86_64-pc-windows-msvc.zip' + add_download_option '-x86_64-unknown-linux-musl.tar.gz' 'rg' elif test "$arch" = 'x32'; then - add_download_option '-i686-pc-windows-msvc.zip' + add_download_option '-i686-unknown-linux-musl.tar.gz' 'rg' fi - else + elif is-wsl; then if test "$arch" = 'a64'; then - add_download_option '-aarch64-unknown-linux-musl.tar.gz' - elif test "$arch" = 'a32'; then - add_download_option '-arm-unknown-linux-gnueabihf.tar.gz' + add_download_option '-aarch64-pc-windows-msvc.zip' 'rg.exe' elif test "$arch" = 'x64'; then - add_download_option '-x86_64-unknown-linux-musl.tar.gz' + add_download_option '-x86_64-pc-windows-msvc.zip' 'rg.exe' elif test "$arch" = 'x32'; then - add_download_option '-i686-unknown-linux-musl.tar.gz' + add_download_option '-i686-pc-windows-msvc.zip' 'rg.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-shfmt b/commands/setup-util-shfmt index b782b7b98..939530e38 100755 --- a/commands/setup-util-shfmt +++ b/commands/setup-util-shfmt @@ -58,13 +58,7 @@ function setup_util_shfmt() ( elif test "$arch" = 'x64'; then add_download_option '_darwin_amd64' fi - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option '_windows_amd64.exe' - elif test "$arch" = 'x32'; then - add_download_option '_windows_386.exe' - fi - else + elif is-linux; then if test "$arch" = 'a64'; then add_download_option '_linux_arm64' elif test "$arch" = 'a32'; then @@ -74,6 +68,12 @@ function setup_util_shfmt() ( elif test "$arch" = 'x32'; then add_download_option '_linux_386' fi + elif is-wsl; then + if test "$arch" = 'x64'; then + add_download_option '_windows_amd64.exe' + elif test "$arch" = 'x32'; then + add_download_option '_windows_386.exe' + fi fi setup-util "${options[@]}" ) diff --git a/commands/setup-util-starship b/commands/setup-util-starship index 14bf0687e..b4d6725bb 100755 --- a/commands/setup-util-starship +++ b/commands/setup-util-starship @@ -46,7 +46,7 @@ function setup_util_starship() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='starship' + DOWNLOAD_UNZIP_FILTER="$2" ) } function add_installer_option { @@ -58,29 +58,30 @@ function setup_util_starship() ( arch="$(get-arch)" if is-mac; then if test "$arch" = 'a64'; then - add_download_option '-aarch64-apple-darwin.tar.gz' + add_download_option '-aarch64-apple-darwin.tar.gz' 'starship' elif test "$arch" = 'x64'; then - add_download_option '-x86_64-apple-darwin.tar.gz' + add_download_option '-x86_64-apple-darwin.tar.gz' 'starship' fi - elif is-wsl; then + elif is-linux; then if test "$arch" = 'a64'; then - add_download_option '-aarch64-pc-windows-msvc.zip' + add_download_option '-aarch64-unknown-linux-musl.tar.gz' 'starship' + elif test "$arch" = 'a32'; then + add_download_option '-arm-unknown-linux-musl.tar.gz' 'starship' elif test "$arch" = 'x64'; then - add_download_option '-x86_64-pc-windows-msvc.zip' - add_installer_option '-x86_64-pc-windows-msvc.msi' + add_download_option '-x86_64-unknown-linux-musl.tar.gz' 'starship' elif test "$arch" = 'x32'; then - add_download_option '-i686-pc-windows-msvc.zip' - add_installer_option '-i686-pc-windows-msvc.msi' + add_download_option '-i686-unknown-linux-musl.tar.gz' 'starship' fi - else + elif is-wsl; then + # .msi failed with: This installation package could not be opened. Contact the application vendor to verify that this is a valid Windows Installer package. if test "$arch" = 'a64'; then - add_download_option '-aarch64-unknown-linux-musl.tar.gz' - elif test "$arch" = 'a32'; then - add_download_option '-arm-unknown-linux-musl.tar.gz' + add_download_option '-aarch64-pc-windows-msvc.zip' 'starship.exe' elif test "$arch" = 'x64'; then - add_download_option '-x86_64-unknown-linux-musl.tar.gz' + add_download_option '-x86_64-pc-windows-msvc.zip' 'starship.exe' + # add_installer_option '-x86_64-pc-windows-msvc.msi' elif test "$arch" = 'x32'; then - add_download_option '-i686-unknown-linux-musl.tar.gz' + add_download_option '-i686-pc-windows-msvc.zip' 'starship.exe' + # add_installer_option '-i686-pc-windows-msvc.msi' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-strongbox b/commands/setup-util-strongbox index 47c9037d9..6fc3ddb43 100755 --- a/commands/setup-util-strongbox +++ b/commands/setup-util-strongbox @@ -53,17 +53,7 @@ function setup_util_strongbox() ( elif test "$arch" = 'x64'; then add_download_option '_darwin_amd64' fi - elif is-wsl; then - if test "$arch" = 'a64'; then - add_download_option '_windows_arm64.exe' - elif test "$arch" = 'a32'; then - add_download_option '_windows_armv6.exe' - elif test "$arch" = 'x64'; then - add_download_option '_windows_amd64.exe' - elif test "$arch" = 'x32'; then - add_download_option '_windows_386.exe' - fi - else + elif is-linux; then if test "$arch" = 'a64'; then add_download_option '_linux_arm64' elif test "$arch" = 'a32'; then @@ -74,6 +64,17 @@ function setup_util_strongbox() ( add_download_option '_linux_386' fi fi + # .exe fails with: https://github.com/uw-labs/strongbox/issues/77 + # elif is-wsl; then + # if test "$arch" = 'a64'; then + # add_download_option '_windows_arm64.exe' + # elif test "$arch" = 'a32'; then + # add_download_option '_windows_armv6.exe' + # elif test "$arch" = 'x64'; then + # add_download_option '_windows_amd64.exe' + # elif test "$arch" = 'x32'; then + # add_download_option '_windows_386.exe' + # fi setup-util "${options[@]}" # if installed, configure diff --git a/commands/setup-util-syncthing b/commands/setup-util-syncthing index 73ee411fa..baeaba063 100755 --- a/commands/setup-util-syncthing +++ b/commands/setup-util-syncthing @@ -102,49 +102,51 @@ function setup_util_syncthing() ( XBPS='syncthing' # VOID ZYPPER='syncthing' # SUSE ) - function get_github_asset_url { - github-download \ - --dry \ - --slug='syncthing/syncthing' \ - --release='latest' \ - --asset-filter="$(echo-escape-regex -- "$1")" | echo-first-line || : - } - function add_download_option { - options+=( - DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='syncthing' - ) - } - arch="$(get-arch)" - if is-mac; then - if test "$arch" = 'a64'; then - add_download_option '-macos-arm64-' - else - add_download_option '-macos-amd64-' - fi - elif is-wsl; then - if test "$arch" = 'a64'; then - add_download_option '-windows-arm64-' - elif test "$arch" = 'a32'; then - add_download_option '-windows-arm-' - elif test "$arch" = 'x64'; then - add_download_option '-windows-amd64-' - elif test "$arch" = 'x32'; then - add_download_option '-windows-386-' - fi - else - if test "$arch" = 'a64'; then - add_download_option '-linux-arm64-' - elif test "$arch" = 'a32'; then - add_download_option '-linux-arm-' - elif test "$arch" = 'x64'; then - add_download_option '-linux-amd64-' - elif test "$arch" = 'x32'; then - add_download_option '-linux-386-' - elif test "$arch" = 'r64'; then - add_download_option '-linux-riscv64-' - fi - fi + # @todo: installing via download requires installing the service, and I currently don't know how to do that + # + # function get_github_asset_url { + # github-download \ + # --dry \ + # --slug='syncthing/syncthing' \ + # --release='latest' \ + # --asset-filter="$(echo-escape-regex -- "$1")" | echo-first-line || : + # } + # function add_download_option { + # options+=( + # DOWNLOAD="$(get_github_asset_url "$1")" + # DOWNLOAD_UNZIP_FILTER="$2" + # ) + # } + # arch="$(get-arch)" + # if is-mac; then + # if test "$arch" = 'a64'; then + # add_download_option '-macos-arm64-' 'syncthing' + # else + # add_download_option '-macos-amd64-' 'syncthing' + # fi + # elif is-wsl; then + # if test "$arch" = 'a64'; then + # add_download_option '-windows-arm64-' '*/syncthing.exe' + # elif test "$arch" = 'a32'; then + # add_download_option '-windows-arm-' '*/syncthing.exe' + # elif test "$arch" = 'x64'; then + # add_download_option '-windows-amd64-' '*/syncthing.exe' + # elif test "$arch" = 'x32'; then + # add_download_option '-windows-386-' '*/syncthing.exe' + # fi + # else + # if test "$arch" = 'a64'; then + # add_download_option '-linux-arm64-' 'syncthing' + # elif test "$arch" = 'a32'; then + # add_download_option '-linux-arm-' 'syncthing' + # elif test "$arch" = 'x64'; then + # add_download_option '-linux-amd64-' 'syncthing' + # elif test "$arch" = 'x32'; then + # add_download_option '-linux-386-' 'syncthing' + # elif test "$arch" = 'r64'; then + # add_download_option '-linux-riscv64-' 'syncthing' + # fi + # fi setup-util "${options[@]}" # if missing, complete uninstall and exit @@ -154,7 +156,7 @@ function setup_util_syncthing() ( -- "${service_ids[@]}" # remove paths - fs-rm --sudo --confirm --optional \ + fs-rm --sudo --confirm \ -- "${service_uninstall_paths[@]}" # all done for uninstall diff --git a/commands/setup-util-tea b/commands/setup-util-tea index 67fba98f9..c826ca17d 100755 --- a/commands/setup-util-tea +++ b/commands/setup-util-tea @@ -50,7 +50,7 @@ function setup_util_tea() ( elif test "$arch" = 'x64'; then add_download_option '+darwin+x86-64' fi - else + elif is-linux; then if test "$arch" = 'a64'; then add_download_option '+linux+aarch64' elif test "$arch" = 'x64'; then diff --git a/commands/setup-util-tealdeer b/commands/setup-util-tealdeer index 649ea58ee..914e91f40 100755 --- a/commands/setup-util-tealdeer +++ b/commands/setup-util-tealdeer @@ -57,11 +57,7 @@ function setup_util_tealdeer() ( arch="$(get-arch)" if is-mac; then add_download_option '-macos-x86_64' - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option '-windows-x86_64-msvc.exe' - fi - else + elif is-linux; then if test "$arch" = 'x64'; then add_download_option '-linux-x86_64-musl' elif test "$arch" = 'x32'; then @@ -71,12 +67,16 @@ function setup_util_tealdeer() ( elif test "$arch" = 'a32'; then add_download_option '-linux-armv7-musleabihf' fi + elif is-wsl; then + if test "$arch" = 'x64'; then + add_download_option '-windows-x86_64-msvc.exe' # uses windows config, rather than wsl config + fi fi setup-util "${options[@]}" # if installed, configure if command-exists tldr; then - tldr --update + eval-helper --wrap -- tldr --update # hangs forever on wsl fi ) diff --git a/commands/setup-util-teip b/commands/setup-util-teip index 42433ec44..0d92aa250 100755 --- a/commands/setup-util-teip +++ b/commands/setup-util-teip @@ -67,7 +67,7 @@ function setup_util_teip() ( elif test "$arch" = 'x64'; then add_download_option '.x86_64-apple-darwin.tar.gz' fi - else + elif is-linux; then if test "$arch" = 'a64'; then add_rpm_option '.aarch64-unknown-linux-musl.rpm' add_deb_option '.aarch64-unknown-linux-musl.deb' diff --git a/commands/setup-util-tokei b/commands/setup-util-tokei index 7249b68cb..568371e41 100755 --- a/commands/setup-util-tokei +++ b/commands/setup-util-tokei @@ -62,32 +62,27 @@ function setup_util_tokei() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" + DOWNLOAD_UNZIP_FILTER="$2" ) - # on windows, it is .exe instead of an archive - if ! is-wsl; then - options+=( - DOWNLOAD_UNZIP_FILTER='tokei' - ) - fi } arch="$(get-arch)" if is-mac; then - add_download_option '-x86_64-apple-darwin.tar.gz' - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option '-x86_64-pc-windows-msvc.exe' - elif test "$arch" = 'x32'; then - add_download_option '-i686-pc-windows-msvc.exe' - fi - else + add_download_option '-x86_64-apple-darwin.tar.gz' 'tokei' + elif is-linux; then if test "$arch" = 'a64'; then - add_download_option '-aarch64-unknown-linux-gnu.tar.gz' + add_download_option '-aarch64-unknown-linux-gnu.tar.gz' 'tokei' elif test "$arch" = 'a32'; then - add_download_option '-arm-unknown-linux-gnueabi.tar.gz' + add_download_option '-arm-unknown-linux-gnueabi.tar.gz' 'tokei' elif test "$arch" = 'x64'; then - add_download_option '-x86_64-unknown-linux-musl.tar.gz' + add_download_option '-x86_64-unknown-linux-musl.tar.gz' 'tokei' + elif test "$arch" = 'x32'; then + add_download_option '-i686-unknown-linux-musl.tar.gz' 'tokei' + fi + elif is-wsl; then + if test "$arch" = 'x64'; then + add_download_option '-x86_64-pc-windows-msvc.exe' '' elif test "$arch" = 'x32'; then - add_download_option '-i686-unknown-linux-musl.tar.gz' + add_download_option '-i686-pc-windows-msvc.exe' '' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-tree b/commands/setup-util-tree new file mode 100755 index 000000000..5ea56a89f --- /dev/null +++ b/commands/setup-util-tree @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# https://repology.org/project/tree/versions <-- missing + +function setup_util_tree() ( + source "$DOROTHY/sources/bash.bash" + + # improve performance + if is-needle --quiet "$@" && ! is-needle --upgrade "$@" && ! is-needle --uninstall "$@" && command-exists tree; then + return 0 + fi + + local options=( + --cli='tree' + "$@" + APT='tree' # UBUNTU + ) + setup-util "${options[@]}" +) + +# fire if invoked standalone +if test "$0" = "${BASH_SOURCE[0]}"; then + setup_util_tree "$@" +fi diff --git a/commands/setup-util-vhs b/commands/setup-util-vhs index c8bd9f092..053e6e594 100755 --- a/commands/setup-util-vhs +++ b/commands/setup-util-vhs @@ -68,7 +68,7 @@ function setup_util_vhs() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='vhs' + DOWNLOAD_UNZIP_FILTER="$2" ) } function add_apk_option { @@ -89,37 +89,37 @@ function setup_util_vhs() ( arch="$(get-arch)" if is-mac; then if test "$arch" = 'a64'; then - add_download_option '_Darwin_arm64.tar.gz' + add_download_option '_Darwin_arm64.tar.gz' 'vhs' elif test "$arch" = 'x64'; then - add_download_option '_Darwin_x86_64.tar.gz' + add_download_option '_Darwin_x86_64.tar.gz' 'vhs' fi - elif is-wsl; then - if test "$arch" = 'x64'; then - add_download_option '_Windows_x86_64.zip' - elif test "$arch" = 'x32'; then - add_download_option '_Windows_i386.zip' - fi - else + elif is-linux; then if test "$arch" = 'a64'; then add_apk_option '_aarch64.apk' add_deb_option '_arm64.deb' add_rpm_option '.aarch64.rpm' - add_download_option '_Linux_arm64.tar.gz' + add_download_option '_Linux_arm64.tar.gz' 'vhs' elif test "$arch" = 'a32'; then add_apk_option '_armv7.apk' add_deb_option '_armhf.deb' add_rpm_option '.armv7hl.rpm' - add_download_option '_Linux_arm.tar.gz' + add_download_option '_Linux_arm.tar.gz' 'vhs' elif test "$arch" = 'x64'; then add_apk_option '_x86_64.apk' add_deb_option '_amd64.deb' add_rpm_option '.x86_64.rpm' - add_download_option '_Linux_x86_64.tar.gz' + add_download_option '_Linux_x86_64.tar.gz' 'vhs' elif test "$arch" = 'x32'; then add_apk_option '_x86.apk' add_deb_option '_i386.deb' add_rpm_option '.i386.rpm' - add_download_option '_Linux_i386.tar.gz' + add_download_option '_Linux_i386.tar.gz' 'vhs' + fi + elif is-wsl; then + if test "$arch" = 'x64'; then + add_download_option '_Windows_x86_64.zip' 'vhs.exe' + elif test "$arch" = 'x32'; then + add_download_option '_Windows_i386.zip' 'vhs.exe' fi fi setup-util "${options[@]}" diff --git a/commands/setup-util-wslu b/commands/setup-util-wslu new file mode 100755 index 000000000..6c77dff67 --- /dev/null +++ b/commands/setup-util-wslu @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# https://wslutiliti.es/wslu/ +# https://wslutiliti.es/wslu/install.html + +function setup_util_wslu() ( + source "$DOROTHY/sources/bash.bash" + + # improve performance + if is-needle --quiet "$@" && ! is-needle --upgrade "$@" && ! is-needle --uninstall "$@" && command-exists wslview; then + return 0 + fi + + # @todo figure out installers for other platforms + local options=( + --name='wslu' + --cli='wslview' + "$@" + APK='wslu' # ALPINE + APT_REPO='ppa:wslutilities/wslu' + APT='wslu' # UBUNTU + BREW='wslu' + YUM='wslu' # FEDORA + ) + setup-util "${options[@]}" +) + +# fire if invoked standalone +if test "$0" = "${BASH_SOURCE[0]}"; then + setup_util_wslu "$@" +fi diff --git a/commands/setup-util-zoxide b/commands/setup-util-zoxide index 2fbf6176c..85a1d2fd0 100755 --- a/commands/setup-util-zoxide +++ b/commands/setup-util-zoxide @@ -56,7 +56,7 @@ function setup_util_zoxide() ( function add_download_option { options+=( DOWNLOAD="$(get_github_asset_url "$1")" - DOWNLOAD_UNZIP_FILTER='zoxide' + DOWNLOAD_UNZIP_FILTER="$2" ) } function add_deb_option { @@ -67,25 +67,25 @@ function setup_util_zoxide() ( arch="$(get-arch)" if is-mac; then if test "$arch" = 'a64'; then - add_download_option '-aarch64-apple-darwin.tar.gz' + add_download_option '-aarch64-apple-darwin.tar.gz' 'zoxide' elif test "$arch" = 'x64'; then - add_download_option '-x86_64-apple-darwin.tar.gz' + add_download_option '-x86_64-apple-darwin.tar.gz' 'zoxide' fi - elif is-wsl; then - if test "$arch" = 'a64'; then - add_download_option '-aarch64-pc-windows-msvc.zip' - elif test "$arch" = 'x64'; then - add_download_option '-x86_64-pc-windows-msvc.zip' - fi - else + elif is-linux; then if test "$arch" = 'a64'; then add_deb_option '_arm64.deb' - add_download_option '-aarch64-unknown-linux-musl.tar.gz' + add_download_option '-aarch64-unknown-linux-musl.tar.gz' 'zoxide' elif test "$arch" = 'a32'; then - add_download_option '-armv7-unknown-linux-musl.tar.gz' + add_download_option '-armv7-unknown-linux-musl.tar.gz' 'zoxide' elif test "$arch" = 'x64'; then add_deb_option '_amd64.deb' - add_download_option '-x86_64-unknown-linux-musl.tar.gz' + add_download_option '-x86_64-unknown-linux-musl.tar.gz' 'zoxide' + fi + elif is-wsl; then + if test "$arch" = 'a64'; then + add_download_option '-aarch64-pc-windows-msvc.zip' 'zoxide.exe' + elif test "$arch" = 'x64'; then + add_download_option '-x86_64-pc-windows-msvc.zip' 'zoxide.exe' fi fi setup-util "${options[@]}" diff --git a/commands/unziptar b/commands/unziptar index b20197519..1f3cae266 100755 --- a/commands/unziptar +++ b/commands/unziptar @@ -202,14 +202,11 @@ function unziptar_() ( echo-style --bold='File:' ' ' "$file" echo-style --bold='-- expanded paths --' expand-path "$archive_directory/$filter" - echo-style --bold='-- expanded paths (zsh) --' - expand-path-zsh "$archive_directory/$filter" - echo-style --bold='-- expanded paths (bash) --' - expand-path-bash "$archive_directory/$filter" echo-style --bold='-- filtered paths --' echo-verbose -- "${filtered_paths[@]}" - echo-style --bold='-- ls --' - ls -la "$archive_directory" + echo-style --bold='-- tree --' + setup-util-tree --quiet + tree "$archive_directory" } >/dev/stderr } if test "${#filtered_paths[@]}" -eq 0; then