-
Notifications
You must be signed in to change notification settings - Fork 1
/
updates.sh
executable file
·154 lines (119 loc) · 3.38 KB
/
updates.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash
#######################################
# Bash script to update apps on a new system (Ubuntu)
# Written by @PauloLopes
#######################################
execut_ansible () {
if [ -e ~/.npmrc ]
then
rm -rf ~/.npmrc
fi
if [ -e ~/.curlrc ]
then
rm -rf ~/.curlrc
fi
if [ -e ~/.curlrc ]
then
rm -rf ~/.curlrc
fi
echo "###Remove Intellij"
rm -rf ~/.idea/
echo "###Remove Intellij"
rm -rf ~/development/ide/
echo "###Remove java"
rm -rf ~/development/java/
echo "###Remove kitematic"
rm -rf ~/development/kitematic/
echo "###Remove maven"
rm -rf ~/development/maven/
echo "###Remove sqlDeveloper"
rm -rf ~/development/sqlDeveloper/
echo "###Remove tomcat"
rm -rf ~/development/tomcat/
echo "###Remove tomcat"
rm -rf ~/.cache/vmware
echo "###Sqldeveloper.desktop"
rm -rf /usr/share/applications/sqldeveloper.desktop
echo "###Sqldeveloper.desktop"
rm -rf /usr/share/applications/sqldeveloper.desktop
echo "###ReInit to install your desktop"
ansible-playbook playbook.yml --connection=local -become-method=sudo --extra-vars "ansible_sudo_pass=secret"
exit 1
}
#!/bin/bash
#######################################
# Bash script to install apps on a new system (Ubuntu)
# Written by @PauloLopes
#######################################
execut_jeap () {
echo '###Start jeap_ansible'
if [ -d .git ]; then
echo '###Update Project'
git fetch --all
git pull
git reset --hard origin/master
if [ $? = 0 ] ; then
echo '###Excute ansible ...'
execut_ansible
else
echo "Git failed. Contact Your System Administrator"
fi
else
execut_ansible
fi;
}
configure_git() {
# Check if .gitconfig existe
if ! [ -e ~/.gitconfig ]
then
echo '###Congigure Git..'
echo "Enter the Global Username for Git:";
read GITUSER;
git config --global user.name "${GITUSER}"
echo "Enter the Global Email for Git:";
read GITEMAIL;
git config --global user.email "${GITEMAIL}"
else
echo 'git alreedy configuraded'
fi
}
install_and_configure_git() {
# Check if git is installed
if [ -x "$(command -v git)" ]; then
echo '###Installing Git..'
sudo apt-get install git -y
configure_git
else
configure_git
fi
echo '###Git is installed and configured'
}
install_and_configure_ansible () {
echo '###Installing software-properties-common ...'
sudo apt-get install software-properties-common
echo '###Installing ppa:ansible ...'
sudo apt-add-repository ppa:ansible/ansible
echo '###Installing update ...'
sudo apt-get update
echo '###Installing ansible ...'
sudo apt-get install ansible
echo '###Installing curl ...'
sudo apt-get install curl
echo '###Installing configure ansible module ...'
mkdir -p /home/dev/.ansible/plugins/modules
echo '###Installing gsetting on ansible module ...'
sudo curl https://raw.githubusercontent.com/jistr/ansible-gsetting/master/gsetting.py > /home/dev/.ansible/plugins/modules/gsetting
}
#Check if ansible exit
if [ -x "$(command -v ansible)" ]; then
echo '###Cool ! Ansible work ... We can start'
install_and_configure_git
execut_jeap
exit 1
else
echo 'Ready:ansible is installed.' >&2
install_and_configure_ansible
install_and_configure_git
execut_jeap
exit 1
fi