Skip to content

Commit

Permalink
fix wsl support, use tree for unzipitar errors
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Oct 27, 2023
1 parent 3c34c6b commit d56c6e3
Show file tree
Hide file tree
Showing 40 changed files with 492 additions and 400 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions commands/is-linux
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion commands/setup-util
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
24 changes: 12 additions & 12 deletions commands/setup-util-bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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[@]}"
Expand Down
11 changes: 6 additions & 5 deletions commands/setup-util-bottom
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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[@]}"
)

Expand Down
35 changes: 14 additions & 21 deletions commands/setup-util-carapace
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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 {
Expand All @@ -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[@]}"
Expand Down
22 changes: 11 additions & 11 deletions commands/setup-util-cronitor
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"
Expand Down
24 changes: 12 additions & 12 deletions commands/setup-util-delta
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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[@]}"
Expand Down
28 changes: 17 additions & 11 deletions commands/setup-util-deno
Original file line number Diff line number Diff line change
Expand Up @@ -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[@]}"
Expand Down
26 changes: 13 additions & 13 deletions commands/setup-util-dust
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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[@]}"
Expand Down
Loading

0 comments on commit d56c6e3

Please sign in to comment.