Initial version of Debian package

This commit is contained in:
Victor LABORIE 2017-01-11 17:10:56 +01:00
parent f5116b8c9d
commit 4c4e845dd8
12 changed files with 122 additions and 40 deletions

9
.gitignore vendored Normal file
View file

@ -0,0 +1,9 @@
debian/*
!debian/changelog
!debian/compat
!debian/control
!debian/rules
!debian/install
!debian/bkctld.default
!debian/bkctld.init
!debian/manpages

6
bkctld
View file

@ -386,7 +386,7 @@ sub_sync() {
fi fi
if [ -z "${NODE}" ]; then if [ -z "${NODE}" ]; then
echo "You must define \$NODE in /etc/default/evobackup !" >&2 echo "You must define \$NODE in /etc/default/bkctld !" >&2
exit 1 exit 1
fi fi
jail=$1 jail=$1
@ -504,8 +504,8 @@ main() {
echo "Error, you need to be root to run $0 !" >&2 echo "Error, you need to be root to run $0 !" >&2
exit 1 exit 1
fi fi
if [ -f /etc/default/evobackup ]; then if [ -f /etc/default/bkctld ]; then
source /etc/default/evobackup source /etc/default/bkctld
fi fi
[ -z "${CONFDIR}" ] && CONFDIR='/etc/evobackup' [ -z "${CONFDIR}" ] && CONFDIR='/etc/evobackup'
[ -z "${JAILDIR}" ] && JAILDIR='/backup/jails' [ -z "${JAILDIR}" ] && JAILDIR='/backup/jails'

View file

@ -1,9 +1,9 @@
# Defaults for bkctld command (evobackup) # Defaults for bkctld command (evobackup)
# sourced by /usr/sbin/bkctld or /usr/local/sbin/bkctld # sourced by /usr/sbin/bkctld and /etc/init.d/bkctld
CONFDIR='/etc/evobackup' CONFDIR='/etc/evobackup'
JAILDIR='/backup/jails' JAILDIR='/backup/jails'
INCDIR='/backup/incs' INCDIR='/backup/incs'
TPLDIR='/usr/local/share/evobackup' TPLDIR='/usr/share/evobackup'
LOG_DIR='/var/log/bkctld' LOG_DIR='/var/log/bkctld'
FIREWALL_RULES='/etc/firewall.rc.jails' FIREWALL_RULES='/etc/firewall.rc.jails'

View file

5
debian/changelog vendored Normal file
View file

@ -0,0 +1,5 @@
bkctld (1.0) UNRELEASED; urgency=medium
* Initial release
-- Victor Laborie <vlaborie@evolix.fr> Wed, 11 Jan 2017 16:51:48 +0100

1
debian/compat vendored Normal file
View file

@ -0,0 +1 @@
7

9
debian/control vendored Normal file
View file

@ -0,0 +1,9 @@
Source: bkctld
Section: utils
Priority: optional
Maintainer: vlaborie@evolix.fr
Package: bkctld
Architecture: all
Depends: coreutils, openssh-server, btrfs-tools, rsync
Description: Tool for manage rsync jail for backup

2
debian/install vendored Normal file
View file

@ -0,0 +1,2 @@
bkctld usr/sbin
tpl/* usr/share/bkctld

1
debian/manpages vendored Normal file
View file

@ -0,0 +1 @@
docs/bkctld.8

4
debian/rules vendored Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/make -f
%:
dh $@

86
docs/bkctld.8 Normal file
View file

@ -0,0 +1,86 @@
.\" Manpage for bkctld.
.\" Contact vlaborie@evolix.fr to correct errors or typos.
.TH man 8 "11 Janvier 2017" "1.0" "bkctld man page"
.SH NAME
bkctld \- Tool to manage rsync jail for backup
.SH SYNOPSIS
bkctld <command> [<args>]
.SH DESCRIPTION
bkctld is a shell script to create and manage a backup server which will handle the backup of many servers (clients).
.SH BKCTLD COMMANDS
bkctld init <jailname>
.RS 4
Init jail <jailname>
.RE
.PP
bkctld update <jailname>|all
.RS 4
Update jail <jailname>
.RE
.PP
bkctld remove <jailname>|all
.RS 4
Remove jail <jailname> or all
.RE
.PP
bkctld start <jailname>|all
.RS 4
Start jail <jailname> or all
.RE
.PP
bkctld stop <jailname>|all
.RS 4
Stop jail <jailname> or all
.RE
.PP
bkctld reload <jailname>|all
.RS 4
Reload jail <jailname> or all
.RE
.PP
bkctld restart <jailname>|all
.RS 4
Restart jail <jailname> or all
.RE
.PP
bkctld sync <jailname>|all
.RS 4
Sync jail <jailname> with $NODE defined in /etc/default/bkctld
.RE
.PP
bkctld status [<jailname>]
.RS 4
Print status of jail <jailname> or all jails
.RE
.PP
bkctld key <jailname> [<keyfile>]
.RS 4
Print or set SSH public key of jail <jailname>
.RE
.PP
bkctld port <jailname> [<ssh_port>|auto]
.RS 4
Print or set SSH port of jail <jailname>. Auto for user last port + 1
.RE
.PP
bkctld ip <jailname> [<ip>|all]
.RS 4
Print or set allowed IP of jail <jailname>. All for no IP restriction
.RE
.PP
bkctld inc
.RS 4
Make inc of jail <jailname>
.RE
.PP
bkctld rm
.RS 4
Remove old inc of jail <jailname>
.RE
.PP
.SH SEE ALSO
sshd(8), rsync(1), chroot(8)
.SH BUGS
No known bugs.
.SH AUTHOR
Victor Laborie (vlaborie@evolix.fr)

View file

@ -1,35 +0,0 @@
#!/bin/bash
dir=`dirname $0`
if [ ! -f /etc/default/evobackup ]; then
install -m 0644 -v $dir/tpl/evobackup.conf /etc/default/evobackup
fi
source /etc/default/evobackup
grep -q usr /etc/fstab
if [ $? == 0 ]; then
mount -o remount,rw /usr
fi
mkdir -m 0755 -p $TPLDIR $LOG_DIR
cp -v $dir/tpl/* $TPLDIR
install -m 0755 -v $dir/bkctld /usr/local/sbin/
crontab -l|grep -q bkctld
if [ $? != 0 ]; then
(crontab -l 2>/dev/null; echo "29 10 * * * bkctld inc && bkctld rm") | crontab -
fi
dpkg -l sysvinit >/dev/null
if [ $? == 0 ]; then
install -m 0755 -v $dir/tpl/evobackup /etc/init.d/evobackup
insserv evobackup
fi
dpkg -l systemd >/dev/null
if [ $? == 0 ] ; then
#cp evobackup@.service /etc/systemd/system/evobackup@.service
install -m 0755 -v $dir/tpl/evobackup /etc/init.d/evobackup
systemctl enable evobackup
fi