-
Notifications
You must be signed in to change notification settings - Fork 4
/
install_fd.sh
executable file
·81 lines (66 loc) · 2.47 KB
/
install_fd.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
#!/bin/bash
BAREOS_DIR="/etc/bareos" # Основной каталог
BACULA_DIR="/etc/bacula"
NOW="$(date +%Y%m%d%H%M%S)"
PROXY='HTTP_PROXY=""'
### Создание бэкапа, если каталог bacula уже есть
if [ -d "${BACULA_DIR}" ] ; then
mv "${BACULA_DIR}" "${BACULA_DIR}.bak_${NOW}"
fi
if [ ! -f /etc/issue ] ; then
echo "I not know your distr..."
exit 1
fi
DIST_NAME="$(head -1 /etc/issue | awk '{print $1}')"
DIST_RELEASE="$(head -1 /etc/issue | awk '{print $3}' | awk -F'.' '{print $1}')"
### debian 6,7 && xubuntu 12.04,14.04
___debian() {
# delete bacula-fd
service bacula-fd stop
apt-get purge bacula-fd bacula-common bacula-client
# add the Bareos repository
URL="http://download.bareos.org/bareos/release/latest/${DIST}/"
echo "deb ${URL} /" > /etc/apt/sources.list.d/bareos.list
export PROXY
wget -qO- "${URL}/Release.key" | apt-key add -
# install Bareos packages
apt-get update
apt-get install bareos-filedaemon
}
### centos 5,6,7 && redhat 5,6,7 && redora 20
___centos() {
# delete bacula-fd
service bacula-fd stop
yum remove bacula-client bacula-common
# add the Bareos repository
URL="http://download.bareos.org/bareos/release/latest/${DIST}"
export PROXY
wget -qO "/etc/yum.repos.d/bareos.repo" "${URL}/bareos.repo"
# install Bareos packages
yum install bareos-filedaemon
}
# >>>>> NOT TESTED <<<<< #
### opensuse 11 sp3, 12, 13.1
#___opensuse() {
# # delete bacula-fd
# service bacula-fd stop
# zipper ...
#
# # add the Bareos repository
# URL="http://download.bareos.org/bareos/release/latest/${DIST}"
# export PROXY
# zypper addrepo --refresh "${URL}/bareos.repo"
#
# # install Bareos packages
# zypper install bareos-filedaemon
#}
# какой у нас дистрибутив?
case "${DIST_NAME}" in
"Debian" ) DIST="${DIST_NAME}_${DIST_RELEASE}.0" && ___debian ;; # tested only debian 7
#"xUbuntu" ) DIST="${DIST_NAME}_${DIST_RELEASE}.04" && ___debian ;; # NOT TESTED
"CentOS" ) DIST="${DIST_NAME}_${DIST_RELEASE}" && ___centos ;; # tested only centos 6
#"RHEL" ) DIST="${DIST_NAME}_${DIST_RELEASE}" && ___centos ;; # NOT TESTED
#"Fedora" ) DIST="${DIST_NAME}_${DIST_RELEASE}" && ___centos ;; # NOT TESTED
#"SLE" ) && ___opensuse ;; # NOT TESTED
* ) echo "I not know your distr..." && exit 1 ;;
esac