-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·82 lines (69 loc) · 1.85 KB
/
setup.sh
File metadata and controls
executable file
·82 lines (69 loc) · 1.85 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
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env bash
dir=$(pwd)
# It's way too difficult to handle edge cases where you end up putting things
# within symlinks, so it's easier to just create a new directory for each
# backup date.
backupdir=$(pwd)/../dotfiles.bak/$(date "+%Y-%m-%d_%H-%M.%S")
mkdir -p $backupdir
function symlink() {
local src="$1"
local tgt="$2"
if [[ -f $tgt ]] || [[ -d $tgt ]]; then
mv $tgt $backupdir/$(basename "$tgt")
fi
ln -s -f -n "$src" "$tgt"
}
function install_pipx() {
echo "Installing pipx"
python3 -m pip install --user pipx
python3 -m pipx ensurepath
}
function install_config_files() {
files="bashrc inputrc vimrc vim bashrc.d gitconfig gitignore irssi tmux.conf latexmkrc muttrc"
echo "Moving any existing dotfiles from - to $olddir"
for file in $files; do
echo "Creating symlink to $file in home directory."
symlink $dir/$file ~/.$file
done
echo "Copying i3 configs"
mkdir -p ~/.config/{i3,i3status}
symlink $dir/i3/config ~/.config/i3/config
symlink $dir/i3status/config ~/.config/i3status/config
}
function install_bin() {
echo "Setting up .local/bin"
mkdir -p ~/.local/bin
symlink $dir/local/bin ~/.local/bin/dotfiles
}
function install_fonts() {
if [[ $OSTYPE =~ darwin* ]]; then
echo "iTerm2 supports powerline fonts natively"
echo "iTerm2 > Preferences > Profiles > Text > Use built-in Powerline glyphs"
else
echo "Setting up powerline fonts"
cd $(mktemp -d)
git clone https://github.com/powerline/fonts.git --depth=1
cd fonts
./install.sh
cd -
fi
}
function install() {
echo "This script may have imperfect backups. Do you wish to continue?"
select yn in "Yes" "No"; do
case $yn in
Yes)
echo "Backup directory: $backupdir"
install_pipx
install_config_files
install_bin
install_fonts
;;
*)
echo "Exiting..."
;;
esac
break
done
}
install