-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·102 lines (82 loc) · 2.57 KB
/
bootstrap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
########## Output config ##########
RED='\033[0;31m'
GREEN='\033[0;32m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
BOLD=$(tput bold)
NORM=$(tput sgr0)
# Variable to use for DryRun if requested by command line
D=''
#Var for differentiate logs from dryruns
_echo="echo -e ${GREEN}[DEBUG]${NC}"
#Prints the usage of the script
function usage()
{
echo "Usage:"
echo " bootstrap.sh [options]\n"
echo " Install and configure app for an amazing workflow :D"
echo "Options:"
echo " -h Display this help message"
echo " -i Install i3, its config files and dependencies"
echo " -d DryRun is on (one will see every command w/o running it)"
}
#Install packages coming from parameter
function install_bins()
{
$_echo "Packages to be installed:" "$@"
$D sudo pacman -Sy --needed "$@"
}
function copy_config_files()
{
$D mkdir -p ~/.config/alacritty
$D mkdir -p ~/.config/ranger
$D mkdir -p ~/.config/qtile
$D cp -av ~/dotfiles/config/ranger/* ~/.config/ranger/
$D cp -av ~/dotfiles/config/alacritty/* ~/.config/alacritty/
$D cp -av ~/dotfiles/config/qtile/* ~/.config/qtile/
}
############## All functions are defined above this line #######################
hardcoded_bins="bat gitgui fish neovim exa ranger qutebrowser"
bins_to_install=$hardcoded_bins
# Parsing arguments
while getopts ":hd" opt; do
case ${opt} in
h) # process option h
usage
exit 0
;;
d) # process option d
$_echo "DryRun is activated!"
D="echo -e ${BLUE}Command:${NC}"
;;
\?)
echo "Invalid option -$OPTARG"
usage
exit 1
;;
esac
done
shift $((OPTIND -1))
if ! install_bins "$bins_to_install"; then
$_echo "Installation did not proceed well! Aborting..."
exit 1
fi
if ! copy_config_files; then
$_echo "Config copying did not proceed well! Aborting..."
exit 1
fi
# Configure nvim
$D mkdir -p ~/.config/nvim
$D cp -av ~/dotfiles/config/init.vim ~/.config/nvim/
#Configure Fish
cp -rv ~/dotfiles/config/fish/functions/* ~/.config/fish/functions/
cp -v ~/dotfiles/paiusco.fish ~/.config/fish/config.fish
# Vim-plug installation
$D sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
#Starship installation
$D sh -c "$(curl -fsSL https://starship.rs/install.sh)"
$D printf "\neval \"\$(starship init bash)\"" >> ~/.bashrc
echo -e "${RED}${BOLD}DO NOT FORGET: Add user.name and user.email on git \
config!${NC}${NORM}"