Index

dotfiles / 2d5205a

My personal dotfiles for Debian/Ubuntu.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
5805 Jan 2023 10:421b1342cUpdate mouse scrolling method, add reset scriptJosh Stockin131G

Blob @ dotfiles / install.sh

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