-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_manjaro.sh
executable file
·105 lines (90 loc) · 2.16 KB
/
setup_manjaro.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
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
#!/bin/bash
DOTFILES=$(cd $(dirname $0); pwd)
EMACSD=$DOTFILES/.emacs.d
ZSH=$DOTFILES/zsh
TMUX=$DOTFILES/tmux
GIT=$DOTFILES/git
MISC=$DOTFILES/misc
EMACS_VER_ENABLED=28.2
M="mkdir"
T="touch"
L="ln"
C="cp"
deploy() {
if [ $1 = $M ]; then
if [ ! -e $2 ]; then
mkdir -p $2
else
echo $2 'is already exists.'
fi
elif [ $1 = $T ]; then
if [ ! -e $2 ]; then
touch $2
else
echo $2 'is already exists.'
fi
elif [ $1 = $L ]; then
if [ ! -e $3 ]; then
ln -s $2 $3
else
echo $3 'is already exists.'
fi
elif [ $1 = $C ]; then
if [ ! -e $3 ]; then
cp $2 $3
else
echo $3 'is already exists.'
fi
fi
}
yay -S tmux emacs bc vim ttf-cica ttf-mplus-git --noconfirm --sudoloop
# Submodules initialization
cd $DOTFILES
git submodule update --init --recursive
cd $ZSH
git submodule update --init --recursive
# Emacs
which emacs > /dev/null
if [ $? = 0 ];then
EMACS_VER=$(emacs --version | awk 'NR == 1 {print $3}' | cut -f1,2 -d.)
if [ $(echo "$EMACS_VER >= $EMACS_VER_ENABLED" | bc) = 1 ]; then
deploy $L $EMACSD $HOME/.emacs.d
deploy $T $EMACSD/.scratch-log
deploy $T $EMACSD/.scratch-log-prev
deploy $M $EMACSD/backup
deploy $M $EMACSD/undo
else
echo 'Required Emacs version ' $EMACS_VER_ENABLED ' or later.'
fi
else
echo 'Emacs is not installed.'
fi
# zsh
echo -n 'Do you want to make .zshrc symbolic link? [y/n]'
read yn
case $yn in
[Yy]* )
cp $HOME/.zshrc $HOME/.zshrc.bk
mv $HOME/.zshrc $HOME/.zshenv
deploy $L $ZSH/.zshrc $HOME/.zshrc
;;
[Nn]* )
;;
esac
deploy $M $HOME/.cache/shell
deploy $L $ZSH/zaw $HOME/.zaw
# Tmux
deploy $L $TMUX/.tmux.conf $HOME/.tmux.conf
# Git
deploy $C $GIT/.gitconfig $HOME/.gitconfig
# bin
deploy $M $HOME/bin
deploy $L $MISC/search.sh $HOME/bin/search
## Vi
deploy $L $DOTFILES/.vimrc $HOME/.vimrc
deploy $M $HOME/.vim_swp
## Misc.
deploy $L $MISC/.inputrc $HOME/.inputrc
deploy $L $MISC/.Xmodmap $HOME/.Xmodmap
echo 'Setup.sh successfully finished.'
exit 0