diff --git a/.ssh_config b/.ssh_config deleted file mode 100644 index 11f3dcc..0000000 --- a/.ssh_config +++ /dev/null @@ -1,89 +0,0 @@ -Host * - TCPKeepAlive yes - ServerAliveInterval 10 - ServerAliveCountMax 3 - -#Host jumper - #Hostname jumper.dbkops.com - #User tangli - #IdentityFile ~/.ssh/id_rsa - -Host * - TCPKeepAlive yes - ServerAliveInterval 10 - ServerAliveCountMax 3 - -Host speedy - Hostname speedy.dbkops.com - # Port 22 - Port 2022 - User tangli - IdentityFile ~/.ssh/id_rsa - -Host jumper - ProxyCommand ssh speedy -W %h:%p - Hostname jumper.dbkops.com - User tangli - IdentityFile ~/.ssh/id_rsa - -Host aws-optimus-1 - ProxyCommand ssh jumper -W %h:%p - Hostname 172.21.7.29 - User tangli - IdentityFile ~/.ssh/id_rsa - -Host aws-optimus-2 - ProxyCommand ssh jumper -W %h:%p - Hostname 172.21.9.172 - User tangli - IdentityFile ~/.ssh/id_rsa - -Host centos.htilil - HostName 10.1.4.28 - User root - Port 22 - -Host ubuntu.htilil - HostName 10.1.8.134 - User ubuntu - Port 22 - -Host jumper.htilil - HostName 10.1.4.14 - User tangli - Port 32200 - -Host raspberry.lan - HostName 192.168.2.16 - User d0zingcat - Port 22 - -Host r2s.lan - HostName 192.168.2.1 - User root - Port 30022 - -Host bwh - HostName gt.bwg.d0zingcat.xyz - User d0zingcat - Port 22 - -Host sh.cvm.qcloud - HostName sh.cvm.qcloud.d0zingcat.xyz - User d0zingcat - Port 22 - -Host sh.lh.qcloud - HostName sh.lh.qcloud.d0zingcat.xyz - User d0zingcat - Port 22 - -Host sanjose.oracle - HostName sanjose.oracle.d0zingcat.xyz - User ubuntu - Port 22 - -Host cd2.wangxu - HostName 1.14.72.143 - User gh0stcat - Port 29508 diff --git a/setup.sh b/setup.sh index 8ba6600..4ebfed2 100755 --- a/setup.sh +++ b/setup.sh @@ -26,6 +26,10 @@ CONFIG_FILES=( stylua.toml ) +CUSTOM_FILES=( + "ssh/config .ssh/config" +) + WORKING_DIR=$(pwd) HOME_DIR="$HOME" @@ -73,49 +77,53 @@ k git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.10.0 } function recover() { - OS="$(uname)" + OS="$(uname)" - # Homebrew - if [ ! $(which brew) ]; then - echo "Installing homebrew..." - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - fi - if [ "$OS" = 'Darwin' ]; then - export PATH=/usr/local/bin/:$PATH - elif [ "$OS" = 'Linux' ]; then - export PATH=/home/linuxbrew/.linuxbrew/bin/:$PATH - fi + # Homebrew + if [ ! $(which brew) ]; then + echo "Installing homebrew..." + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + fi + if [ "$OS" = 'Darwin' ]; then + export PATH=/usr/local/bin/:$PATH + elif [ "$OS" = 'Linux' ]; then + export PATH=/home/linuxbrew/.linuxbrew/bin/:$PATH + fi - # antigen - if [ ! -f $HOME/.antigen/antigen.zsh ]; then - mkdir -p $HOME/.antigen/ - curl -L git.io/antigen >$HOME/.antigen/antigen.zsh - fi + # antigen + if [ ! -f $HOME/.antigen/antigen.zsh ]; then + mkdir -p $HOME/.antigen/ + curl -L git.io/antigen >$HOME/.antigen/antigen.zsh + fi mkdir -p $HOME/.kube/ + mkdir $HOME/.ssh # dotfiles - echo "Linking files..." - for i in ${FILES[@]}; do - ln -svfn $WORKING_DIR/$i $HOME_DIR/$i - done + echo "Linking files..." + for i in ${FILES[@]}; do + ln -svfn $WORKING_DIR/$i $HOME_DIR/$i + done - echo "Linking config files..." - for i in ${CONFIG_FILES[@]}; do - ln -svfn $WORKING_DIR/$i $HOME_DIR/.config/$i - done + echo "Linking config files..." + for i in ${CONFIG_FILES[@]}; do + ln -svfn $WORKING_DIR/$i $HOME_DIR/.config/$i + done - echo 'Linking others' - ln -svfn $WORKING_DIR/.ssh_config $HOME_DIR/.ssh/config + echo 'Linking customized files' + for row in ${CUSTOM_FILES[@]}; do + IFS=' ' read -r from to <<< "$row" + ln -svfn $WORKING_DIR/$from $HOME_DIR/$to + done - # submodules - echo 'Syncing Submodules...' - git submodule init - git submodule update --init --recursive - git submodule foreach --recursive git fetch - git submodule foreach git merge origin master + # submodules + echo 'Syncing Submodules...' + git submodule init + git submodule update --init --recursive + git submodule foreach --recursive git fetch + git submodule foreach git merge origin master - # brew bundle + # brew bundle if (( $is_brew_installed )) then echo "Installing by brew..." @@ -131,10 +139,10 @@ function recover() { sudo pacman -S - < pkglist.txt fi - # others - git config --global core.excludesfile ~/.config/git/.gitignore - git config --global init.defaultBranch main - $(brew --prefix)/opt/fzf/install + # others + git config --global core.excludesfile ~/.config/git/.gitignore + git config --global init.defaultBranch main + $(brew --prefix)/opt/fzf/install } function manual_install() {