#! /usr/bin/env bash # The top half of this script runs in Bash and the bottom half in Powershell # Some lines at the end or the beginning can run in both shells, but syntax # common to both is limited. # -------------------------------------------------------------------------- echo @' ' > /dev/null #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv # Bash Start ----------------------------------------------------------- SUPPORT=https://raw.githubusercontent.com/trustable-ai/.github/refs/heads/main/support.sh if uname | grep Darwin then cd ~/Library/Application\ Support/Trustable/ IP="$(cat current.ip)" if ping -c 1 $IP then curl -sL $SUPPORT | ssh -i id_ed25519 trustable@"$IP" bash -s - else echo cannot reach vm, please start it fi else curl -sL "SUPPORT" | bash fi exit $? # Above this line is Bash Script ------------------------------------------- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ echo > /dev/null <<"out-null" ### '@ | out-null #vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv # Below this line is Powershell Script ------------------------------------- [Console]::OutputEncoding = [System.Text.Encoding]::Unicode $distro = wsl.exe --list --quiet | Where-Object { $_ -like "Trustable*" } | Sort-Object -Descending | Select-Object -First 1 $SUPPORT= "https://raw.githubusercontent.com/trustable-ai/.github/refs/heads/main/support.sh" wsl -d $distro bash -c "curl -sL $SUPPORT | sudo bash" # Powershell End ----------------------------------------------------------- # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-null #---------------------------------------------------------------------------