-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
61 lines (50 loc) · 1.55 KB
/
install.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
#!/bin/bash
# Typo
bold=$(tput bold)
underline=$(tput sgr 0 1)
reset=$(tput sgr0)
rouge=$( tput setaf 1)
vert=$( tput setaf 2)
jaune=$( tput setaf 3)
bleu=$( tput setaf 4)
violet=$( tput setaf 5)
cyan=$( tput setaf 6)
gris=$( tput setaf 7)
# Fonctions
shw_norm () { echo -en "${bold}$(tput setaf 9)${@}${reset}"; }
shw_info () { echo -en "${bold}${cyan}${@}${reset}"; }
shw_OK () { echo -en "${bold}${vert}OK!${@}${reset}"; }
shw_warn () { echo -en "${bold}${violet}${@}${reset}"; }
shw_err () { echo -en "${bold}${rouge}${@}${reset}"; }
gris() { echo -en "${bold}${gris}${@}${reset}"; }
header() { echo -e "${bold}${jaune}$*${reset}"; }
headerU() { echo -e "${underline}${bold}${jaune}$*${reset}"; }
clear && echo -e "\n\n"
header "======================================================="
header "=== Setting up your Raspberry Pi ==="
headerU "=======================================================\n"
if [ $# -eq 0 ]
then
shw_warn "No arguments supplied, please choose the roles to install\n"
shw_warn "exiting...\n"
exit 1
fi
sudo apt update
sudo apt install ansible git -y
installdir="/tmp/pi-$RANDOM"
mkdir $installdir
git clone https://github.com/atao/raspberrypi-setup.git $installdir
if [ ! -d $installdir ]; then
shw_err "git cloned failed\n"
shw_err "exiting...\n"
exit 1
else
cd $installdir
ansible-playbook playbook.yml -i localhost --tags $1
fi
shw_info "cleaning up...\n\n"
rm -Rfv /tmp/$installdir
shw_info "Upgrade packages...\n\n"
sudo apt upgrade -y
shw_OK " Enjoy!\n"
exit 0