Initial public release of Warp.
Repo-Sync-Origin: warpdotdev/warp-internal@12af1d983b
This commit is contained in:
@@ -0,0 +1 @@
|
||||
brew install tmux && tmux -Lwarp -CC && exit
|
||||
@@ -0,0 +1,29 @@
|
||||
INSTALL_TMUX='set -e
|
||||
|
||||
_on_error() {
|
||||
local _msg=$(printf "{\"hook\": \"TmuxInstallFailed\", \"value\": { \"line\": \"$1\", \"command\": \"$2\" } }" | command -p od -An -v -tx1 | command -p tr -d " \n")
|
||||
printf '\''\033\120\044\144%s\234'\'' "$_msg"
|
||||
rm -rf "$HOME/.warp/tmux"
|
||||
}
|
||||
trap "_on_error \"\${LINENO}\" \"\$BASH_COMMAND\"" ERR
|
||||
|
||||
mkdir -p $HOME/.warp/tmux
|
||||
pushd "$HOME/.warp/tmux"
|
||||
|
||||
ARCH=$(uname -m)
|
||||
case "$ARCH" in
|
||||
x86_64) ARCH_NAME=amd64 ;;
|
||||
amd64) ARCH_NAME=amd64 ;;
|
||||
aarch64) ARCH_NAME=arm64 ;;
|
||||
*) echo "Unsupported architecture $ARCH"; exit 1 ;;
|
||||
esac
|
||||
|
||||
URL="https://github.com/warpdotdev/portable-tmux/releases/download/tmux-3.5a/tmux-${ARCH_NAME}.tar.gz"
|
||||
|
||||
(curl -o tmux.tar.gz -L $URL || wget -O tmux.tar.gz $URL) && tar -xf tmux.tar.gz
|
||||
|
||||
INSTALL_PATH="$HOME/.warp/tmux/local"
|
||||
echo "TERM=tmux-256color LD_LIBRARY_PATH=\"$INSTALL_PATH/lib\" TERMINFO=\"$INSTALL_PATH/share/terminfo/\" \"$INSTALL_PATH/bin/tmux\" \"\$@\";" > ~/.warp/tmux/execute_tmux.sh
|
||||
chmod +x ~/.warp/tmux/execute_tmux.sh;'
|
||||
|
||||
bash <<< "$INSTALL_TMUX" && ~/.warp/tmux/execute_tmux.sh -Lwarp -CC && exit
|
||||
@@ -0,0 +1,13 @@
|
||||
INSTALL_TMUX='set -e
|
||||
|
||||
_on_error() {
|
||||
local _msg=$(printf "{\"hook\": \"TmuxInstallFailed\", \"value\": { \"line\": \"$1\", \"command\": \"$2\" } }" | command -p od -An -v -tx1 | command -p tr -d " \n")
|
||||
printf '\''\033\120\044\144%s\234'\'' "$_msg"
|
||||
rm -rf "$HOME/.warp/tmux"
|
||||
}
|
||||
trap "_on_error \"\${LINENO}\" \"\$BASH_COMMAND\"" ERR
|
||||
|
||||
sudo apt update -y
|
||||
sudo apt install -y tmux'
|
||||
|
||||
bash <<< "$INSTALL_TMUX" && _check_tmux && command tmux -Lwarp -CC && exit
|
||||
@@ -0,0 +1,13 @@
|
||||
INSTALL_TMUX='set -e
|
||||
|
||||
_on_error() {
|
||||
local _msg=$(printf "{\"hook\": \"TmuxInstallFailed\", \"value\": { \"line\": \"$1\", \"command\": \"$2\" } }" | command -p od -An -v -tx1 | command -p tr -d " \n")
|
||||
printf '\''\033\120\044\144%s\234'\'' "$_msg"
|
||||
rm -rf "$HOME/.warp/tmux"
|
||||
}
|
||||
trap "_on_error \"\${LINENO}\" \"\$BASH_COMMAND\"" ERR
|
||||
|
||||
sudo dnf update -y
|
||||
sudo dnf install -y tmux'
|
||||
|
||||
bash <<< "$INSTALL_TMUX" && _check_tmux && command tmux -Lwarp -CC && exit
|
||||
@@ -0,0 +1,13 @@
|
||||
INSTALL_TMUX='set -e
|
||||
|
||||
_on_error() {
|
||||
local _msg=$(printf "{\"hook\": \"TmuxInstallFailed\", \"value\": { \"line\": \"$1\", \"command\": \"$2\" } }" | command -p od -An -v -tx1 | command -p tr -d " \n")
|
||||
printf '\''\033\120\044\144%s\234'\'' "$_msg"
|
||||
rm -rf "$HOME/.warp/tmux"
|
||||
}
|
||||
trap "_on_error \"\${LINENO}\" \"\$BASH_COMMAND\"" ERR
|
||||
|
||||
sudo pacman -Syu --noconfirm
|
||||
sudo pacman -S --noconfirm tmux'
|
||||
|
||||
bash <<< "$INSTALL_TMUX" && _check_tmux && command tmux -Lwarp -CC && exit
|
||||
@@ -0,0 +1,13 @@
|
||||
INSTALL_TMUX='set -e
|
||||
|
||||
_on_error() {
|
||||
local _msg=$(printf "{\"hook\": \"TmuxInstallFailed\", \"value\": { \"line\": \"$1\", \"command\": \"$2\" } }" | command -p od -An -v -tx1 | command -p tr -d " \n")
|
||||
printf '\''\033\120\044\144%s\234'\'' "$_msg"
|
||||
rm -rf "$HOME/.warp/tmux"
|
||||
}
|
||||
trap "_on_error \"\${LINENO}\" \"\$BASH_COMMAND\"" ERR
|
||||
|
||||
sudo yum update -y
|
||||
sudo yum install -y tmux'
|
||||
|
||||
bash <<< "$INSTALL_TMUX" && _check_tmux && command tmux -Lwarp -CC && exit
|
||||
@@ -0,0 +1,13 @@
|
||||
INSTALL_TMUX='set -e
|
||||
|
||||
_on_error() {
|
||||
local _msg=$(printf "{\"hook\": \"TmuxInstallFailed\", \"value\": { \"line\": \"$1\", \"command\": \"$2\" } }" | command -p od -An -v -tx1 | command -p tr -d " \n")
|
||||
printf '\''\033\120\044\144%s\234'\'' "$_msg"
|
||||
rm -rf "$HOME/.warp/tmux"
|
||||
}
|
||||
trap "_on_error \"\${LINENO}\" \"\$BASH_COMMAND\"" ERR
|
||||
|
||||
sudo zypper refresh
|
||||
sudo zypper install -y tmux'
|
||||
|
||||
bash <<< "$INSTALL_TMUX" && _check_tmux && command tmux -Lwarp -CC && exit
|
||||
@@ -0,0 +1,68 @@
|
||||
_find() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
_log() {
|
||||
_msg=$(printf "{\"hook\": \"$1\", \"value\": $2}" | command -p od -An -v -tx1 | command -p tr -d " \n")
|
||||
printf '\033\120\044\144%s\234' "$_msg"
|
||||
}
|
||||
|
||||
_err() {
|
||||
_log RemoteWarpificationIsUnavailable "$1"
|
||||
}
|
||||
|
||||
_system_details() {
|
||||
OS=$(uname)
|
||||
if [ "$OS" = "Darwin" ]; then
|
||||
if _find brew; then
|
||||
PKG="homebrew"
|
||||
fi
|
||||
elif [ "$OS" = "Linux" ]; then
|
||||
if _find pacman; then
|
||||
PKG="pacman"
|
||||
elif _find zypper; then
|
||||
PKG="zypper"
|
||||
elif _find dnf; then
|
||||
PKG="dnf"
|
||||
elif _find yum && _find yumdownloader; then
|
||||
PKG="yum"
|
||||
elif _find apt; then
|
||||
PKG="apt"
|
||||
fi
|
||||
fi
|
||||
RA="no_root_access"
|
||||
if command -v sudo >/dev/null && { sudo -vn && sudo -ln; } 2>&1 | grep -E 'may run|a password' > /dev/null; then RA="can_run_sudo"
|
||||
elif [ "$(id -u)" -eq 0 ] && [ "$(whoami)" = "root" ]; then RA="is_root"
|
||||
fi
|
||||
|
||||
WH=$( [ -w ~ ] && echo true || echo false )
|
||||
|
||||
printf '%s' "{\"os\": \"$OS\", \"pkg\": \"$PKG\", \"shell\": \"$(basename $SHELL)\", \"root_access\": \"$RA\", \"writable_home\": $WH}"
|
||||
}
|
||||
|
||||
# _check_tmux is used in tmux install script post install!
|
||||
_check_tmux() {
|
||||
if _find $HOME/.warp/tmux/execute_tmux.sh; then
|
||||
_log SshTmuxInstaller "\"warp\""
|
||||
TMUX="$HOME/.warp/tmux/execute_tmux.sh"
|
||||
elif _find tmux; then
|
||||
TMUX="tmux"
|
||||
_log SshTmuxInstaller "\"user\""
|
||||
fi
|
||||
|
||||
if [ $TMUX ]; then
|
||||
VER=$(command $TMUX -V 2>/dev/null | awk '{print $2}')
|
||||
if [ -z "$VER" ]; then
|
||||
_err "\"TmuxFailed\""
|
||||
elif [ "$(printf '%s\n' "$VER" "2.9" | sort -V | tail -n1)" = "2.9" ]; then
|
||||
_err "{\"UnsupportedTmuxVersion\": $(_system_details)}"
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
_err "{\"TmuxNotInstalled\": $(_system_details)}"
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
_check_tmux && command $TMUX -Lwarp -CC && exit
|
||||
@@ -0,0 +1,49 @@
|
||||
_find() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
_log() {
|
||||
_msg=$(printf "{\"hook\": \"$1\", \"value\": $2}" | command -p od -An -v -tx1 | command -p tr -d " \n")
|
||||
printf '\033\120\044\144%s\234' "$_msg"
|
||||
}
|
||||
|
||||
_err() {
|
||||
_log RemoteWarpificationIsUnavailable "$1"
|
||||
}
|
||||
|
||||
_sd() {
|
||||
if _find brew; then
|
||||
PKG="homebrew"
|
||||
fi
|
||||
|
||||
WH=$( [ -w ~ ] && echo true || echo false )
|
||||
|
||||
printf '{"os": "Darwin", "pkg": "%s", "shell": "%s", "root_access": "no_root_access", "writable_home": %s}' "$PKG" "$(basename $SHELL)" $WH
|
||||
}
|
||||
|
||||
# _check_tmux is used in tmux install script post install!
|
||||
_check_tmux() {
|
||||
TMUX="$HOME/.warp/tmux/execute_tmux.sh"
|
||||
if _find "$TMUX"; then
|
||||
_log SshTmuxInstaller "\"warp\""
|
||||
elif _find tmux; then
|
||||
TMUX="tmux"
|
||||
_log SshTmuxInstaller "\"user\""
|
||||
fi
|
||||
|
||||
if [ $TMUX ]; then
|
||||
VER=$($TMUX -V 2>/dev/null | awk '{print $2}')
|
||||
if [ -z "$VER" ]; then
|
||||
_err "\"TmuxFailed\""
|
||||
elif [ "$(printf '%s\n' "$VER" "2.9" | sort -V | tail -n1)" = "2.9" ]; then
|
||||
_err "{\"UnsupportedTmuxVersion\": $(_sd)}"
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
else
|
||||
_err "{\"TmuxNotInstalled\": $(_sd)}"
|
||||
fi
|
||||
return 1
|
||||
}
|
||||
|
||||
_check_tmux && $TMUX -Lwarp -CC && exit
|
||||
@@ -0,0 +1,6 @@
|
||||
brew install tmux
|
||||
|
||||
if test $status -eq 0
|
||||
tmux -Lwarp -CC
|
||||
exit
|
||||
end
|
||||
@@ -0,0 +1,29 @@
|
||||
set INSTALL_TMUX 'set -e
|
||||
|
||||
_on_error() {
|
||||
local _msg=$(printf "{\"hook\": \"TmuxInstallFailed\", \"value\": { \"line\": \"$1\", \"command\": \"$2\" } }" | command -p od -An -v -tx1 | command -p tr -d " \n")
|
||||
printf '\''\033\120\044\144%s\234'\'' "$_msg"
|
||||
rm -rf "$HOME/.warp/tmux"
|
||||
}
|
||||
trap "_on_error \"\${LINENO}\" \"\$BASH_COMMAND\"" ERR
|
||||
|
||||
mkdir -p $HOME/.warp/tmux
|
||||
pushd "$HOME/.warp/tmux"
|
||||
|
||||
ARCH=$(uname -m)
|
||||
case "$ARCH" in
|
||||
x86_64) ARCH_NAME=amd64 ;;
|
||||
amd64) ARCH_NAME=amd64 ;;
|
||||
aarch64) ARCH_NAME=arm64 ;;
|
||||
*) echo "Unsupported architecture $ARCH"; exit 1 ;;
|
||||
esac
|
||||
|
||||
URL="https://github.com/warpdotdev/portable-tmux/releases/download/tmux-3.5a/tmux-${ARCH_NAME}.tar.gz"
|
||||
|
||||
(curl -o tmux.tar.gz -L $URL || wget -O tmux.tar.gz $URL) && tar -xf tmux.tar.gz
|
||||
|
||||
INSTALL_PATH="$HOME/.warp/tmux/local"
|
||||
echo "TERM=tmux-256color LD_LIBRARY_PATH=\"$INSTALL_PATH/lib\" TERMINFO=\"$INSTALL_PATH/share/terminfo/\" \"$INSTALL_PATH/bin/tmux\" \"\$@\";" > ~/.warp/tmux/execute_tmux.sh
|
||||
chmod +x ~/.warp/tmux/execute_tmux.sh;'
|
||||
|
||||
bash -c "$INSTALL_TMUX" && ~/.warp/tmux/execute_tmux.sh -Lwarp -CC && exit
|
||||
@@ -0,0 +1,80 @@
|
||||
function _is
|
||||
command -v $argv[1] >/dev/null 2>&1
|
||||
end
|
||||
|
||||
function _log
|
||||
set _hook $argv[1]
|
||||
set _value $argv[2]
|
||||
set _m (printf "{\"hook\": \"%s\", \"value\": %s}" $_hook $_value | od -An -v -tx1 | tr -d " \n")
|
||||
printf '\033\120\044\144%s\234' $_m
|
||||
end
|
||||
|
||||
function _err
|
||||
_log RemoteWarpificationIsUnavailable $argv[1]
|
||||
end
|
||||
|
||||
function _system_details
|
||||
set -l OS (uname)
|
||||
set -l PK ""
|
||||
|
||||
if test "$OS" = "Darwin"
|
||||
if _is brew
|
||||
set PK "homebrew"
|
||||
end
|
||||
else if test "$OS" = "Linux"
|
||||
if _is pacman
|
||||
set PK "pacman"
|
||||
else if _is zypper
|
||||
set PK "zypper"
|
||||
else if _is dnf
|
||||
set PK "dnf"
|
||||
else if _is yum; and _is yumdownloader
|
||||
set PK "yum"
|
||||
else if _is apt
|
||||
set PK "apt"
|
||||
end
|
||||
end
|
||||
|
||||
set -l CHECK (begin; command -v sudo > /dev/null 2>&1 && sudo -vn && sudo -ln; end 2>&1)
|
||||
set -l RA "no_root_access"
|
||||
if string match -qr '.*(may run|a password).*' "$CHECK"
|
||||
set RA "can_run_sudo"
|
||||
else if test (id -u) -eq 0; and test (whoami) = "root"
|
||||
set RA "is_root"
|
||||
end
|
||||
|
||||
set -l WH $( [ -w ~ ] && echo true || echo false )
|
||||
|
||||
printf '%s' "{\"os\": \"$OS\", \"pkg\": \"$PK\", \"shell\": \"fish\", \"root_access\": \"$RA\", \"writable_home\": $WH}"
|
||||
end
|
||||
|
||||
# _check_tmux is used in the install script post install!
|
||||
function _check_tmux
|
||||
set -g TMUX ""
|
||||
|
||||
if _is tmux
|
||||
set TMUX "tmux"
|
||||
_log SshTmuxInstaller "\"user\""
|
||||
else if _is $HOME/.warp/tmux/execute_tmux.sh
|
||||
set TMUX "$HOME/.warp/tmux/execute_tmux.sh"
|
||||
_log SshTmuxInstaller "\"warp\""
|
||||
end
|
||||
|
||||
if test -n "$TMUX"
|
||||
command $TMUX -V | awk '{print $2}' | read VER;
|
||||
if test -z "$VER"
|
||||
_err "\"TmuxFailed\""
|
||||
else if test (printf '%s\n' "$VER" "2.9" | sort -V | tail -n1) = "2.9"
|
||||
set -l DETAILS (_system_details)
|
||||
_err "{\"UnsupportedTmuxVersion\": $DETAILS}"
|
||||
else;
|
||||
return 0
|
||||
end
|
||||
else;
|
||||
set -l DETAILS (_system_details)
|
||||
_err "{\"TmuxNotInstalled\": $DETAILS}"
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
_check_tmux; and command $TMUX -Lwarp -CC; and exit
|
||||
@@ -0,0 +1,51 @@
|
||||
function _is
|
||||
command -v $argv[1] >/dev/null 2>&1
|
||||
end
|
||||
|
||||
function _l
|
||||
set _m (printf "{\"hook\": \"%s\", \"value\": %s}" $argv[1] $argv[2] | od -An -v -tx1 | tr -d " \n")
|
||||
printf '\033\120\044\144%s\234' $_m
|
||||
end
|
||||
|
||||
function _e
|
||||
_l RemoteWarpificationIsUnavailable $argv[1]
|
||||
end
|
||||
|
||||
function _sd
|
||||
set -l PK ""
|
||||
|
||||
if _is brew
|
||||
set PK "homebrew"
|
||||
end
|
||||
|
||||
printf '{"os": "Darwin", "pkg": "%s", "shell": "fish", "root_access": "no_root_access", "writable_home": %s}' "$PK" $( [ -w ~ ] && echo true || echo false )
|
||||
end
|
||||
|
||||
# _check_tmux is used in tmux install script post install!
|
||||
function _check_tmux
|
||||
set -g TMUX "$HOME/.warp/tmux/execute_tmux.sh"
|
||||
if _is "$TMUX"
|
||||
_l SshTmuxInstaller "\"warp\""
|
||||
else if _is tmux
|
||||
set TMUX "tmux"
|
||||
_l SshTmuxInstaller "\"user\""
|
||||
end
|
||||
|
||||
if test -n "$TMUX"
|
||||
$TMUX -V | awk '{print $2}' | read V;
|
||||
if test -z "$V"
|
||||
_e "\"TmuxFailed\""
|
||||
else if test (printf '%s\n' "$V" "2.9" | sort -V | tail -n1) = "2.9"
|
||||
set -l D (_sd)
|
||||
_e "{\"UnsupportedTmuxVersion\": $D}"
|
||||
else;
|
||||
return 0
|
||||
end
|
||||
else;
|
||||
set -l D (_sd)
|
||||
_e "{\"TmuxNotInstalled\": $D}"
|
||||
end
|
||||
return 1
|
||||
end
|
||||
|
||||
_check_tmux; and $TMUX -Lwarp -CC; and exit
|
||||
Reference in New Issue
Block a user