Index

dotfiles / a50a328

My personal dotfiles for Debian/Ubuntu.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
3003 Oct 2021 19:24a50a328Dotfiles updatesJosh Stockin15539G

Blob @ dotfiles / install.sh

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