-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbootstraper.sh
executable file
·97 lines (63 loc) · 1.75 KB
/
bootstraper.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
#!/bin/bash
echo "-------> Determining package manager"
PACKAGE_MANAGER=""
if [ -x "$(command -v apt-get)" ] ; then
PACKAGE_MANAGER="apt"
fi
if [ -x "$(command -v pacman)" ] ; then
PACKAGE_MANAGER="pacman"
fi
if [ -z "$PACKAGE_MANAGER" ] ; then
echo "Unable to find package manager"
exit 1
fi
echo " PACKAGE MANAGER: $PACKAGE_MANAGER"
echo "-------> Checking for sudo access"
if [ ! -x "$(command -v sudo)" ] ; then
echo "sudo not found"
exit 1
fi
echo " Asking for sudo rights"
sudo -v || exit 1
echo " OK"
echo "-------> Installing git"
if [ ! -x "$(command -v git)" ] ; then
if [ "$PACKAGE_MANAGER" == "apt" ] ; then
sudo apt-get install git
else
sudo pacman -S git
fi
fi
if [ ! -x "$(command -v git)" ] ; then
echo "Fail to install git"
exit 1
fi
echo "-------> Creating base path"
mkdir -p $HOME/Documents/perso/
echo "-------> Checking for ssh key"
if [ ! -f $HOME/.ssh/id_rsa ] ; then
echo " Unable to find ssh key"
exit 1
fi
echo "-------> Cloning repo"
cd $HOME/Documents/perso
if [ ! -d $HOME/Documents/perso/dotfiles ] ; then
git clone git@github.com:johnsudaar/dotfiles.git
fi
if [ ! -d $HOME/Documents/perso/dotfiles ] ; then
echo " Fail to clone repo"
exit 1
fi
echo "-------> Loading base libraries"
DOTFILES_HOME=$HOME/Documents/perso/dotfiles/
source $DOTFILES_HOME/libraries/bootstrap.sh
load $DOTFILES_HOME/libraries
success "Bootstraping complete"
info "Launching package script"
$DOTFILES_HOME/packages/installer.sh $PACKAGE_MANAGER
failFast $? "Fail to install packages"
info "Launching custom scripts"
$DOTFILES_HOME/custom/installer.sh
failFast $? "Fail to run custom scripts"
info "Launching dotfiles script"
$DOTFILES_HOME/dotfiles/installer.sh $HOME