-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·68 lines (54 loc) · 2.39 KB
/
install.sh
File metadata and controls
executable file
·68 lines (54 loc) · 2.39 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
#!/bin/bash
# WARNING: This script sets up configuration files by creating symlinks and backing up existing ones.
# Usage: Run this script to automatically configure your environment.
# Get the absolute path to the directory containing this script
DOTFILES_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Ensure ~/.config directory exists
mkdir -p "$HOME/.config"
###################################################################################################
## Install starship configuration
# Backup any existing starship config
if [ -e "$HOME/.config/starship.toml" ]; then
timestamp=$(date +%Y%m%d%H%M%S)
backup_file="$HOME/.config/starship.toml.backup.$timestamp"
mv "$HOME/.config/starship.toml" "$backup_file"
fi
# Create new symlink
ln -sf "$DOTFILES_DIR/starship/starship.toml" "$HOME/.config/starship.toml"
###################################################################################################
## Install bash configuration
# Backup any existing bash config and create new symlinks
for file in "$DOTFILES_DIR/bash/."*; do
filename=$(basename "$file")
if [ -e "$HOME/$filename" ]; then
timestamp=$(date +%Y%m%d%H%M%S)
mv "$HOME/$filename" "$HOME/${filename}.backup.$timestamp"
fi
ln -sf "$file" "$HOME/$filename"
done
###################################################################################################
## Install vim configuration
# Backup any existing vim config
if [ -e "$HOME/.vimrc" ]; then
timestamp=$(date +%Y%m%d%H%M%S)
backup_file="$HOME/.vimrc.backup.$timestamp"
mv "$HOME/.vimrc" "$backup_file"
fi
# Create new symlink
ln -sf "$DOTFILES_DIR/vim/.vimrc" "$HOME/.vimrc"
###################################################################################################
## Install git configuration
# Backup any existing git config
for file in "$HOME/.gitconfig"*; do
if [ -e "$file" ]; then
timestamp=$(date +%Y%m%d%H%M%S)
backup_file="${file}.backup.${timestamp}"
mv "$file" "$backup_file"
fi
done
# Create new symlink
ln -sf "$DOTFILES_DIR/git/.gitconfig" "$HOME/.gitconfig"
ln -sf "$DOTFILES_DIR/git/.gitconfig-dampdigits" "$HOME/.gitconfig-dampdigits"
ln -sf "$DOTFILES_DIR/git/.gitconfig-geekygiganerd" "$HOME/.gitconfig-geekygiganerd"
###################################################################################################
# Author: dampdigits <dampdigits@gmail.com>