-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathINSTALL
More file actions
executable file
·120 lines (94 loc) · 2.95 KB
/
INSTALL
File metadata and controls
executable file
·120 lines (94 loc) · 2.95 KB
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
#!/bin/bash
# version
VERSION=6.1
PACKAGES="perl lvm2 kpartx parted ncftp make gcc duplicity curl expat libexpat1 libexpat1-dev"
PERL_MODULES="DateTime AnyEvent AnyEvent::HTTP JSON POSIX XML::Simple List::Util Sys::Syslog Time::Piece Net::OpenSSH Getopt::Long Config::Tiny Twiggy::Server AnyEvent::Util File::Lockfile File::Find::Rule Digest::MD5 Time::HiRes Switch LWP::UserAgent"
TOOLS="perl lvm kpartx ncftp duplicity make parted"
NEW_INSTALL=true
clear
echo "Welcome to Barch ${VERSION}.x Install Tool"
echo ""
echo "Please make sure you have the following packages installed:"
echo " apt-get install / yum install "
echo " $PACKAGES"
echo ""
echo "For Ubuntu users, add the following repository:"
echo " apt-add-repository ppa:duplicity-team/ppa"
echo ""
echo "Press 'N' or CTRL+C to stop or press 'Y' to continue..."
read ANSWER
if [[ $ANSWER =~ ^[Yy]$ ]]
then
for i in $TOOLS; do
if ! which $i > /dev/null; then
echo "$i is required."
exit 2
fi
done
if [ -f /etc/barch/barch ]; then
NEW_INSTALL=false
fi
clear
echo "Barch - LVM Backup Manager"
if ! which cpanm > /dev/null; then
echo "├ cpanm not installed"
echo "│ installing..."
curl -L http://cpanmin.us | perl - --sudo App::cpanminus > /dev/null
else
echo "├ cpanm installed"
fi
echo "├ installing Perl-modules"
for i in $PERL_MODULES; do
echo -n "│ * installing $i"
cpanm $i > /dev/null
if [ $? -ne 0 ]; then
echo " - failed"
echo "Failed to install $i module"
exit 2
else
echo " - done"
fi
done
echo -n "├ creating directories..."
mkdir -p /etc/barch
mkdir -p /usr/local/backup
mkdir -p /var/cache/barch/mounts
mkdir -p /var/lock/barch
echo " done"
echo -n "├ copying files..."
cp -ax barch /etc/barch/
cp -ax monitor.pl /etc/barch/
touch /var/cache/barch/status
echo " done"
echo -n "├ creating symbolic links..."
if [ ! -f /usr/local/bin/barch ]; then
ln -s /etc/barch/barch /usr/local/bin/barch
fi
echo " done"
echo -n "├ copying configuration..."
if [ ! -f /etc/barch/barch.conf ]; then
cp -ax barch.conf /etc/barch/
else
cp -ax barch.conf /etc/barch/barch.conf.NEW
fi
if [ ! -f /etc/barch/custom.conf ]; then
cp -ax custom.conf /etc/barch/
else
cp -ax custom.conf /etc/barch/custom.conf.NEW
fi
cp -ax version /etc/barch
echo " done"
cp -ax init.d/barchd /etc/init.d/barchd
chmod +x /etc/init.d/barchd
echo ""
echo "Installation complete"
if [[ $NEW_INSTALL -eq 'false' ]]; then
echo "A newer version installed. Please verify that you old configuration file is up-to-date."
echo "Use barch.conf.NEW and custom.conf.NEW as an example."
fi
echo ""
else
echo ""
echo "Come back later"
exit 1
fi