-
Notifications
You must be signed in to change notification settings - Fork 3
/
.dotfm.sh
executable file
·49 lines (45 loc) · 933 Bytes
/
.dotfm.sh
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
#!/bin/sh
set -e
GIT=/usr/bin/git
PATH='/bin:/usr/bin'
REPO='[email protected]:oxnz/dot-files.git'
DEST="$HOME/.config/dot-files.git"
main() {
GIT_DIR="$HOME/.config/dot-files.git"
GIT_WORK_TREE="$HOME"
case "$1" in
install)
echo "install"
if test -e "$DEST"; then
echo "$DEST already exists" >&2
exit 1
fi
unset GIT_DIR
if $GIT clone --bare "$REPO" "$DEST"; then
$GIT config --local status.showUntrackedFiles no
else
echo 'clong failed'
exit 1
fi
$GIT switch master
$GIT checkout .vim
$GIT checkout .zshrc
$GIT checkout .bashrc
$GIT checkout .pythonrc
$GIT checkout .config/git
echo 'setup git'
sh .config/git/bin/config
;;
uninst)
echo "[uninst] not implemented yet" >&2
;;
update)
echo "update"
exec $GIT --git-dir="$DEST" --work-tree="$HOME" pull
;;
*)
exec $GIT --git-dir="$DEST" --work-tree="$HOME" $@
;;
esac
}
main "$@"