scwrypts v4.4 config adjustments; added os dependencies; removed dotwryn.env.vim references from setup; generate i3 config on setup

This commit is contained in:
Wryn (yage) Wagner 2024-05-08 23:33:06 -06:00
parent 95f26a6322
commit c5fa4d1056
36 changed files with 181 additions and 75 deletions

View File

@ -1,4 +1,12 @@
#!/bin/zsh
command -v scwrypts &>/dev/null || {
[ -f $HOME/.local/bin/scwrypts ] \
&& scwrypts() { $HOME/.local/bin/scwrypts $@; } \
|| scwrypts() { $HOME/.wryn/zsh/plugins/scwrypts/scwrypts $@; } \
;
}
case $1 in
( next | previous | play-pause ) playerctl $1 ;;
( fastforward ) playerctl position 5+ ;;

View File

@ -13,5 +13,5 @@ xrandr ${ARGS[@]} \
(pkill compton; sleep 0.5; compton;) &
scwrypts desktop screen-blank -- enable
scwrypts desktop i3 set background -- random
scwrypts desktop i3 set background -- $(scwrypts -n get theme).jpg || scwrypts desktop i3 set background -- random
scwrypts desktop play sound -- gamedock

View File

@ -5,11 +5,14 @@
SCWRYPTS_SHORTCUT='' # CTRL + W
SCWRYPTS_ENV_SHORTCUT='' # CTRL + /
source "$HOME/.wryn/scwrypts/dotwryn/dotwryn.scwrypts.zsh"
source "$HOME/.wryn/scwrypts/ssh/ssh.scwrypts.zsh"
[ -f "$HOME/Projects/yage/home/code/scwrypts/yagehome.scwrypts.zsh" ] \
&& source "$HOME/Projects/yage/home/code/scwrypts/yagehome.scwrypts.zsh"
for SEARCH_DIR in \
"$HOME/.wryn/scwrypts" \
"$HOME/Projects/yage/" \
;
do
[ -d "$SEARCH_DIR" ] || continue
for G in "$SEARCH_DIR/"**/*.scwrypts.zsh; do . "$G"; done
done
[ -f "$HOME/.config/scwrypts/config.local.zsh" ] \
&& source "$HOME/.config/scwrypts/config.local.zsh"

View File

@ -4,4 +4,4 @@
#####################################################################
# session name for remote connection (default 'remote')
export REMOTE_TMUX_SESSION=wryn
export REMOTE_TMUX_SESSION=

View File

@ -4,4 +4,4 @@
#####################################################################
# session name for remote connection (default 'remote')
export REMOTE_TMUX_SESSION=wryn # from local
export REMOTE_TMUX_SESSION=

View File

@ -4,4 +4,4 @@
#####################################################################
# session name for remote connection (default 'remote')
export REMOTE_TMUX_SESSION=wryn # from local
export REMOTE_TMUX_SESSION=

View File

@ -4,4 +4,4 @@
#####################################################################
# session name for remote connection (default 'remote')
export REMOTE_TMUX_SESSION=wryn # from local
export REMOTE_TMUX_SESSION=

View File

@ -4,4 +4,4 @@
#####################################################################
# session name for remote connection (default 'remote')
export REMOTE_TMUX_SESSION=wryn # from local
export REMOTE_TMUX_SESSION=

View File

@ -4,4 +4,4 @@
#####################################################################
# session name for remote connection (default 'remote')
export REMOTE_TMUX_SESSION=wryn # from local
export REMOTE_TMUX_SESSION=

View File

@ -24,12 +24,6 @@ export DISCORD__DEFAULT_CHANNEL_ID=
export DISCORD__DEFAULT_USERNAME=
export DISCORD__DEFAULT_WEBHOOK=
# custom i3 configuration settings
export I3__BORDER_PIXEL_SIZE=
export I3__DMENU_FONT_SIZE=
export I3__GLOBAL_FONT_SIZE=
export I3__MODEL_CONFIG=$DOTWRYN/config/i3.conf
# linear.app project management configuration
export LINEAR__API_TOKEN=

View File

@ -24,12 +24,6 @@ export DISCORD__DEFAULT_CHANNEL_ID=
export DISCORD__DEFAULT_USERNAME=
export DISCORD__DEFAULT_WEBHOOK=
# custom i3 configuration settings
export I3__BORDER_PIXEL_SIZE=
export I3__DMENU_FONT_SIZE=
export I3__GLOBAL_FONT_SIZE=
export I3__MODEL_CONFIG=$DOTWRYN/config/i3.conf # from local
# linear.app project management configuration
export LINEAR__API_TOKEN=

View File

@ -24,12 +24,6 @@ export DISCORD__DEFAULT_CHANNEL_ID=
export DISCORD__DEFAULT_USERNAME=
export DISCORD__DEFAULT_WEBHOOK=
# custom i3 configuration settings
export I3__BORDER_PIXEL_SIZE=
export I3__DMENU_FONT_SIZE=
export I3__GLOBAL_FONT_SIZE=
export I3__MODEL_CONFIG=$DOTWRYN/config/i3.conf # from local
# linear.app project management configuration
export LINEAR__API_TOKEN=

View File

@ -24,12 +24,6 @@ export DISCORD__DEFAULT_CHANNEL_ID=
export DISCORD__DEFAULT_USERNAME=
export DISCORD__DEFAULT_WEBHOOK=
# custom i3 configuration settings
export I3__BORDER_PIXEL_SIZE=1
export I3__DMENU_FONT_SIZE=20
export I3__GLOBAL_FONT_SIZE=7
export I3__MODEL_CONFIG=$DOTWRYN/config/i3.conf # from local
# linear.app project management configuration
export LINEAR__API_TOKEN=

View File

@ -24,12 +24,6 @@ export DISCORD__DEFAULT_CHANNEL_ID=
export DISCORD__DEFAULT_USERNAME=
export DISCORD__DEFAULT_WEBHOOK=
# custom i3 configuration settings
export I3__BORDER_PIXEL_SIZE=
export I3__DMENU_FONT_SIZE=
export I3__GLOBAL_FONT_SIZE=
export I3__MODEL_CONFIG=$DOTWRYN/config/i3.conf # from local
# linear.app project management configuration
export LINEAR__API_TOKEN=

View File

@ -24,22 +24,19 @@ export DISCORD__DEFAULT_CHANNEL_ID=
export DISCORD__DEFAULT_USERNAME=umbreon
export DISCORD__DEFAULT_WEBHOOK=
# custom i3 configuration settings
export I3__BORDER_PIXEL_SIZE=3
export I3__DMENU_FONT_SIZE=18
export I3__GLOBAL_FONT_SIZE=16
export I3__MODEL_CONFIG=$DOTWRYN/config/i3.conf # from local
# linear.app project management configuration
export LINEAR__API_TOKEN=
# s3 bucket name and filesystem targets for media backups
export MEDIA_SYNC__S3_BUCKET=yage # from local
export MEDIA_SYNC__TARGETS=(
.porn
Documents
Media
Pictures
.local/.porn
Media/commission
Media/music
Media/recordings
Media/sfx
)
# redis connection credentials

View File

@ -39,3 +39,7 @@ VUNDLE__BUILD__youcompleteme() {
# ... build steps from /home/w0ryn/.vim/youcompleteme
./install.py --all
}
VUNDLE__BUILD__rust.vim() {
# ... build steps from /home/w0ryn/.vim/rust.vim
}

View File

@ -1 +1,2 @@
setxkbmap -option compose:ralt
return 0

View File

@ -1,4 +1,5 @@
#!/bin/zsh
use bastion --group remote
use config --group remote
#####################################################################
@ -14,6 +15,9 @@ USAGE__options="
--no-tty don't request a tty connection
--force-local-login force login through ssh when working with localhost
--use-bastion true / false override for bastion preference
(default: session.name.bastion.preferred or 'false')
"
USAGE__description="
@ -35,22 +39,33 @@ MAIN() {
local LOAD_RC=true
local USE_TTY=true
local FORCE_LOCAL_LOGIN=false
local USE_BASTION
while [[ $# -gt 0 ]]
do
local _S=1
case $1 in
-t | --type ) CONNECTION_TYPE=$2; shift 1 ;;
-c | --command ) REMOTE_COMMAND=$2; shift 1 ;;
-s | --shell ) LOGIN_SHELL=$2; shift 1 ;;
-t | --type ) ((_S+=1)); CONNECTION_TYPE=$2 ;;
-c | --command ) ((_S+=1)); REMOTE_COMMAND=$2 ;;
-s | --shell ) ((_S+=1)); LOGIN_SHELL=$2 ;;
--no-rc ) LOAD_RC=false ;;
--no-tty ) USE_TTY=false ;;
--use-bastion )
((_S+=1))
USE_BASTION=$2
case $USE_BASTION in
true | false ) ;;
* ) ERROR "invalid setting for '--use-bastion' (must be 'true' or 'false')" ;;
esac
;;
--force-local-login ) FORCE_LOCAL_LOGIN=true ;;
* ) ERROR "unknown argument '$1'" ;;
esac
shift 1
shift $_S
done
CHECK_ERRORS
@ -88,8 +103,8 @@ MAIN() {
REMOTE_COMMAND=$(\
REMOTE__QUERY_CONNECTION_WITH_FALLBACK \
"$REMOTE_COMMAND" \
".$REMOTE_NAME.$CONNECTION_TYPE.command" \
".$REMOTE_NAME.command" \
".sessions.$REMOTE_NAME.$CONNECTION_TYPE.command" \
".sessions.$REMOTE_NAME.command" \
".default.$CONNECTION_TYPE.command" \
".default.command" \
)
@ -113,6 +128,35 @@ MAIN() {
esac
}
#####################################################################
[ $USE_BASTION ] || {
USE_BASTION=$(\
REMOTE__QUERY_CONNECTION_WITH_FALLBACK \
".sessions.$REMOTE_NAME.bastion.preferred" \
'false' \
;
)
}
local BASTION_HOST
[[ $USE_BASTION =~ true ]] && {
BASTION_HOST=$(\
REMOTE__QUERY_CONNECTION_WITH_FALLBACK \
".sessions.$REMOTE_NAME.bastion.session" \
)
}
[ $BASTION_HOST ] && {
PASSTHROUGH_COMMAND="$(GET_PASSTHROUGH_PREFIX) connect $REMOTE_NAME -- -c $(printf "%q " "$REMOTE_COMMAND")"
BASTION_TARGET=$REMOTE_NAME REMOTE__TARGET=$BASTION_HOST MAIN --command "$PASSTHROUGH_COMMAND"
return $?
}
##########################################
[ $REMOTE_COMMAND ] && [[ $LOAD_RC =~ true ]] && {
REMOTE_COMMAND="$LOGIN_SHELL -l -c 'source ~/.$(basename $LOGIN_SHELL)rc &>/dev/null; $REMOTE_COMMAND'"
}
@ -123,10 +167,11 @@ MAIN() {
|| REMOTE_COMMAND="$LOGIN_SHELL"
}
##########################################
[ $BASTION_TARGET ] && CONNECTION_TYPE=bastion
STATUS "
attempting execution on $REMOTE_NAME
DEBUG "
attempting execution:
netpath : $(hostnamectl --static) -> $([ $BASTION_TARGET ] && echo "$BASTION_TARGET -> ")$REMOTE_NAME
type : $CONNECTION_TYPE
connection : $REMOTE_NAME
command : \"$REMOTE_COMMAND\"

View File

@ -0,0 +1,3 @@
GET_PASSTHROUGH_PREFIX() {
echo "SUBSCWRYPT=$((SUBSCWRYPT+1)) SCWRYPTS_LOG_LEVEL=$SCWRYPTS_LOG_LEVEL scwrypts"
}

View File

@ -2,7 +2,7 @@ SCWRYPTS_GROUPS+=(remote)
[ $DOTWRYN ] || source "$HOME/.config/wryn/env.zsh"
export SCWRYPTS_TYPE__remote=zsh
export SCWRYPTS_ROOT__remote="$DOTWRYN/scwrypts/ssh"
export SCWRYPTS_ROOT__remote="$DOTWRYN/scwrypts/remote"
export SCWRYPTS_COLOR__remote='\033[0;34m'
DEPENDENCIES+=(yq)

View File

@ -1,4 +1,5 @@
#!/bin/zsh
use bastion --group remote
use config --group remote
DEPENDENCIES+=(timeout ssh)
@ -9,6 +10,9 @@ USAGE__options='
-s, --connection-string explicit session host / ssh connection string to test
-t, --maximum-timeout maximum connection timeout before failure (in seconds)
-c, --command testing command; performs echo by default
--use-bastion true / false override for bastion preference
(default: session.name.bastion.preferred or "false")
'
USAGE__description='
@ -22,45 +26,86 @@ MAIN() {
local CONNECTION_STRING REMOTE_NAME
local TIMEOUT_SECONDS=3
local COMMAND='echo OK &>/dev/null'
local USE_BASTION
while [[ $# -gt 0 ]]
do
local _S=1
case $1 in
-n | --name )
((_S+=1))
REMOTE_NAME=$2
CONNECTION_STRING=$(REMOTE__GET_CONNECTION_STRING $REMOTE_NAME)
shift 1
;;
-s | --connection_string )
((_S+=1))
CONNECTION_STRING="$2"
shift 1
;;
-t | --maximum-timout )
((_S+=1))
TIMEOUT_SECONDS=$2
[[ $TIMEOUT_SECONDS -gt 0 ]] \
|| ERROR "invalid timeout seconds '$TIMEOUT_SECONDS'"
shift 1
;;
-c | --command )
((_S+=1))
COMMAND=$2
shift 1
;;
--use-bastion )
((_S+=1))
USE_BASTION=$2
case $USE_BASTION in
true | false ) ;;
* ) ERROR "invalid setting for '--use-bastion' (must be 'true' or 'false')" ;;
esac
;;
* ) ERROR "unrecognized argument '$1'" ;;
esac
shift 1
shift $_S
done
[ $CONNECTION_STRING ] \
|| ERROR "unable to determine connection string"
[ $USE_BASTION ] || {
USE_BASTION=$(\
REMOTE__QUERY_CONNECTION_WITH_FALLBACK \
".sessions.$REMOTE_NAME.bastion.preferred" \
'false' \
;
)
}
CHECK_ERRORS
##########################################
local BASTION_HOST
[[ $USE_BASTION =~ true ]] && {
BASTION_HOST=$(\
REMOTE__QUERY_CONNECTION_WITH_FALLBACK \
".sessions.$REMOTE_NAME.bastion.session" \
)
}
[[ $USE_BASTION =~ true ]] && {
[ $BASTION_HOST ] \
|| ERROR "cannot connect to $REMOTE_NAME; no configured bastion host" \
|| return 1
}
case $CONNECTION_STRING in
localhost | $USER@localhost )
CONNECTION_TEST() { return 0; } # current user on local machine can always connect
;;
* )
[[ $USE_BASTION =~ true ]] && {
DEBUG "MAIN -n $BASTION_HOST -c \"$(GET_PASSTHROUGH_PREFIX) remote test -- -n $REMOTE_NAME -c \"$COMMAND\"\""
BASTION_TARGET="$REMOTE_NAME" MAIN -n $BASTION_HOST -c "$(GET_PASSTHROUGH_PREFIX) remote test -- -n $REMOTE_NAME -c \"$COMMAND\""
return $?
}
CONNECTION_TEST() {
[ $REMOTE_NAME ] && {
[[ $(REMOTE__QUERY_CONNECTION .sessions.$REMOTE_NAME) =~ false ]] && {
@ -68,16 +113,16 @@ MAIN() {
}
}
local REMOTE_ARGS=()
REMOTE_ARGS+=($(REMOTE__GET_SSH_ARGS --type ssh --no-tty $REMOTE_NAME))
REMOTE_ARGS+=($(REMOTE__GET_SSH_ARGS --type ssh $REMOTE_NAME))
REMOTE_ARGS+=(-o BatchMode=yes)
DEBUG "attempting\nssh ${REMOTE_ARGS[@]} \"$CONNECTION_STRING\" \"$COMMAND\""
timeout $TIMEOUT_SECONDS ssh ${REMOTE_ARGS[@]} "$CONNECTION_STRING" "$COMMAND" >&2
DEBUG "attempting\ntimeout $TIMEOUT_SECONDS ssh $REMOTE_ARGS $CONNECTION_STRING "'\'"\"$COMMAND"'\'"\"" >&2
timeout --foreground $TIMEOUT_SECONDS ssh ${REMOTE_ARGS[@]} "$CONNECTION_STRING" "$COMMAND" >&2
}
;;
esac
[ $REMOTE_NAME ] || REMOTE_NAME=explicit
STATUS "testing connection $CONNECTION_STRING ($REMOTE_NAME)" \
STATUS "testing connection $CONNECTION_STRING ($REMOTE_NAME$([ $BASTION_TARGET ] && echo " -> $BASTION_TARGET"))" \
&& CONNECTION_TEST \
&& SUCCESS "successfully connected to '$CONNECTION_STRING' ($REMOTE_NAME)" \
|| ERROR "connection to '$CONNECTION_STRING ($REMOTE_NAME)' failed" \

View File

@ -7,6 +7,22 @@
CONNECTIONS_FILE="$HOME/.config/wryn/remote-connections.toml"
OMNI_LOGDIR="$HOME/.local/share/scwrypts/dotwryn"
OMNI_LOGFILE="$HOME/.local/share/scwrypts/dotwryn/omni.current.txt"
[ ! -d "$OMNI_LOGDIR" ] && mkdir -p "$OMNI_LOGDIR"
[ -f "$OMNI_LOGFILE" ] && {
for x in {1..99}
do
[ ! -f "$OMNI_LOGDIR/omni.$x.txt" ] && break
done
[ ! -f "$OMNI_LOGDIR/omni.$x.txt" ] && mv "$OMNI_LOGFILE" "$OMNI_LOGDIR/omni.$x.txt"
}
echo "OMNI MANAGER START : $(date)" > "$OMNI_LOGFILE"
OMNI_SOCKET="omni.socket"
OMNI_TMUX() { tmux -L $OMNI_SOCKET $@; }
@ -30,7 +46,7 @@ GET_UNIQUE_WINDOW_ID() {
&& return 0 \
;
unset WINDOW_ID__$REMOTE_NAME &>/dev/null
unset WINDOW_ID__$REMOTE_NAME &>>"$OMNI_LOGFILE"
WINDOW_ID="$1"
WINDOW_ID=$(CONFIG_QUERY .sessions.$REMOTE_NAME.id)
@ -86,11 +102,12 @@ do
&& continue
printf "testing connection $REMOTE_NAME..."
scwrypts -n --name test --group remote --type zsh \
echo "testing connection $REMOTE_NAME..." &>>"$OMNI_LOGFILE"
scwrypts --name test --group remote --type zsh \
-- \
--name $REMOTE_NAME \
--command 'command -v tmux' \
&>/dev/null \
&>>"$OMNI_LOGFILE" \
&& export CAN_CONNECT__$REMOTE_NAME=true \
|| export CAN_CONNECT__$REMOTE_NAME=false \
;

View File

@ -6,6 +6,8 @@ function SETUP__CONFIG() {
CONFIG__ZSH || return 2
CONFIG__VIM || return 3
SCWRYPTS generate i3 config || return 4
SUCCESS 'finished application configuration'
}

View File

@ -11,5 +11,6 @@ lolcat
ncurses
python
ripgrep
scwrypts
tmux
vim

View File

@ -43,6 +43,7 @@ python-virtualenv
ripgrep
rofi
rustup
scwrypts
sudo
tmux
ttf-nerd-fonts-symbols

View File

@ -92,6 +92,10 @@ OS__INSTALL_MANAGED_DEPENDENCIES() {
UPDATE_REPOSITORIES__arch() { yay -Syu; }
INSTALL_MANAGED__arch() {
local TARGET="$1"
[[ $TARGET =~ aws-cli-v2 ]] && {
STATUS "skipping aws-cli-v2 checks since they are bad right now"
return 0
}
STATUS "checking for $TARGET"

@ -1 +1 @@
Subproject commit c2b4aa5ad2532cca91f23908ac7f00efb7ff09c9
Subproject commit c7fb028ec0bbc1056c51508602dbd61b0f475ac3

@ -1 +1 @@
Subproject commit 8f3e86208686de45f06bbfbdd77d3424eb44f607
Subproject commit 3fe01a726399df3753cfe544808700bd43c30a09

@ -1 +1 @@
Subproject commit b82ac78a2d4457d2ca09973332638f123f065fd1
Subproject commit d37a763a6a30e1b32766fecc3b8ffd6127f8a0fd

View File

@ -1,3 +1,8 @@
#####################################################################
ZSH_PLUGINS+=($(
find "$HOME/.local/zsh" -type f 2>/dev/null
))
#####################################################################
return 0