Index

dotfiles / 55e4e04

My personal dotfiles for Debian/Ubuntu.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
4629 May 2022 21:0198d98a1Add .xonsh_aliasesJosh Stockin120G

Blob @ dotfiles / install.sh

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