Merge branch 'master' of https://github.com/deajan/osync
This commit is contained in:
commit
6de96338eb
|
@ -12,12 +12,12 @@ SCRIPT_BUILD=2016082901
|
||||||
|
|
||||||
#TODO: silent mode and no stats mode
|
#TODO: silent mode and no stats mode
|
||||||
|
|
||||||
CONF_DIR=/etc/$PROGRAM
|
CONF_DIR=$FAKEROOT/etc/$PROGRAM
|
||||||
BIN_DIR=/usr/local/bin
|
BIN_DIR="$FAKEROOT/usr/local/bin"
|
||||||
SERVICE_DIR_INIT=/etc/init.d
|
SERVICE_DIR_INIT=$FAKEROOT/etc/init.d
|
||||||
# Should be /usr/lib/systemd/system, but /lib/systemd/system exists on debian & rhel / fedora
|
# Should be /usr/lib/systemd/system, but /lib/systemd/system exists on debian & rhel / fedora
|
||||||
SERVICE_DIR_SYSTEMD_SYSTEM=/lib/systemd/system
|
SERVICE_DIR_SYSTEMD_SYSTEM=$FAKEROOT/lib/systemd/system
|
||||||
SERVICE_DIR_SYSTEMD_USER=/etc/systemd/user
|
SERVICE_DIR_SYSTEMD_USER=$FAKEROOT/etc/systemd/user
|
||||||
|
|
||||||
## osync specific code
|
## osync specific code
|
||||||
OSYNC_SERVICE_FILE_INIT="osync-srv"
|
OSYNC_SERVICE_FILE_INIT="osync-srv"
|
||||||
|
@ -31,8 +31,8 @@ PMOCR_SERVICE_FILE_SYSTEMD_SYSTEM="pmocr-srv.service"
|
||||||
## Generic code
|
## Generic code
|
||||||
|
|
||||||
## Default log file
|
## Default log file
|
||||||
if [ -w /var/log ]; then
|
if [ -w $FAKEROOT/var/log ]; then
|
||||||
LOG_FILE="/var/log/$PROGRAM-install.log"
|
LOG_FILE="$FAKEROOT/var/log/$PROGRAM-install.log"
|
||||||
elif ([ "$HOME" != "" ] && [ -w "$HOME" ]); then
|
elif ([ "$HOME" != "" ] && [ -w "$HOME" ]); then
|
||||||
LOG_FILE="$HOME/$PROGRAM-install.log"
|
LOG_FILE="$HOME/$PROGRAM-install.log"
|
||||||
else
|
else
|
||||||
|
@ -104,7 +104,7 @@ function SetOSSettings {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if ([ "$USER" != "" ] && [ "$(whoami)" != "$USER" ]); then
|
if ([ "$USER" != "" ] && [ "$(whoami)" != "$USER" ] && [ "$FAKEROOT" == "" ]); then
|
||||||
QuickLogger "Must be run as $USER."
|
QuickLogger "Must be run as $USER."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -141,19 +141,19 @@ function CreateConfDir {
|
||||||
|
|
||||||
function CopyExampleFiles {
|
function CopyExampleFiles {
|
||||||
if [ -f "./sync.conf.example" ]; then
|
if [ -f "./sync.conf.example" ]; then
|
||||||
cp "./sync.conf.example" "/etc/$PROGRAM/sync.conf.example"
|
cp "./sync.conf.example" "$FAKEROOT/etc/$PROGRAM/sync.conf.example"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "./host_backup.conf.example" ]; then
|
if [ -f "./host_backup.conf.example" ]; then
|
||||||
cp "./host_backup.conf.example" "/etc/$PROGRAM/host_backup.conf.example"
|
cp "./host_backup.conf.example" "$FAKEROOT/etc/$PROGRAM/host_backup.conf.example"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "./exlude.list.example" ]; then
|
if [ -f "./exlude.list.example" ]; then
|
||||||
cp "./exclude.list.example" "/etc/$PROGRAM"
|
cp "./exclude.list.example" "$FAKEROOT/etc/$PROGRAM"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "./snapshot.conf.example" ]; then
|
if [ -f "./snapshot.conf.example" ]; then
|
||||||
cp "./snapshot.conf.example" "/etc/$PROGRAM/snapshot.conf.example"
|
cp "./snapshot.conf.example" "$FAKEROOT/etc/$PROGRAM/snapshot.conf.example"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ function CopyProgram {
|
||||||
QuickLogger "Cannot copy ssh_filter.sh to [$BIN_DIR]."
|
QuickLogger "Cannot copy ssh_filter.sh to [$BIN_DIR]."
|
||||||
else
|
else
|
||||||
chmod 755 "$BIN_DIR/ssh_filter.sh"
|
chmod 755 "$BIN_DIR/ssh_filter.sh"
|
||||||
if ([ "$USER" != "" ] && [ "$GROUP" != "" ]); then
|
if ([ "$USER" != "" ] && [ "$GROUP" != "" ] && [ "$FAKEROOT" == "" ]); then
|
||||||
chown $USER:$GROUP "$BIN_DIR/ssh_filter.sh"
|
chown $USER:$GROUP "$BIN_DIR/ssh_filter.sh"
|
||||||
fi
|
fi
|
||||||
QuickLogger "Copied ssh_filter.sh to [$BIN_DIR]."
|
QuickLogger "Copied ssh_filter.sh to [$BIN_DIR]."
|
||||||
|
@ -282,6 +282,10 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$FAKEROOT" != "" ]; then
|
||||||
|
mkdir -p "$SERVICE_DIR_SYSTEMD_SYSTEM" "$SERVICE_DIR_SYSTEMD_USER" "$BIN_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
SetOSSettings
|
SetOSSettings
|
||||||
CreateConfDir
|
CreateConfDir
|
||||||
CopyExampleFiles
|
CopyExampleFiles
|
||||||
|
|
30
install.sh
30
install.sh
|
@ -12,12 +12,12 @@ SCRIPT_BUILD=2016082901
|
||||||
|
|
||||||
#TODO: silent mode and no stats mode
|
#TODO: silent mode and no stats mode
|
||||||
|
|
||||||
CONF_DIR=/etc/$PROGRAM
|
CONF_DIR=$FAKEROOT/etc/$PROGRAM
|
||||||
BIN_DIR=/usr/local/bin
|
BIN_DIR="$FAKEROOT/usr/local/bin"
|
||||||
SERVICE_DIR_INIT=/etc/init.d
|
SERVICE_DIR_INIT=$FAKEROOT/etc/init.d
|
||||||
# Should be /usr/lib/systemd/system, but /lib/systemd/system exists on debian & rhel / fedora
|
# Should be /usr/lib/systemd/system, but /lib/systemd/system exists on debian & rhel / fedora
|
||||||
SERVICE_DIR_SYSTEMD_SYSTEM=/lib/systemd/system
|
SERVICE_DIR_SYSTEMD_SYSTEM=$FAKEROOT/lib/systemd/system
|
||||||
SERVICE_DIR_SYSTEMD_USER=/etc/systemd/user
|
SERVICE_DIR_SYSTEMD_USER=$FAKEROOT/etc/systemd/user
|
||||||
|
|
||||||
## osync specific code
|
## osync specific code
|
||||||
OSYNC_SERVICE_FILE_INIT="osync-srv"
|
OSYNC_SERVICE_FILE_INIT="osync-srv"
|
||||||
|
@ -31,8 +31,8 @@ PMOCR_SERVICE_FILE_SYSTEMD_SYSTEM="pmocr-srv.service"
|
||||||
## Generic code
|
## Generic code
|
||||||
|
|
||||||
## Default log file
|
## Default log file
|
||||||
if [ -w /var/log ]; then
|
if [ -w $FAKEROOT/var/log ]; then
|
||||||
LOG_FILE="/var/log/$PROGRAM-install.log"
|
LOG_FILE="$FAKEROOT/var/log/$PROGRAM-install.log"
|
||||||
elif ([ "$HOME" != "" ] && [ -w "$HOME" ]); then
|
elif ([ "$HOME" != "" ] && [ -w "$HOME" ]); then
|
||||||
LOG_FILE="$HOME/$PROGRAM-install.log"
|
LOG_FILE="$HOME/$PROGRAM-install.log"
|
||||||
else
|
else
|
||||||
|
@ -104,7 +104,7 @@ function SetOSSettings {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if ([ "$USER" != "" ] && [ "$(whoami)" != "$USER" ]); then
|
if ([ "$USER" != "" ] && [ "$(whoami)" != "$USER" ] && [ "$FAKEROOT" == "" ]); then
|
||||||
QuickLogger "Must be run as $USER."
|
QuickLogger "Must be run as $USER."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -141,19 +141,19 @@ function CreateConfDir {
|
||||||
|
|
||||||
function CopyExampleFiles {
|
function CopyExampleFiles {
|
||||||
if [ -f "./sync.conf.example" ]; then
|
if [ -f "./sync.conf.example" ]; then
|
||||||
cp "./sync.conf.example" "/etc/$PROGRAM/sync.conf.example"
|
cp "./sync.conf.example" "$FAKEROOT/etc/$PROGRAM/sync.conf.example"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "./host_backup.conf.example" ]; then
|
if [ -f "./host_backup.conf.example" ]; then
|
||||||
cp "./host_backup.conf.example" "/etc/$PROGRAM/host_backup.conf.example"
|
cp "./host_backup.conf.example" "$FAKEROOT/etc/$PROGRAM/host_backup.conf.example"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "./exlude.list.example" ]; then
|
if [ -f "./exlude.list.example" ]; then
|
||||||
cp "./exclude.list.example" "/etc/$PROGRAM"
|
cp "./exclude.list.example" "$FAKEROOT/etc/$PROGRAM"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f "./snapshot.conf.example" ]; then
|
if [ -f "./snapshot.conf.example" ]; then
|
||||||
cp "./snapshot.conf.example" "/etc/$PROGRAM/snapshot.conf.example"
|
cp "./snapshot.conf.example" "$FAKEROOT/etc/$PROGRAM/snapshot.conf.example"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ function CopyProgram {
|
||||||
QuickLogger "Cannot copy ssh_filter.sh to [$BIN_DIR]."
|
QuickLogger "Cannot copy ssh_filter.sh to [$BIN_DIR]."
|
||||||
else
|
else
|
||||||
chmod 755 "$BIN_DIR/ssh_filter.sh"
|
chmod 755 "$BIN_DIR/ssh_filter.sh"
|
||||||
if ([ "$USER" != "" ] && [ "$GROUP" != "" ]); then
|
if ([ "$USER" != "" ] && [ "$GROUP" != "" ] && [ "$FAKEROOT" == "" ]); then
|
||||||
chown $USER:$GROUP "$BIN_DIR/ssh_filter.sh"
|
chown $USER:$GROUP "$BIN_DIR/ssh_filter.sh"
|
||||||
fi
|
fi
|
||||||
QuickLogger "Copied ssh_filter.sh to [$BIN_DIR]."
|
QuickLogger "Copied ssh_filter.sh to [$BIN_DIR]."
|
||||||
|
@ -282,6 +282,10 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$FAKEROOT" != "" ]; then
|
||||||
|
mkdir -p "$SERVICE_DIR_SYSTEMD_SYSTEM" "$SERVICE_DIR_SYSTEMD_USER" "$BIN_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
SetOSSettings
|
SetOSSettings
|
||||||
CreateConfDir
|
CreateConfDir
|
||||||
CopyExampleFiles
|
CopyExampleFiles
|
||||||
|
|
Loading…
Reference in New Issue