-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall
executable file
·72 lines (57 loc) · 1.73 KB
/
install
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
#! /usr/bin/env bash
set -euo pipefail
bad_usage() {
echo "USAGE: ${0} COMMAND" >&2
echo 'Available commands:' >&2
echo ' dotfiles' >&2
echo ' lite-de' >&2
exit 1
}
if [[ ${#@} -eq 0 ]]; then
bad_usage
fi
for arg in "${@}"; do
case $arg in
'dotfiles')
start_pwd="$PWD"
\cd "$(dirname "$0")"
for dotfilename in bashrc emacs gitconfig screenrc vimrc zshrc tmux.conf; do
srcname="$PWD/$dotfilename"
dstname="$HOME/.$dotfilename"
if [[ -f "$dstname" && ! -h "$dstname" ]]; then
echo "Move $dstname -> $dstname.backup.$(date +%F)"
mv -- "$dstname" "$dstname.backup.$(date +%F)"
fi
echo "Symlink $srcname -> $dstname"
ln -sf -- "$srcname" "$dstname"
done
if [[ ! -e $HOME/.bash_profile ]]; then
echo "source .bashrc" > "$HOME/.bash_profile"
fi
# Neovim
mkdir -p "$HOME/.config/nvim"
ln -sf "$PWD/vimrc" "$HOME/.config/nvim/init.vim"
\cd "$start_pwd"
;;
'lite-de')
start_pwd="$PWD"
\cd "$(dirname "$0")/lite-de"
./install-debian-essentials
./install-x11-base
./install-x11-openbox
./install-x11-dwm
./install-x11-essentials
cp xinitrc "$HOME/.xinitrc"
mkdir "$HOME/bin"
cp home-bin/* "$HOME/bin"
\cd "$start_pwd"
;;
'-h'|'-help'|'--help')
bad_usage
;;
*)
echo "Unknown command: ${arg}" >&2
exit 1
;;
esac
done