From a540e5360cd617bb3309d2935fd78e98b24fc0af Mon Sep 17 00:00:00 2001 From: g Date: Thu, 17 Sep 2020 15:10:22 -0500 Subject: [PATCH] x0x0 --- vissh_snap | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/vissh_snap b/vissh_snap index 13b4529..6251dfc 100755 --- a/vissh_snap +++ b/vissh_snap @@ -2,24 +2,32 @@ REAL_HOME=$(getent passwd $(id -u) | cut -d ':' -f 6); if [ ! -f $REAL_HOME/.vimrc ]; then touch $REAL_HOME/.vimrc; fi; -vishh () { - if ([ -f $REAL_HOME/.bashrc ] && ( ! grep -qR 'alias ssh="ssh -F $REAL_HOME/.ssh/viSSHous"' $REAL_HOME/.bashrc )); - then echo 'alias ssh="ssh -F $HOME/.ssh/viSSHous"' >> $REAL_HOME/.bashrc && bash - fi +if ([ -f $REAL_HOME/.bashrc ] && ( ! grep -qR 'alias ssh="ssh -F $REAL_HOME/.ssh/viSSHous"' $REAL_HOME/.bashrc )); + then echo 'alias ssh="ssh -F $HOME/.ssh/viSSHous"' >> $REAL_HOME/.bashrc && bash +fi - if ([ -f $REAL_HOME/.zshrc ] && ( ! grep -qR 'alias ssh="ssh -F $REAL_HOME/.ssh/viSSHous"' $REAL_HOME/.zshrc )); - then echo 'alias ssh="ssh -F $HOME/.ssh/viSSHous"' >> $REAL_HOME/.zshrc && zsh - fi +if ([ -f $REAL_HOME/.zshrc ] && ( ! grep -qR 'alias ssh="ssh -F $REAL_HOME/.ssh/viSSHous"' $REAL_HOME/.zshrc )); + then echo 'alias ssh="ssh -F $HOME/.ssh/viSSHous"' >> $REAL_HOME/.zshrc && zsh +fi - echo "# last updated: $(date)" > $REAL_HOME/.ssh/viSSHous - echo 'Include ~/.ssh/config' >> $REAL_HOME/.ssh/viSSHous - echo "SetEnv LC_MONETARY=$(cat $REAL_HOME/.vimrc | base64)" >> $REAL_HOME/.ssh/viSSHous - echo 'RemoteCommand mkdir -p ~/.vim; echo $LC_MONETARY > ~/.vim/visshnu; base64 --decode ~/.vim/visshnu > ~/.vimrc; echo "😈 [LOG] VimRC was configured successfully"; if ( ! command -v vim &> /dev/null ); then echo "👿 [WARN] Vim not found"; sudo apt-get install vim -y &> /dev/null; if [ $? != 0 ]; then echo "👿 [WARN] Vim could not be auto-installed. Try manually with \`sudo apt-get install vim -y \`"; else echo "😈 [RESOLVED] Vim was auto-installed successfully"; fi; fi; if ( grep -qR "plug#begin" ~/.vimrc); then set vimplug=true; echo "😈 [LOG] Plugin manager detected: Vim-Plug"; fi; if ( grep -qR "plugin#begin" ~/.vimrc); then set vundle=true; echo "😈 Plugin manager detected: Vundle"; fi; if ([ -z $vimplug ] && [ ! -f ~/.vim/autoload/plug.vim ]); then curl -sfLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim; if [ $? == 0 ]; then echo "😈 [LOG] Vim-Plug was auto-installed successfully"; fi; fi; if (( [ -z $vimplug ] || [ -z $vundle ]) && ( ! command -v git &> /dev/null )); then echo "👿 [WARN] Git not detected, but required by plugin manager."; sudo apt-get install git -y &> /dev/null; if [ $? != 0 ]; then echo "👿 [WARN] Git could not be auto-installed. Try manually with \`sudo apt-get install git\`"; else echo "😈 [RESOLVED] Git was auto-installed successfully"; fi; fi; if ( [ -z $vimplug ] && [ -f ~/.vim/autoload/plug.vim ] ) ; then echo "😈 [LOG] Installing/updating plugins with Vim-Plug"; yes | vim -c ":PlugInstall | quit! | quit!" &> /dev/null; fi; echo "😈 [LOG] viSSHous setup complete"; bash' >> $REAL_HOME/.ssh/viSSHous - echo "RequestTTY yes" >> $REAL_HOME/.ssh/viSSHous -} - -vissh +echo "# last updated: $(date)" > $REAL_HOME/.ssh/viSSHous +echo 'Include ~/.ssh/config' >> $REAL_HOME/.ssh/viSSHous +echo "SetEnv LC_MONETARY=$(cat $REAL_HOME/.vimrc | base64)" >> $REAL_HOME/.ssh/viSSHous +echo 'RemoteCommand mkdir -p ~/.vim; echo $LC_MONETARY > ~/.vim/visshnu; base64 --decode ~/.vim/visshnu > ~/.vimrc; echo "😈 [LOG] VimRC was configured successfully"; if ( ! command -v vim &> /dev/null ); then echo "👿 [WARN] Vim not found"; sudo apt-get install vim -y &> /dev/null; if [ $? != 0 ]; then echo "👿 [WARN] Vim could not be auto-installed. Try manually with \`sudo apt-get install vim -y \`"; else echo "😈 [RESOLVED] Vim was auto-installed successfully"; fi; fi; if ( grep -qR "plug#begin" ~/.vimrc); then set vimplug=true; echo "😈 [LOG] Plugin manager detected: Vim-Plug"; fi; if ( grep -qR "plugin#begin" ~/.vimrc); then set vundle=true; echo "😈 Plugin manager detected: Vundle"; fi; if ([ -z $vimplug ] && [ ! -f ~/.vim/autoload/plug.vim ]); then curl -sfLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim; if [ $? == 0 ]; then echo "😈 [LOG] Vim-Plug was auto-installed successfully"; fi; fi; if (( [ -z $vimplug ] || [ -z $vundle ]) && ( ! command -v git &> /dev/null )); then echo "👿 [WARN] Git not detected, but required by plugin manager."; sudo apt-get install git -y &> /dev/null; if [ $? != 0 ]; then echo "👿 [WARN] Git could not be auto-installed. Try manually with \`sudo apt-get install git\`"; else echo "😈 [RESOLVED] Git was auto-installed successfully"; fi; fi; if ( [ -z $vimplug ] && [ -f ~/.vim/autoload/plug.vim ] ) ; then echo "😈 [LOG] Installing/updating plugins with Vim-Plug"; yes | vim -c ":PlugInstall | quit! | quit!" &> /dev/null; fi; echo "😈 [LOG] viSSHous setup complete"; bash' >> $REAL_HOME/.ssh/viSSHous +echo "RequestTTY yes" >> $REAL_HOME/.ssh/viSSHous inotifywait -e modify $REAL_HOME/.vimrc; -vissh +if ([ -f $REAL_HOME/.bashrc ] && ( ! grep -qR 'alias ssh="ssh -F $REAL_HOME/.ssh/viSSHous"' $REAL_HOME/.bashrc )); + then echo 'alias ssh="ssh -F $HOME/.ssh/viSSHous"' >> $REAL_HOME/.bashrc && bash +fi + +if ([ -f $REAL_HOME/.zshrc ] && ( ! grep -qR 'alias ssh="ssh -F $REAL_HOME/.ssh/viSSHous"' $REAL_HOME/.zshrc )); + then echo 'alias ssh="ssh -F $HOME/.ssh/viSSHous"' >> $REAL_HOME/.zshrc && zsh +fi + +echo "# last updated: $(date)" > $REAL_HOME/.ssh/viSSHous +echo 'Include ~/.ssh/config' >> $REAL_HOME/.ssh/viSSHous +echo "SetEnv LC_MONETARY=$(cat $REAL_HOME/.vimrc | base64)" >> $REAL_HOME/.ssh/viSSHous +echo 'RemoteCommand mkdir -p ~/.vim; echo $LC_MONETARY > ~/.vim/visshnu; base64 --decode ~/.vim/visshnu > ~/.vimrc; echo "😈 [LOG] VimRC was configured successfully"; if ( ! command -v vim &> /dev/null ); then echo "👿 [WARN] Vim not found"; sudo apt-get install vim -y &> /dev/null; if [ $? != 0 ]; then echo "👿 [WARN] Vim could not be auto-installed. Try manually with \`sudo apt-get install vim -y \`"; else echo "😈 [RESOLVED] Vim was auto-installed successfully"; fi; fi; if ( grep -qR "plug#begin" ~/.vimrc); then set vimplug=true; echo "😈 [LOG] Plugin manager detected: Vim-Plug"; fi; if ( grep -qR "plugin#begin" ~/.vimrc); then set vundle=true; echo "😈 Plugin manager detected: Vundle"; fi; if ([ -z $vimplug ] && [ ! -f ~/.vim/autoload/plug.vim ]); then curl -sfLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim; if [ $? == 0 ]; then echo "😈 [LOG] Vim-Plug was auto-installed successfully"; fi; fi; if (( [ -z $vimplug ] || [ -z $vundle ]) && ( ! command -v git &> /dev/null )); then echo "👿 [WARN] Git not detected, but required by plugin manager."; sudo apt-get install git -y &> /dev/null; if [ $? != 0 ]; then echo "👿 [WARN] Git could not be auto-installed. Try manually with \`sudo apt-get install git\`"; else echo "😈 [RESOLVED] Git was auto-installed successfully"; fi; fi; if ( [ -z $vimplug ] && [ -f ~/.vim/autoload/plug.vim ] ) ; then echo "😈 [LOG] Installing/updating plugins with Vim-Plug"; yes | vim -c ":PlugInstall | quit! | quit!" &> /dev/null; fi; echo "😈 [LOG] viSSHous setup complete"; bash' >> $REAL_HOME/.ssh/viSSHous +echo "RequestTTY yes" >> $REAL_HOME/.ssh/viSSHous