Index

dotfiles / c12ff91

My personal dotfiles for Debian/Ubuntu.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
3811 Oct 2021 04:06c12ff91Add handling for discovering vim runtime version on headlessJosh Stockin143G

Blob @ dotfiles / install.sh

text/x-shellscript4830 bytesdownload raw
1#!/bin/bash
2
3HELPTEXT="./install.sh <desktop|laptop|headless>"
4case $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 ;;
22esac
23
24category(){
25 echo -e " \e[1;37m$1\e[0m"
26}
27
28item(){
29 echo -e " \e[0m$1\e[0m"
30}
31
32echo -e " \e[1;33mInstall type \e[1;35m$UNIT\e[0m"
33
34SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
35
36# Bash config
37category "Bash config"
38item "~/.bash_aliases"
39install $SCRIPT_DIR/.bash_aliases $HOME/.bash_aliases
40item "~/.bashrc"
41install $SCRIPT_DIR/.bashrc $HOME/.bashrc
42item "~/.profile"
43install $SCRIPT_DIR/.profile $HOME/.profile
44item "~/.todo.cfg"
45install $SCRIPT_DIR/.todo.cfg $HOME/.todo.cfg
46
47category "Common folders"
48item "~/src/"
49SRCFOLDER=$HOME/src
50mkdir -p $SRCFOLDER
51item "~/.local/bin/"
52LOCALBIN=$HOME/.local/bin
53mkdir -p $LOCALBIN
54item "~/.local/share/"
55mkdir -p $HOME/.local/share
56
57# Local scripts
58category "Local scripts"
59if [ $UNIT == "DESKTOP" ] && [ $(whoami) != "root" ]; then
60 item "~/.local/bin/middle-mouse-scroll"
61 install $SCRIPT_DIR/middle-mouse-scroll $LOCALBIN/middle-mouse-scroll
62fi
63
64if ! command -v minesweeper &> /dev/null
65then
66 if [ $(whoami) == "root" ]; then
67 item "/usr/local/bin/minesweeper"
68 else
69 item "~/.local/bin/minesweeper"
70 fi
71 git clone --depth=1 git://joshstock.in/ncurses-minesweeper.git $SRCFOLDER/ncurses-minesweeper
72 cd $SRCFOLDER/ncurses-minesweeper
73 make compile build
74 if [ $(whoami) == "root" ]; then
75 install bin/minesweeper /usr/local/bin/minesweeper
76 else
77 install bin/minesweeper $LOCALBIN/minesweeper
78 fi
79 rm -rf $SRCFOLDER/ncurses-minesweeper
80 cd $SCRIPT_DIR
81fi
82
83if [ $UNIT == "DESKTOP" ] || [ $UNIT == "LAPTOP" ]; then
84 # GTK config
85 category "GTK config"
86
87 GTKDIR=$HOME/.config/gtk-3.0
88 item "~/.config/gtk-3.0/"
89 mkdir -p $GTKDIR
90
91 item "~/.config/gtk-3.0/gtk.css"
92 install $SCRIPT_DIR/gtk.css $GTKDIR/gtk.css
93
94 item "Terminal theme 'Oceanic Next'"
95 $SCRIPT_DIR/terminal_theme.sh $1 &>/dev/null
96
97 if [ $(whoami) == "root" ]; then
98 # Fonts
99 category "Fonts"
100 FONTDIR=/usr/share/fonts
101
102 item "Fira Sans pack"
103 if [ ! -f $FONTDIR/FiraSans-Regular.ttf ]; then
104 curl -fLso /tmp/Fira.zip https://fonts.google.com/download?family=Fira%20Sans
105 unzip -q /tmp/Fira.zip -d $FONTDIR
106 fi
107
108 item "Fira Mono (Nerd Fonts) pack"
109 if [ ! -f $FONTDIR/FiraMono-Regular.otf ]; then
110 curl -fLso $FONTDIR/FiraMono-Regular.otf https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/FiraMono/Regular/complete/Fura%20Mono%20Regular%20Nerd%20Font%20Complete%20Mono.otf
111 fi
112 if [ ! -f $FONTDIR/FiraMono-Medium.otf ]; then
113 curl -fLso $FONTDIR/FiraMono-Medium.otf https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/FiraMono/Medium/complete/Fura%20Mono%20Medium%20Nerd%20Font%20Complete%20Mono.otf
114 fi
115 if [ ! -f $FONTDIR/FiraMono-Bold.otf ]; then
116 curl -fLso $FONTDIR/FiraMono-Bold.otf https://github.com/ryanoasis/nerd-fonts/raw/master/patched-fonts/FiraMono/Bold/complete/Fura%20Mono%20Bold%20Nerd%20Font%20Complete%20Mono.otf
117 fi
118
119 item "Refreshing font cache"
120 fc-cache
121 fi
122fi
123
124# Global git config
125category "Global git config"
126
127if [ $(whoami) == "root" ]; then
128 item "/etc/gitconfig"
129 install $SCRIPT_DIR/.gitconfig /etc/gitconfig
130else
131 item "~/.gitconfig"
132 install $SCRIPT_DIR/.gitconfig $HOME/.gitconfig
133fi
134
135# Vim
136category "Vim config"
137
138if [ $UNIT == "HEADLESS" ]; then
139 if [ $(whoami) == "root" ]; then
140 item "/usr/share/vim/"
141 VIMDIR=/usr/share/vim
142 mkdir -p $VIMDIR
143 item "/usr/share/vim/vimrc"
144 grep -v "RMHEADLESS" vimrc > $SCRIPT_DIR/.vimrc_headless
145 install $SCRIPT_DIR/.vimrc_headless $VIMDIR/vimrc
146 VIMRUNTIME=`vim -e -T dumb --cmd 'exe "set t_cm=\<C-M>"|echo $VIMRUNTIME|quit' | tr -d '\015' `
147 item "$VIMRUNTIME/autoload/plug.vim"
148 if [ ! -f $VIMRUNTIME/autoload/plug.vim ]; then
149 curl -fLso $VIMRUNTIME/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
150 fi
151 fi
152else
153 item "~/.vim/"
154 VIMDIR=$HOME/.vim
155 mkdir -p $VIMDIR
156 item "~/.vim/vimrc"
157 install $SCRIPT_DIR/vimrc $VIMDIR/vimrc
158 item "~/.vim/autoload/plug.vim"
159 if [ ! -f $VIMDIR/autoload/plug.vim ]; then
160 curl -fLso $VIMDIR/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
161 fi
162fi
163
164# Done
165echo -e " \e[1;33mDONE\e[0m"
166