Skip to content

Commit

Permalink
init.sh: Update README and init.sh
Browse files Browse the repository at this point in the history
- Do not setup ssh key in init.sh, instead, configure them manually as described in the README
  • Loading branch information
kang8 committed Dec 18, 2024
1 parent b1c81c1 commit 39272a7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 45 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# Kang's dotfiles

## 1. clone this repo
## 1. Generating a new SSH key and adding it to the ssh-agent

```bash
ssh-keygen -a 256 -t ed25519 -C "comment"

/usr/bin/ssh-add --apple-use-keychain ~/.ssh/id_ed25519
```

## 2. clone this repo

```bash
git clone --recurse-submodules --depth=1 https://github.com/kang8/.dotfiles.git
```

## 2. Install Homebrew first, and use `brew bundle` to install all dependencies from the [Brewfile](./Brewfile)
## 3. Install Homebrew first, and use `brew bundle` to install all dependencies from the [Brewfile](./Brewfile)

```bash
# From: https://brew.sh/
Expand All @@ -18,7 +26,7 @@ eval "$(/opt/homebrew/bin/brew shellenv)"
brew bundle
```

## 3. Run init.sh, follow the prompts to complete the setup.
## 4. Run init.sh, follow the prompts to complete the setup.

```bash
./init.sh
Expand Down
50 changes: 8 additions & 42 deletions init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ cp .env.example .env
########
echo "stow begging!!!"

stow_exclude=('~/' 'ibus-rime/' 'sublime-text/' 'wakatime/' 'gnupg/' 'raycast-script/')
stow_exclude=('~/' 'ibus-rime/' 'sublime-text/' 'wakatime/' 'gnupg/' 'raycast-script/' 'tampermonkey-scripts')

for i in `ls -d */`; do
printf "%s\n" "${stow_exclude[@]}" | grep -x -q "$i" ||
Expand All @@ -20,27 +20,6 @@ done

zsh ~/.zshrc

########
# ssh key
########
is_missing_ssh=false
for i in $HOME/.ssh/id_ed25519{,.pub}; do
if [[ ! -f $i ]]; then
echo "$i is missing!"
is_missing_ssh=true
fi
done

if [[ $is_missing_ssh == "true" ]]; then
read -rp "Can't found ssh key, Do your want to generate a new SSH key? [y|N] " is_generate
if [[ -n $is_generate && ($is_generate == "Y" || $is_generate == 'y') ]]; then
read -rp "Please input SSH key common: " ssh_common
echo -ne "\n\n\n" | ssh-keygen -t ed25519 -C "$ssh_common"
fi
fi

# TODO: test `ssh -T [email protected]` if not through to set ssh key to github.

########
# ZSH
########
Expand Down Expand Up @@ -102,10 +81,9 @@ else
git clone --depth=1 https://github.com/z-shell/F-Sy-H.git $ZSH_CUSTOM/plugins/F-Sy-H
fi

########
# neovim
########
######## neovim ######## echo "\n"
echo "neovim begging!!!"
echo "\n"
if [[ -d ~/.config/nvim ]];then
echo "~/.config/nvim is already installed."
else
Expand All @@ -115,29 +93,17 @@ fi
########
# gpg
########
echo "\n"
echo "gpg begging!!!"
echo "\n"

# create ~/.gnupg/
gpg -k

if [[ -d ~/.config/kang-gpg ]]; then
echo "~/.config/kang-gpg is already installed."
if [[ -d ~/kang/gpg-key-ring ]]; then
echo "~/kang/gpg-key-ring is already installed."
else
git clone --depth=1 [email protected]:kang8/gpg-key-ring.git ~/.config/kang-gpg
git clone --depth=1 [email protected]:kang8/gpg-key-ring.git ~/kang/gpg-key-ring
fi

stow gnupg

if [[ -z `gpg -K` ]]; then
(cd ~/.config/kang-gpg && gpg --import sign-sub.gpg)

expect <(printf "\
spawn gpg --expert --edit-key 9B18672C5BAD8159F5A76234CA67CB5DBBA86E4D
send \"trust\r5\ry\rq\r\"
interact
")
fi

# setdown

( cd ~/.dotfiles && git remote set-url origin [email protected]:kang8/.dotfiles.git )

0 comments on commit 39272a7

Please sign in to comment.