1 | #!/bin/bash |
2 |
|
3 | HELPTEXT="./install.sh <desktop|laptop|headless>" |
4 | case $1 in |
5 | h|help|\?|-h|-help|-\?|--h|--help|--\?) |
6 | echo -e $HELPTEXT |
7 | exit 0 |
8 | ;; |
9 | desktop) |
10 | UNIT=DESKTOP |
11 | ;; |
12 | laptop) |
13 | UNIT=LAPTOP |
14 | ;; |
15 | headless) |
16 | UNIT=HEADLESS |
17 | ;; |
18 | *) |
19 | echo -e $HELPTEXT |
20 | exit 0 |
21 | ;; |
22 | esac |
23 |
|
24 | category(){ |
25 | echo -e " \e[1;37m$1\e[0m" |
26 | } |
27 |
|
28 | item(){ |
29 | echo -e " \e[0m$1\e[0m" |
30 | } |
31 |
|
32 | echo -e " \e[1;33mInstall type \e[1;35m$UNIT\e[0m" |
33 |
|
34 | SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)" |
35 |
|
36 | # Bash config |
37 | category "Bash config" |
38 | item "~/.bash_aliases" |
39 | install $SCRIPT_DIR/.bash_aliases $HOME/.bash_aliases |
40 | item "~/.bashrc" |
41 | install $SCRIPT_DIR/.bashrc $HOME/.bashrc |
42 | item "~/.profile" |
43 | install $SCRIPT_DIR/.profile $HOME/.profile |
44 |
|
45 | category "Common folders" |
46 | item "~/src/" |
47 | SRCFOLDER=$HOME/src |
48 | mkdir -p $SRCFOLDER |
49 | item "~/.local/bin/" |
50 | LOCALBIN=$HOME/.local/bin |
51 | mkdir -p $LOCALBIN |
52 |
|
53 | # Local scripts |
54 | category "Local scripts" |
55 | if [ $UNIT == "DESKTOP" ]; then |
56 | item "~/.local/bin/middle-mouse-scroll" |
57 | install $SCRIPT_DIR/middle-mouse-scroll $LOCALBIN/middle-mouse-scroll |
58 | fi |
59 | item "~/.local/bin/minesweeper" |
60 | if ! command -v minesweeper &> /dev/null |
61 | then |
62 | git clone --depth=1 git://joshstock.in/ncurses-minesweeper.git $SRCFOLDER/ncurses-minesweeper |
63 | cd $SRCFOLDER/ncurses-minesweeper |
64 | make compile build |
65 | install bin/minesweeper $LOCALBIN/minesweeper |
66 | rm -rf $SRCFOLDER/ncurses-minesweeper |
67 | cd $SCRIPT_DIR |
68 | fi |
69 |
|
70 | if [ $UNIT == "DESKTOP" ] || [ $UNIT == "LAPTOP" ]; then |
71 | # GTK config |
72 | category "GTK config" |
73 |
|
74 | GTKDIR=$HOME/.config/gtk-3.0 |
75 | item "~/.config/gtk-3.0/" |
76 | mkdir -p $GTKDIR |
77 |
|
78 | item "~/.config/gtk-3.0/gtk.css" |
79 | install $SCRIPT_DIR/gtk.css $GTKDIR/gtk.css |
80 |
|
81 | item "Terminal theme 'Oceanic Next'" |
82 | $SCRIPT_DIR/terminal_theme.sh $1 &>/dev/null |
83 |
|
84 | # Fonts |
85 | category "Fonts" |
86 |
|
87 | item "~/.fonts/" |
88 | FONTDIR=$HOME/.fonts |
89 | mkdir -p $FONTDIR |
90 |
|
91 | item "Fira Sans pack" |
92 | if [ ! -f $FONTDIR/FiraSans-Regular.ttf ]; then |
93 | curl -fLso /tmp/Fira.zip https://fonts.google.com/download?family=Fira%20Sans |
94 | unzip -q /tmp/Fira.zip -d $FONTDIR |
95 | fi |
96 |
|
97 | item "Fira Mono (Powerline-patched) pack" |
98 | if [ ! -f $FONTDIR/FuraMono-Regular\ Powerline.otf ]; then |
99 | curl -fLso $FONTDIR/FuraMono-Regular\ Powerline.otf https://github.com/powerline/fonts/raw/master/FiraMono/FuraMono-Regular%20Powerline.otf |
100 | fi |
101 | if [ ! -f $FONTDIR/FuraMono-Medium.otf ]; then |
102 | curl -fLso $FONTDIR/FuraMono-Medium\ Powerline.otf https://github.com/powerline/fonts/raw/master/FiraMono/FuraMono-Medium%20Powerline.otf |
103 | fi |
104 | if [ ! -f $FONTDIR/FuraMono-Bold.otf ]; then |
105 | curl -fLso $FONTDIR/FuraMono-Bold\ Powerline.otf https://github.com/powerline/fonts/raw/master/FiraMono/FuraMono-Bold%20Powerline.otf |
106 | fi |
107 |
|
108 | item "Refreshing font cache" |
109 | fc-cache |
110 | fi |
111 |
|
112 | # Global git config |
113 | category "Global git config" |
114 |
|
115 | item "~/.gitconfig" |
116 | install $SCRIPT_DIR/.gitconfig $HOME/.gitconfig |
117 |
|
118 | # Vim |
119 | category "Vim config" |
120 |
|
121 | item "~/.vim/" |
122 | VIMDIR=$HOME/.vim |
123 | mkdir -p $VIMDIR |
124 |
|
125 | item "~/.vim/vimrc" |
126 | if [ $UNIT == "HEADLESS" ]; then |
127 | grep -v "RMHEADLESS" vimrc > $VIMDIR/vimrc |
128 | else |
129 | install $SCRIPT_DIR/vimrc $VIMDIR/vimrc |
130 | fi |
131 |
|
132 | item "~/.vim/autoload/plug.vim" |
133 | curl -fLso $VIMDIR/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim |
134 |
|
135 | # Done |
136 | echo -e " \e[1;33mDONE\e[0m" |
137 |
|