-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap
More file actions
executable file
·157 lines (122 loc) · 3.76 KB
/
bootstrap
File metadata and controls
executable file
·157 lines (122 loc) · 3.76 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/bin/sh
backupdir=$(mktemp -d "/tmp/ach-install.XXXX")
backupfile() {
if [ -e "$1" ] && [ ! -L "$1" ]
then
mv "$1" "$backupdir/$(basename "$1")"
fi
}
common() {
echo "Running common setup"
mkdir -p ~/.config
mkdir -p ~/.local/bin
mkdir -p ~/.local/share/applications
# btop annoyingly modifies its config file every time
mkdir -p ~/.config/btop/themes
backupfile "$HOME/.bashrc"
backupfile "$HOME/.bash_logout"
backupfile "$HOME/.bash_profile"
stow -v -R -t "$HOME" -d "$HOME/dotfiles/common" link
}
macos() {
echo "I want to run -> curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash"
printf "Are you sure? [y/n] "
read -r ans
if [ "$ans" = "y" ]
then
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash
else
echo "skipping homebrew installation"
fi
# links
mkdir -p ~/.config/karabiner
stow -v -R -t "$HOME" -d "$HOME/dotfiles/macos" link
# us-altgr-intl for macos
sudo -k mkdir -p "/Library/Keyboard Layouts"
kbpath="$PWD/macos/kblayout/us-intl-altgr-dead.bundle"
sudo -k cp -r "$kbpath" "/Library/Keyboard Layouts/"
echo "keyboard okidoki"
# defaults
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock mru-spaces -bool false
defaults write -g InitialKeyRepeat -int 20
defaults write -g KeyRepeat -int 2
defaults write com.apple.finder ShowPathbar -int 1
defaults write com.apple.menuextra.clock "DateFormat" -string "EEE d MMM HH:mm"
killall Dock
echo "dock okidoki"
# terminfo
mkdir -p ~/.terminfo
for file in "$HOME/dotfiles/macos/terminfo"/*.terminfo
do
tic -x -o ~/.terminfo "$file"
done
echo "terminfo okidoki"
# brewfile should go here sometime
}
archlinux() {
# first install deps
if ! command -V stow > /dev/null 2>&1
then
echo "Installing stow"
sudo -k pacman -S stow
fi
common
stow -v -R -t "$HOME" -d "$HOME/dotfiles/arch" link
# pacman official
echo "Installing arch packages"
# shellcheck disable=SC2024
sudo pacman -S --needed - < "$HOME/dotfiles/arch/pacman/official"
# need rust to build paru
rustup default stable
if ! command -V paru > /dev/null 2>&1
then
cd /tmp || return
rm -rf paru paru.tar.gz
wget "https://aur.archlinux.org/cgit/aur.git/snapshot/paru.tar.gz"
tar zxvf paru.tar.gz
cd paru || return
makepkg -si
fi
cd "$HOME/dotfiles" || return
echo "Paru installed"
echo "Going now with paru packages"
paru -S --needed - < "$HOME/dotfiles/arch/pacman/aur"
# install dwm
cd /tmp || return
rm -rf /tmp/dwm
git clone https://github.com/anachronic/dwm.git
cd dwm || return
echo "Installing dwm"
sudo -k make clean install
# install dmenu
cd /tmp || return
rm -rf /tmp/dmenu
git clone https://github.com/anachronic/dmenu.git
cd dmenu || return
echo "Installing dmenu"
sudo -k make clean install
# install st
cd /tmp || return
rm -rf /tmp/st
git clone https://github.com/anachronic/st.git
cd st || return
echo "Installing st"
sudo -k make clean install
# go back to dotfiles
cd "$HOME/dotfiles" || return
# make all user dirs so that xdg-user-dirs stop annoying us
mkdir -p "$HOME/desktop" "$HOME/downloads" "$HOME/templates" "$HOME/public" "$HOME/documents" "$HOME/music" "$HOME/pictures" "$HOME/videos"
}
sysname=$(uname)
if [ "$sysname" = "Linux" ]
then
echo Installing archlinux module
archlinux
fi
if [ "$sysname" = "Darwin" ]
then
echo Installing macOS module
macos
fi
echo "Done. Backed up files can be checked in $backupdir"