forked from calmh/zsnapper.old
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·40 lines (33 loc) · 988 Bytes
/
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
#!/bin/bash
branch="master"
tar="https://codeload.github.com/calmh/zsnapper/tar.gz/$branch"
instdir="/opt/local"
configdir="/opt/local/etc"
configfile="zsnapper.ini"
config="$configdir/$configfile"
smf="/opt/custom/smf/zsnapper.xml"
fail() {
echo Installation failed
exit -1
}
echo "Installing into $instdir/zsnapper."
mkdir -p $instdir
cd "$instdir" || fail
[ -d zsnapper.previous ] && rm -rf zsnapper.previous
[ -d zsnapper ] && mv zsnapper zsnapper.previous
( curl -sk "$tar" | gtar zxf - ) || fail
mv "zsnapper-$branch" zsnapper || fail
if [ ! -f "$config" ] ; then
echo "No config file, installing default into $config."
mkdir -p "$configdir"
cp zsnapper/zsnapper.ini "$config" || fail
fi
if [ ! -f "$smf" ] ; then
echo "No SMF manifest, installing into $smf."
cp zsnapper/zsnapper.xml "$smf" || fail
fi
echo
echo "Installation complete."
echo " 1. Edit the config file $config to taste."
echo " 2. Import the SMF manifest to start the service:"
echo " svccfg import $smf"