Index

dotfiles / fe61ce7

My personal dotfiles for Debian/Ubuntu.

Latest Commit

{#}TimeHashSubjectAuthor#(+)(-)GPG?
4214 Oct 2021 07:31fe61ce7Add .xsessionrc for laptopJosh Stockin170G

Blob @ dotfiles / install.sh

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