2
0
mirror of https://github.com/deajan/osync synced 2024-11-19 03:25:37 +00:00
osync/install.sh

78 lines
1.7 KiB
Bash
Raw Normal View History

2014-05-26 22:50:46 +00:00
#!/usr/bin/env bash
2015-11-12 00:37:43 +00:00
PROGRAM=osync
PROGRAM_BINARY=$PROGRAM".sh"
PROGRAM_BATCH=$PROGRAM"-batch.sh"
SCRIPT_BUILD=2015102701
2014-05-21 17:12:19 +00:00
2015-11-12 00:37:43 +00:00
## osync / obackup daemon install script
2015-09-08 10:37:37 +00:00
## Tested on RHEL / CentOS 6 & 7 and Mint 17
2014-05-21 17:12:19 +00:00
## Please adapt this to fit your distro needs
2015-11-12 00:37:43 +00:00
CONF_DIR=/etc/$PROGRAM
2015-09-28 12:43:42 +00:00
BIN_DIR=/usr/local/bin
SERVICE_DIR=/etc/init.d
2015-09-08 14:08:14 +00:00
if [ "$(whoami)" != "root" ]; then
2015-07-02 14:44:05 +00:00
echo "Must be run as root."
exit 1
fi
2015-11-12 00:37:43 +00:00
if [ ! -d "$CONF_DIR" ]; then
mkdir "$CONF_DIR"
2015-09-28 12:43:42 +00:00
if [ $? == 0 ]; then
2015-11-12 00:37:43 +00:00
echo "Created directory [$CONF_DIR]."
else
echo "Cannot create directory [$CONF_DIR]."
exit 1
2015-09-28 12:43:42 +00:00
fi
else
2015-11-12 00:37:43 +00:00
echo "Config directory [$CONF_DIR] exists."
2015-09-08 10:37:37 +00:00
fi
2015-11-12 00:37:43 +00:00
if [ -f ./sync.conf ]; then
cp ./sync.conf /etc/$PROGRAM/sync.conf.example
fi
if [ -f ./host_backup.conf ]; then
cp ./host_backup.conf /etc/$PROGRAM/host_backup.conf.example
fi
if [ -f ./exlude.list.example ]; then
cp ./exclude.list.example /etc/$PROGRAM
fi
cp ./$PROGRAM_BINARY "$BIN_DIR"
2015-09-28 12:43:42 +00:00
if [ $? != 0 ]; then
2015-11-12 00:37:43 +00:00
echo "Cannot copy $PROGRAM_BINARY to [$BIN_DIR]."
2015-09-28 12:43:42 +00:00
else
2015-11-12 00:37:43 +00:00
echo "Copied $PROGRAM_BINARY to [$BIN_DIR]."
2015-09-28 12:43:42 +00:00
fi
2015-11-12 00:37:43 +00:00
cp ./$PROGRAM_BATCH /usr/local/bin
2015-09-28 12:43:42 +00:00
if [ $? != 0 ]; then
2015-11-12 00:37:43 +00:00
echo "Cannot copy $PROGRAM_BATCH to [$BIN_DIR]."
2015-09-28 12:43:42 +00:00
else
2015-11-12 00:37:43 +00:00
echo "Copied $PROGRAM_BATCH to [$BIN_DIR]."
2015-09-28 12:43:42 +00:00
fi
2015-07-02 14:44:05 +00:00
cp ./ssh_filter.sh /usr/local/bin
2015-09-28 12:43:42 +00:00
if [ $? != 0 ]; then
echo "Cannot copy ssh_filter.sh to [$BIN_DIR]."
else
echo "Copied ssh_filter.sh to [$BIN_DIR]."
fi
2015-11-12 00:37:43 +00:00
if [ -f ./osync-srv ]; then
cp ./osync-srv "$SERVICE_DIR"
if [ $? != 0 ]; then
echo "Cannot copy osync-srv to [$SERVICE_DIR]."
else
echo "Created osync-srv service in [$SERVICE_DIR]."
chmod 755 /etc/init.d/osync-srv
fi
2015-09-28 12:43:42 +00:00
fi
2015-11-12 00:37:43 +00:00
chmod 755 /usr/local/bin/$PROGRAM_BINARY
chmod 755 /usr/local/bin/$PROGRAM_BATCH
2015-07-02 14:44:05 +00:00
chmod 755 /usr/local/bin/ssh_filter.sh
chown root:root /usr/local/bin/ssh_filter.sh