[packages] utils/boxbackup: Added boxbackup. Currently only the server is fully integrated (init script and uci), but it compiles and the server works.
git-svn-id: svn://svn.openwrt.org/openwrt/packages@28023 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
b370d246fb
commit
94b4825f79
140
utils/boxbackup/Makefile
Normal file
140
utils/boxbackup/Makefile
Normal file
@ -0,0 +1,140 @@
|
||||
#
|
||||
# Copyright (C) 2006-2011 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=boxbackup
|
||||
PKG_VERSION:=0.11.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
|
||||
PKG_SOURCE_URL:=http://www.boxbackup.org/trac/browser/box/packages
|
||||
PKG_MD5SUM:=297ecb692b1ec2194c24d1dcbfb28599
|
||||
|
||||
PKG_INSTALL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/boxbackup/Default
|
||||
SUBMENU:=backup
|
||||
SECTION:=utils
|
||||
CATEGORY:=Utilities
|
||||
URL:=http://www.boxbackup.org/
|
||||
MAINTAINER:=Daniel Dickinson <openwrt@cshore.neomailbox.net>
|
||||
endef
|
||||
|
||||
define Package/boxbackup
|
||||
$(call Package/boxbackup/Default)
|
||||
TITLE:=Secure network backup
|
||||
MENU:=1
|
||||
endef
|
||||
|
||||
define Package/bbstored
|
||||
$(call Package/boxbackup/Default)
|
||||
TITLE:=Server for secure network backup
|
||||
DEPENDS:=boxbackup +libopenssl +zlib +libdb47 +libopenssl +libstdcpp +libreadline +libncurses
|
||||
endef
|
||||
|
||||
define Package/bbstored/description
|
||||
Boxbackup is an open source, completely automatic, on-line backup system.
|
||||
This package is for the server (where the backups are stored). The
|
||||
server is known as bbstored.
|
||||
endef
|
||||
|
||||
define Package/bbstored/conffiles
|
||||
/etc/config/bbbstored
|
||||
endef
|
||||
|
||||
|
||||
define Package/bbstored-config-external
|
||||
$(call Package/boxbackup/Default)
|
||||
TITLE:=Configure network backup server
|
||||
DEPENDS:=boxbackup +openssl-util +microperl
|
||||
endef
|
||||
|
||||
define Package/boxbackup-certs
|
||||
$(call Package/boxbackup/Default)
|
||||
TITLE:=Manage network backup security certificates
|
||||
DEPENDS:=boxbackup +openssl-util +microperl
|
||||
endef
|
||||
|
||||
define Package/bbackupd
|
||||
$(call Package/boxbackup/Default)
|
||||
TITLE:=Client for secure network backup
|
||||
DEPENDS:=boxbackup +libopenssl +zlib +libdb47 +libopenssl +libreadline +libstdcpp +libncurses +openssl-util +microperl
|
||||
endef
|
||||
|
||||
define Package/bbackupd/description
|
||||
Box Backup is an open source, completely automatic, on-line backup system.
|
||||
This package is for the client (host to be backed up).
|
||||
endef
|
||||
|
||||
|
||||
TARGET_CFLAGS += $(FPIC) -I$(STAGING_DIR)/usr/include -L$(STAGING_DIR)/usr/lib
|
||||
|
||||
CONFIGURE_ARGS += \
|
||||
--sysconfdir=/var/etc \
|
||||
--enable-gnu-readline \
|
||||
--with-bdb-headers=$(STAGING_DIR)/usr/include \
|
||||
--with-bdb-lib=$(STAGING_DIR)/usr/lib \
|
||||
--with-ssl-header=$(STAGING_DIR)/usr/include \
|
||||
--with-ssl-lib=$(STAGING_DIR)/usr/lib \
|
||||
--with-random=/dev/urandom \
|
||||
--disable-static-bin
|
||||
|
||||
define Build/Install
|
||||
mkdir -p $(PKG_INSTALL_DIR)
|
||||
tar -C $(PKG_INSTALL_DIR) -xzf $(PKG_BUILD_DIR)/parcels/$(PKG_NAME)-$(PKG_VERSION)-backup-server-linux-gnu.tgz
|
||||
tar -C $(PKG_INSTALL_DIR) -xzf $(PKG_BUILD_DIR)/parcels/$(PKG_NAME)-$(PKG_VERSION)-backup-client-linux-gnu.tgz
|
||||
endef
|
||||
|
||||
BXBK_SRV_INSTALL_DIR = $(PKG_INSTALL_DIR)/$(PKG_NAME)-$(PKG_VERSION)-backup-server-linux-gnu
|
||||
BXBK_CLIENT_INSTALL_DIR = $(PKG_INSTALL_DIR)/$(PKG_NAME)-$(PKG_VERSION)-backup-client-linux-gnu
|
||||
|
||||
define Package/boxbackup/install
|
||||
true
|
||||
endef
|
||||
|
||||
define Package/bbstored/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(BXBK_SRV_INSTALL_DIR)/bbstored $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/usr/lib/boxbackup
|
||||
$(INSTALL_BIN) $(BXBK_SRV_INSTALL_DIR)/bbstoreaccounts $(1)/usr/lib/boxbackup/
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/bbstored.init $(1)/etc/init.d/bbstored
|
||||
$(INSTALL_DIR) $(1)/lib/functions
|
||||
$(INSTALL_DATA) ./files/bbstored.sh $(1)/lib/functions/
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_DATA) ./files/bbstored.config $(1)/etc/config/bbstored
|
||||
$(INSTALL_BIN) ./files/bbstoreaccounts $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/bbstored-config-external/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(BXBK_SRV_INSTALL_DIR)/bbstored-config $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(BXBK_SRV_INSTALL_DIR)/raidfile-config $(1)/usr/sbin/
|
||||
$(INSTALL_DIR) $(1)/etc/bbstored
|
||||
endef
|
||||
|
||||
define Package/boxbackup-certs/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(BXBK_SRV_INSTALL_DIR)/bbstored-certs $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
define Package/bbackupd/install
|
||||
$(INSTALL_DIR) $(1)/usr/sbin
|
||||
$(INSTALL_BIN) $(BXBK_CLIENT_INSTALL_DIR)/bbackupd $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(BXBK_CLIENT_INSTALL_DIR)/bbackupquery $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(BXBK_CLIENT_INSTALL_DIR)/bbackupctl $(1)/usr/sbin/
|
||||
$(INSTALL_BIN) $(BXBK_CLIENT_INSTALL_DIR)/bbackupd-config $(1)/usr/sbin/
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,boxbackup))
|
||||
$(eval $(call BuildPackage,bbstored))
|
||||
$(eval $(call BuildPackage,boxbackup-certs))
|
||||
$(eval $(call BuildPackage,bbstored-config-external))
|
||||
$(eval $(call BuildPackage,bbackupd))
|
34
utils/boxbackup/files/bbstoreaccounts
Executable file
34
utils/boxbackup/files/bbstoreaccounts
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
. /etc/functions.sh
|
||||
. /lib/functions/bbstored.sh
|
||||
|
||||
bxbk_config_file=
|
||||
NORUN=
|
||||
|
||||
if [ "$1" = "-c" ]; then
|
||||
shift
|
||||
bxbk_config_file="$1"
|
||||
shift
|
||||
else
|
||||
if [ -z "$1" ] || [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
|
||||
/usr/lib/boxbackup/bbstoreaccounts -h
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ] || [ -z "$5" ]; then
|
||||
/usr/lib/boxbackup/bbstoreaccounts -h
|
||||
exit 1
|
||||
fi
|
||||
config_load bbstored
|
||||
create_config
|
||||
if [ "$EXTERNAL_CONFIG" = "1" ]; then
|
||||
bxbk_config_file="$EXTERNAL_CONF_FILE"
|
||||
else
|
||||
bxbk_config_file="$BXBK_CONFIG_PATH/bbstored.conf"
|
||||
fi
|
||||
fi
|
||||
|
||||
[ "$NORUN" != "1" ] && [ -n "$bxbk_config_file" ] && /usr/lib/boxbackup/bbstoreaccounts -c "$bxbk_config_file" "$@" || {
|
||||
echo "Error managing account using '$bxbk_config_file'"
|
||||
exit 1
|
||||
}
|
26
utils/boxbackup/files/bbstored.config
Normal file
26
utils/boxbackup/files/bbstored.config
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
# Example config using defaults used of no option supplied
|
||||
# or <value> for values that have no default....the <> would
|
||||
# need to be removed.
|
||||
|
||||
# config bbstored
|
||||
# option config_path '/var/etc/boxbackup'
|
||||
# option raidfileconf '/var/etc/boxbackup/raidfile.conf'
|
||||
# option accountdb 'etc/bbstored/accounts.txt'
|
||||
# option extlog 1
|
||||
# option housekeep_time 900
|
||||
# option user nobody
|
||||
# option group nogroup
|
||||
# option address <192.168.1.1>
|
||||
# OR option address <myhost.example.com>
|
||||
# option certfile </path/to/server_certificate>
|
||||
# option keyfile </path/to/key_for_certificate>
|
||||
# option cafile </path/to/trusted_certificate_authority>
|
||||
# option pidfile /var/run/bbstored.pid
|
||||
|
||||
#config raidfile
|
||||
# option setnum <0>
|
||||
# option blocksize 1024
|
||||
# option path </directory/for/backup/store>
|
||||
|
||||
# There can be many raidfile section, but each must have a unique setnum
|
31
utils/boxbackup/files/bbstored.init
Normal file
31
utils/boxbackup/files/bbstored.init
Normal file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2010-2011 Openwrt.org
|
||||
|
||||
START=90
|
||||
|
||||
|
||||
local NORUN=0
|
||||
|
||||
start() {
|
||||
. /lib/functions/bbstored.sh
|
||||
|
||||
create_config
|
||||
|
||||
if [ "$EXTERNAL_CONFIG" -eq 1 ]
|
||||
then
|
||||
BXBK_CONFIG_FILE="$EXTERNAL_CONF_FILE"
|
||||
fi
|
||||
[ "$NORUN" != "1" ] && /usr/sbin/bbstored "$BXBK_CONFIG_FILE"
|
||||
}
|
||||
|
||||
stop() {
|
||||
. /lib/functions/bbstored.sh
|
||||
|
||||
if [ -f "$PID_FILE" ]
|
||||
then
|
||||
kill $(cat "$PID_FILE")
|
||||
else
|
||||
killall bbstored
|
||||
fi
|
||||
}
|
||||
|
163
utils/boxbackup/files/bbstored.sh
Normal file
163
utils/boxbackup/files/bbstored.sh
Normal file
@ -0,0 +1,163 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2011 Openwrt.org
|
||||
# Copyright (C) 2011 Daniel Dickinson <openwrt@cshore.neomailbox.net>
|
||||
|
||||
BXBK_CONFIG_PATH=/var/etc/boxbackup
|
||||
PID_FILE=/var/run/bbstored.pid
|
||||
|
||||
EXTERNAL_CONFIG=0
|
||||
|
||||
EXTERNAL_CONF_FILE=
|
||||
RUNAS_USER=
|
||||
RUNAS_GROUP=
|
||||
BXBK_RAIDFILE_CONF=
|
||||
|
||||
bbstored_global() {
|
||||
local cfg="$1"
|
||||
local get_config="$2"
|
||||
|
||||
local external_config
|
||||
local raidfileconf
|
||||
local user
|
||||
local group
|
||||
local config_path
|
||||
local pidfile
|
||||
local accountdb
|
||||
local extended_logging
|
||||
local housekeep_time
|
||||
local address
|
||||
local certfile
|
||||
local keyfile
|
||||
local cafile
|
||||
|
||||
config_get external_config "$cfg" external_config
|
||||
if [ -n "$external_config" ]; then
|
||||
EXTERNAL_CONFIG=1
|
||||
EXTERNAL_CONF_FILE="$external_config"
|
||||
fi
|
||||
|
||||
config_get config_path "$cfg" config_path
|
||||
[ -n "$config_path" ] && {
|
||||
BXBK_CONFIG_PATH="$config_path"
|
||||
}
|
||||
|
||||
[ "$get_config" = "1" ] && return 0
|
||||
[ -z "$BXBK_CONFIG_FILE" ] && return 1
|
||||
|
||||
rm -f "$BXBK_CONFIG_FILE"
|
||||
touch "$BXBK_CONFIG_FILE"
|
||||
|
||||
config_get raidfileconf "$cfg" raidfileconf "$BXBK_CONFIG_PATH/raidfile.conf"
|
||||
echo "RaidFileConf = $raidfileconf" >>$BXBK_CONFIG_FILE
|
||||
BXBK_RAIDFILE_CONF="$raidfileconf"
|
||||
|
||||
config_get accountdb "$cfg" accountdb "/etc/bbstored/accounts.txt"
|
||||
echo "AccountDatabase = $accountdb" >>$BXBK_CONFIG_FILE
|
||||
[ ! -r "$accountdb" ] && {
|
||||
echo "Account database missing"
|
||||
NORUN=1
|
||||
return 1
|
||||
}
|
||||
|
||||
local extlog
|
||||
config_get extended_logging "$cfg" extended_logging 1
|
||||
if [ "$extended_logging" = "1" ]; then
|
||||
extlog=yes
|
||||
else
|
||||
extlog=no
|
||||
fi
|
||||
echo "ExtendedLogging = $extlog" >>$BXBK_CONFIG_FILE
|
||||
|
||||
config_get housekeep_time "$cfg" housekeep_time 900
|
||||
echo "TimeBetweenHousekeeping = $housekeep_time" >>$BXBK_CONFIG_FILE
|
||||
|
||||
echo "" >>$BXBK_CONFIG_FILE
|
||||
echo "Server" >>$BXBK_CONFIG_FILE
|
||||
echo "{" >>$BXBK_CONFIG_FILE
|
||||
|
||||
config_get user "$cfg" user
|
||||
config_get group "$cfg" group
|
||||
[ -n "$user" ] && [ "$group" ] && {
|
||||
RUNAS_USER=$user
|
||||
RUNAS_GROUP=$group
|
||||
}
|
||||
echo " User = ${RUNAS_USER:-nobody}" >>$BXBK_CONFIG_FILE
|
||||
|
||||
config_get address "$cfg" address
|
||||
[ -z "$address" ] && NORUN=1
|
||||
|
||||
echo " ListenAddresses = inet:$address" >>$BXBK_CONFIG_FILE
|
||||
|
||||
config_get certfile "$cfg" certfile
|
||||
[ -z "$certfile" ] && NORUN=1
|
||||
|
||||
echo " CertificateFile = $certfile" >>$BXBK_CONFIG_FILE
|
||||
|
||||
config_get keyfile "$cfg" keyfile
|
||||
[ -z "$keyfile" ] && NORUN=1
|
||||
|
||||
echo " PrivateKeyFile = $keyfile" >>$BXBK_CONFIG_FILE
|
||||
|
||||
config_get cafile "$cfg" cafile
|
||||
[ -z "$cafile" ] && NORUN=1
|
||||
|
||||
echo " TrustedCAsFile = $cafile" >>$BXBK_CONFIG_FILE
|
||||
|
||||
config_get pidfile "$cfg" pidfile
|
||||
[ -n "$pidfile" ] && {
|
||||
PID_FILE="$pidfile"
|
||||
}
|
||||
echo " PidFile = $PID_FILE" >>$BXBK_CONFIG_FILE
|
||||
|
||||
echo "}" >>$BXBK_CONFIG_FILE
|
||||
}
|
||||
|
||||
raidfile_section() {
|
||||
local cfg="$1"
|
||||
|
||||
[ -z "$BXBK_RAIDFILE_CONF" ] && return 1
|
||||
rm -f "$BXBK_RAIDFILE_CONF"
|
||||
touch "$BXBK_RAIDFILE_CONF"
|
||||
|
||||
local setnum
|
||||
local blocksize
|
||||
local path
|
||||
|
||||
config_get setnum "$cfg" setnum
|
||||
[ -z "$setnum" ] && return 1
|
||||
|
||||
config_get blocksize "$cfg" blocksize
|
||||
|
||||
config_get path "$cfg" path
|
||||
[ -z "$path" ] && return 1
|
||||
|
||||
echo "disc${setnum}" >>$BXBK_RAIDFILE_CONF
|
||||
echo "{" >>$BXBK_RAIDFILE_CONF
|
||||
echo " SetNumber = ${setnum}" >>$BXBK_RAIDFILE_CONF
|
||||
[ -n "$blocksize" ] && echo " BlockSize = ${blocksize}" >>$BXBK_RAIDFILE_CONF
|
||||
for i in 0 1 2; do
|
||||
echo " Dir${i} = $path" >>$BXBK_RAIDFILE_CONF
|
||||
done
|
||||
|
||||
echo "}" >>$BXBK_RAIDFILE_CONF
|
||||
|
||||
}
|
||||
|
||||
create_config() {
|
||||
config_load bbstored
|
||||
config_foreach bbstored_global bbstored 1
|
||||
|
||||
if [ "$EXTERNAL_CONFIG" -eq 0 ]
|
||||
then
|
||||
mkdir -p "$BXBK_CONFIG_PATH/bbstored"
|
||||
BXBK_CONFIG_FILE="$BXBK_CONFIG_PATH/bbstored.conf"
|
||||
touch "$BXBK_CONFIG_FILE"
|
||||
|
||||
config_load bbstored
|
||||
config_foreach bbstored_global bbstored
|
||||
config_foreach raidfile_section raidfile
|
||||
|
||||
chown -R ${RUNAS_USER:-nobody}:${RUNAS_GROUP:-nogroup} "$BXBK_CONFIG_PATH"
|
||||
fi
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user