* wip: openssl autodetection * add voltaile read inside of asset fn * support xcode 15 for --device * vendor openssl on android * Smaller width TUI * switch to anyhow for the entire CLI * add backtrace and print double printing of cargo_metadata errors * add some padding to multi-line anyhow error * check semvers * don't open if not interactive * set the tailwind current_dir so it doesn't twitch * get the oboe demo working * copy the c++ library on android * cleanup env vars * add depinfo watcher * fix stale hotpatches and crate count * add musl support * remove outdated autofmt test * update scanner app * add hotdog app and bundle to ci * upload dx on every branch * collapse mobile into desktop * `dx doctor` command * windows command files * no pipe on doctor * fix ci? * fix links * fix ci * use main instead of nightly * bump node * build cli for host * cargo doc * prep dog_app for bundle * package hotdog * no bundle or nightly cli * comment out nightly cli * add quotes to linker files
117 lines
2.4 KiB
Bash
Executable File
117 lines
2.4 KiB
Bash
Executable File
#!/bin/sh
|
|
set -eo pipefail
|
|
|
|
# Reset
|
|
Color_Off=''
|
|
|
|
# Regular Colors
|
|
Red=''
|
|
Green=''
|
|
Dim='' # White
|
|
|
|
# Bold
|
|
Bold_White=''
|
|
Bold_Green=''
|
|
|
|
if [[ -t 1 ]]; then
|
|
# Reset
|
|
Color_Off='\033[0m' # Text Reset
|
|
|
|
# Regular Colors
|
|
Red='\033[0;31m' # Red
|
|
Green='\033[0;32m' # Green
|
|
Dim='\033[0;2m' # White
|
|
|
|
# Bold
|
|
Bold_Green='\033[1;32m' # Bold Green
|
|
Bold_White='\033[1m' # Bold White
|
|
fi
|
|
|
|
error() {
|
|
echo -e "${Red}error${Color_Off}:" "$@" >&2
|
|
exit 1
|
|
}
|
|
|
|
info() {
|
|
echo -e "${Dim}$@ ${Color_Off}"
|
|
}
|
|
|
|
info_bold() {
|
|
echo -e "${Bold_White}$@ ${Color_Off}"
|
|
}
|
|
|
|
success() {
|
|
echo -e "${Green}$@ ${Color_Off}"
|
|
}
|
|
|
|
command -v unzip >/dev/null ||
|
|
error 'unzip is required to install dx'
|
|
|
|
if [[ $# -gt 2 ]]; then
|
|
error 'Too many arguments, only 2 are allowed. The first can be a specific tag of dx to install. (e.g. "dx-v0.7.1") or `nightly` or `pr <PR_NUMBER>` to install the latest nightly or PR build.'
|
|
fi
|
|
|
|
if [ "$OS" = "Windows_NT" ]; then
|
|
target="x86_64-pc-windows-msvc"
|
|
else
|
|
case $(uname -sm) in
|
|
"Darwin x86_64") target="x86_64-apple-darwin" ;;
|
|
"Darwin arm64") target="aarch64-apple-darwin" ;;
|
|
"Linux aarch64")
|
|
if [ -f /etc/alpine-release ]; then
|
|
target="aarch64-unknown-linux-musl"
|
|
else
|
|
target="aarch64-unknown-linux-gnu"
|
|
fi
|
|
;;
|
|
*)
|
|
if [ -f /etc/alpine-release ]; then
|
|
target="x86_64-unknown-linux-musl"
|
|
else
|
|
target="x86_64-unknown-linux-gnu"
|
|
fi
|
|
;;
|
|
esac
|
|
fi
|
|
|
|
GITHUB=${GITHUB-"https://github.com"}
|
|
github_repo="$GITHUB/dioxuslabs/dioxus"
|
|
exe_name=dx
|
|
|
|
if [[ $# = 0 ]]; then
|
|
dx_uri=$github_repo/releases/latest/download/dx-$target.zip
|
|
else
|
|
dx_uri=$github_repo/releases/download/$1/dx-$target.zip
|
|
fi
|
|
|
|
dx_install="${DX_INSTALL:-$HOME/.dx}"
|
|
bin_dir="$dx_install/bin"
|
|
exe="$bin_dir/dx"
|
|
cargo_bin_dir="$HOME/.cargo/bin"
|
|
cargo_bin_exe="$cargo_bin_dir/dx"
|
|
|
|
if [ ! -d "$bin_dir" ]; then
|
|
mkdir -p "$bin_dir"
|
|
fi
|
|
|
|
curl --fail --location --progress-bar --output "$exe.zip" "$dx_uri"
|
|
if command -v unzip >/dev/null; then
|
|
unzip -d "$bin_dir" -o "$exe.zip"
|
|
else
|
|
7z x -o"$bin_dir" -y "$exe.zip"
|
|
fi
|
|
chmod +x "$exe"
|
|
cp "$exe" "$cargo_bin_exe" || error "Failed to copy dx to $cargo_bin_dir"
|
|
rm "$exe.zip"
|
|
echo " installed: $cargo_bin_exe"
|
|
|
|
echo
|
|
echo "dx was installed successfully! 💫"
|
|
echo
|
|
|
|
if command -v dx >/dev/null; then
|
|
echo "Run 'dx --help' to get started"
|
|
else
|
|
echo "Run '$exe --help' to get started"
|
|
fi
|