Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Intelli-IDE family
.idea
20 changes: 13 additions & 7 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,26 @@ ZIMBRA_LDAPPASS="" # Leave empty to autodetect


# Exit codes
ERR_OK="0" # No error (normal exit)
ERR_OK="0" # No error (normal exit)
ERR_NOBKPDIR="1" # No backup directory could be found
ERR_NOROOT="2" # Script was run without root privileges
ERR_DEPNOTFOUND="3" # Missing dependency
ERR_HOSTNOTFOUND="543" # Missing dependency

# Check if we have root before doing anything
if [ $(id -u) -ne 0 ]; then
echo "You need root privileges to install zmbkpose"
exit $ERR_NOROOT
fi

# Try to guess missing settings as best as we can
test -z $ZIMBRA_HOSTNAME && ZIMBRA_HOSTNAME=`su - zimbra -c zmhostname`
test -z $ZIMBRA_ADDRESS && ZIMBRA_ADDRESS=`grep $ZIMBRA_HOSTNAME /etc/hosts|awk '{print $1}'`
test -z $ZIMBRA_ADDRESS && ZIMBRA_ADDRESS=`host -t A $ZIMBRA_HOSTNAME | head -1 | cut -d ' ' -f 4`
test -z $ZIMBRA_ADDRESS && {
echo "Cannot resolve $ZIMBRA_HOSTNAME to an address! Check DNS or /etc/hosts please."
exit $ERR_HOSTNOTFOUND
}
test -z $ZIMBRA_LDAPPASS && ZIMBRA_LDAPPASS=`su - zimbra -c "zmlocalconfig -s zimbra_ldap_password"|awk '{print $3}'`
if [ -z $ZIMBRA_BKPDIR ]; then
test -d $ZIMBRA_DIR/backup && ZIMBRA_BKPDIR=$ZIMBRA_DIR/backup
Expand Down Expand Up @@ -74,12 +86,6 @@ echo ""
echo "Press ENTER to continue or CTRL+C to cancel."
read tmp

# Check if we have root before doing anything
if [ $(id -u) -ne 0 ]; then
echo "You need root privileges to install zmbkpose"
exit $ERR_NOROOT
fi

# Check for missing installer files
# TODO: MD5 check of the files
printf "Checking installer integrity... "
Expand Down
Loading