-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_install.sh
executable file
·49 lines (43 loc) · 1.6 KB
/
build_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
#!/bin/bash
# ------------------------------------------------------------------------------
# Variables
# ------------------------------------------------------------------------------
BUILD_DIR=/tmp/control_plugin
# ------------------------------------------------------------------------------
# Fonctions
# ------------------------------------------------------------------------------
function on_error {
echo -e "\033[91m[!] $@\033[0m"
exit 1
}
function notify {
echo -e "\033[96m[+] $@\033[0m"
}
function on_warning {
echo -e "\033[93m[?] $@\033[0m"
}
function item {
echo -e "\033[95m '-> $@\033[0m"
}
# ------------------------------------------------------------------------------
# Main
# ------------------------------------------------------------------------------
if [ ! $(id -u) -eq 0 ]; then
on_error "Vous devez être super utilisateur pour éxécuter ce script"
fi
notify "Déploiement du script deploy_r10k_env.sh"
sudo cp ${BUILD_DIR}/deploy_r10k_env.sh /usr/local/bin
notify "Application des droits et permissions sur /usr/local/bin/deploy_r10k_env.sh"
sudo chmod +x /usr/local/bin/deploy_r10k_env.sh
notify "Arrêt du service"
sudo systemctl stop httpd
sudo systemctl stop foreman-proxy.service
notify "Désinstallation du greffon"
scl enable tfm "gem uninstall --ignore-dependencies control_plugin"
notify "Construction du greffon"
gem build ${BUILD_DIR}/control_plugin.gemspec
notify "Installation du greffon"
scl enable tfm "gem install --ignore-dependencies ${BUILD_DIR}/control_plugin-1.0.0.gem"
notify "Démarrage du service"
sudo systemctl start foreman-proxy.service
sudo systemctl start httpd