-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·70 lines (60 loc) · 2.41 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·70 lines (60 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
set -euo pipefail
# ── Install mise ──────────────────────────────────────────────────────────────
if ! command -v mise &>/dev/null; then
echo "Installing mise..."
curl -fsSL https://mise.run | sh
export PATH="$HOME/.local/bin:$PATH"
else
echo "mise: already installed"
fi
# ── Clone dotfiles ────────────────────────────────────────────────────────────
DOTFILE_DIR="$HOME/ghq/github.com/miyakoshi-3854/dotfiles"
if [ ! -d "$DOTFILE_DIR" ]; then
echo "Cloning dotfiles..."
mkdir -p "$(dirname "$DOTFILE_DIR")"
git clone "https://github.com/miyakoshi-3854/dotfiles.git" "$DOTFILE_DIR"
else
echo "dotfiles: already cloned"
fi
cd "$DOTFILE_DIR"
# ── Symlinks ──────────────────────────────────────────────────────────────────
link() {
local src="$DOTFILE_DIR/$1"
local dest="$HOME/$1"
mkdir -p "$(dirname "$dest")"
if [ -e "$dest" ] && [ ! -L "$dest" ]; then
local backup="$dest.bak.$(date +%Y%m%d%H%M%S)"
mv "$dest" "$backup"
echo "backup: $backup"
fi
ln -sfn "$src" "$dest"
echo "linked: $dest"
}
link .zshenv
link .zshrc
link .config/git/config
link .config/gh/config.yml
link .config/mise/config.toml
link .config/gwq/config.toml
link .config/starship/config.toml
# ── Git identity ──────────────────────────────────────────────────────────────
GIT_LOCAL_CONFIG="$HOME/.config/git/config.local"
if [ ! -e "$GIT_LOCAL_CONFIG" ]; then
echo ""
read -rp "Git user.name: " git_user_name
read -rp "Git user.email: " git_user_email
cat >"$GIT_LOCAL_CONFIG" <<EOF
[user]
name = $git_user_name
email = $git_user_email
EOF
echo "created: $GIT_LOCAL_CONFIG"
else
echo "Git identity: already configured"
fi
# ── mise install ──────────────────────────────────────────────────────────────
echo "Running mise install..."
mise install
echo ""
echo "Done!"