Date: Fri, 18 May 2018 19:00:37 +0000 (UTC) From: Jose Alonso Cardenas Marquez <acm@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r470319 - in head/sysutils: bareos-client bareos-client-static bareos-docs bareos-server bareos-server/files bareos-traymonitor bareos16-bat bareos16-client bareos16-client-static bareo... Message-ID: <201805181900.w4IJ0bBs039665@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: acm Date: Fri May 18 19:00:37 2018 New Revision: 470319 URL: https://svnweb.freebsd.org/changeset/ports/470319 Log: - Import chio-bareos - Fix perl path into mtx-changer - Add/modify CONFLICTS - Add GNUTLS option - Few other modifications PR: 225119 225908 227318 Modified: head/sysutils/bareos-client-static/Makefile head/sysutils/bareos-client/Makefile head/sysutils/bareos-docs/Makefile head/sysutils/bareos-server/Makefile head/sysutils/bareos-server/files/chio-bareos head/sysutils/bareos-traymonitor/Makefile head/sysutils/bareos16-bat/Makefile head/sysutils/bareos16-client-static/Makefile head/sysutils/bareos16-client/Makefile head/sysutils/bareos16-server/Makefile head/sysutils/bareos16-server/files/chio-bareos head/sysutils/bareos16-traymonitor/Makefile Modified: head/sysutils/bareos-client-static/Makefile ============================================================================== --- head/sysutils/bareos-client-static/Makefile Fri May 18 18:57:15 2018 (r470318) +++ head/sysutils/bareos-client-static/Makefile Fri May 18 19:00:37 2018 (r470319) @@ -1,12 +1,13 @@ -# Created by: Alonso Cardenas <acm@FreeBSD.org> # $FreeBSD$ PORTNAME= bareos -PORTREVISION= 0 +PORTREVISION= 1 PKGNAMESUFFIX= -client-static COMMENT= Backup archiving recovery open sourced (static client) +CONFLICTS= bareos16-client-static-* + PLIST= ${.CURDIR}/pkg-plist MASTERDIR= ${.CURDIR}/../../sysutils/bareos-server @@ -14,7 +15,6 @@ PLIST_FILES= sbin/bareos-fd-static \ sbin/bconsole-static OPTIONS_DEFINE= NLS LMDB -OPTIONS_DEFAULT=# LMDB_DESC= Enable build of LMDB support CONFIGURE_ARGS+= --enable-client-only \ Modified: head/sysutils/bareos-client/Makefile ============================================================================== --- head/sysutils/bareos-client/Makefile Fri May 18 18:57:15 2018 (r470318) +++ head/sysutils/bareos-client/Makefile Fri May 18 19:00:37 2018 (r470319) @@ -1,14 +1,15 @@ -# Created by: Alonso Cardenas <acm@FreeBSD.org> # $FreeBSD$ PORTNAME= bareos -PORTREVISION= 0 +PORTREVISION= 1 PKGNAMESUFFIX= -client COMMENT= Backup archiving recovery open sourced (client) BROKEN_aarch64= Fails to link: missing sbrk +CONFLICTS= bareos16-client-* + WITH_CLIENT_ONLY=yes USE_RC_SUBR= bareos-fd @@ -16,7 +17,6 @@ PLIST= ${PKGDIR}/pkg-plist.client MASTERDIR= ${.CURDIR}/../../sysutils/bareos-server OPTIONS_DEFINE= NLS PYTHON LMDB SCSICRYPTO -OPTIONS_DEFAULT=# LMDB_DESC= Enable build of LMDB support .include "${MASTERDIR}/Makefile" Modified: head/sysutils/bareos-docs/Makefile ============================================================================== --- head/sysutils/bareos-docs/Makefile Fri May 18 18:57:15 2018 (r470318) +++ head/sysutils/bareos-docs/Makefile Fri May 18 19:00:37 2018 (r470319) @@ -1,4 +1,3 @@ -# Created by: Alonso CArdenas <acm@FreeBSD.org> # $FreeBSD$ PORTNAME= bareos Modified: head/sysutils/bareos-server/Makefile ============================================================================== --- head/sysutils/bareos-server/Makefile Fri May 18 18:57:15 2018 (r470318) +++ head/sysutils/bareos-server/Makefile Fri May 18 19:00:37 2018 (r470319) @@ -1,10 +1,9 @@ -# Created by: Alonso Cardenas <acm@FreeBSD.org> # $FreeBSD$ PORTNAME= bareos DISTVERSIONPREFIX= Release/ DISTVERSION= 17.2.5 -PORTREVISION?= 0 +PORTREVISION?= 1 CATEGORIES?= sysutils PKGNAMEPREFIX?= # PKGNAMESUFFIX?= -server @@ -19,7 +18,7 @@ USE_GITHUB= yes USES+= libtool:keepla pkgconfig readline:port shebangfix -CONFLICTS?= bacula*-server-* +CONFLICTS?= bacula*-server-* bareos16-server-* LIB_DEPENDS+= liblzo2.so:archivers/lzo2 \ libjansson.so:devel/jansson @@ -37,22 +36,29 @@ SHEBANG_FILES= ${WRKSRC}/src/cats/make_catalog_backup. CPPFLAGS+= -I${LOCALBASE}/readline -I${LOCALBASE}/include LDFLAGS+= -L${LOCALBASE}/lib -OPTIONS_DEFINE?= MTX PYTHON NDMP NLS OPENSSL SCSICRYPTO -OPTIONS_DEFAULT?= OPENSSL PGSQL SCSICRYPTO +OPTIONS_DEFAULT= OPENSSL +OPTIONS_SINGLE= CRYPTO +OPTIONS_SINGLE_CRYPTO= OPENSSL GNUTLS OPTIONS_SUB= yes +CRYPTO_DESC= Cryptographic library MTX_DESC= Install mtx for control of autochanger devices NDMP_DESC= Enable build of NDMP support SCSICRYPTO_DESC= Build LTO AME crypto plugin .if ${PKGNAMESUFFIX} == "-server" +OPTIONS_DEFINE= MTX PYTHON NDMP NLS SCSICRYPTO +OPTIONS_DEFAULT+= PGSQL SCSICRYPTO OPTIONS_SINGLE_DATABASE= SQLITE3 MYSQL PGSQL -OPTIONS_SINGLE= DATABASE +OPTIONS_SINGLE+= DATABASE DATABASE_DESC= Database support NDMP_CONFIGURE_ON= --enable-ndmp=yes NDMP_CONFIGURE_OFF= --enable-ndmp=no .endif +GNUTLS_CONFIGURE_WITH= gnutls=${LOCALBASE} +GNUTLS_LIB_DEPENDS= libgnutls.so:security/gnutls + OPENSSL_USES= ssl OPENSSL_CONFIGURE_ON= --with-openssl=${OPENSSLBASE} OPENSSL_CONFIGURE_OFF= --with-openssl="no" @@ -197,6 +203,7 @@ post-patch: @${REINPLACE_CMD} -e 's|../../lib/|$$(LOCALBASE)/lib/|g' ${WRKSRC}/src/plugins/dird/Makefile.in ${WRKSRC}/src/plugins/stored/Makefile.in @${REINPLACE_CMD} -e 's|fd_plugins.h|filed/fd_plugins.h|g' -e 's|dir_plugins.h|dird/dir_plugins.h|g' -e 's|stored.h|stored/stored.h|g' \ ${WRKSRC}/src/tools/bpluginfo.c + @${REINPLACE_CMD} -e 's|perl|$(LOCALBASE)/bin/perl|g' ${WRKSRC}/scripts/mtx-changer.in .endif post-extract: Modified: head/sysutils/bareos-server/files/chio-bareos ============================================================================== --- head/sysutils/bareos-server/files/chio-bareos Fri May 18 18:57:15 2018 (r470318) +++ head/sysutils/bareos-server/files/chio-bareos Fri May 18 19:00:37 2018 (r470319) @@ -1,200 +1,190 @@ #!/bin/sh # -# Bacula interface to FreeBSD chio autoloader command with -# multiple drive support -# (By Lars Köller, lars+bacula@koellers.net, 2004) +# BAREOS interface to tape libraries and autoloaders for FreeBSD +# (by Rudolf Cejka <cej...@fit.vutbr.cz>, v1.2, 2012/11/14) # -# If you set in your Device resource +# If you set in your Device resource +# Changer Command = "path-to-this-script/chio-changer %c %o %S %a %d" +# you will have the following input to this script: +# chio-changer "changer-device" "command" "slot" "tape-device" "drive-index" +# $1 $2 $3 $4 $5 +# for example (on a FreeBSD system): +# chio-changer /dev/ch0 load 1 /dev/nsa0 0 # -# Changer Command = "path-to-this-script/chio-bacula" %c %o %S %a -# you will have the following input to this script: +# If you change the script, take care to return either the chio exit +# code or a 0. If the script exits with a non-zero exit code, BAREOS +# will assume the request failed. # -# chio-bacula "changer-device" "command" "slot" "archive-device" "drive-index" -# $1 $2 $3 $4 $5 -# for example: -# -# chio-bacula /dev/sg0 load 1 /dev/nst0 0 (on a FreeBSD system) -# -# If you need to to an offline, refer to the drive as $4 -# e.g. mt -f $f offline -# -# Many changers need an offline after the unload. Also many -# changers need a sleep 60 after the mtx load. -# -# N.B. If you change the script, take care to return either -# the mtx exit code or a 0. If the script exits with a non-zero -# exit code, Bacula will assume the request failed. -# -me=$(basename $0) -# Debug output, take care this file is writeable for user bacula! -#LOG=/var/db/bacula/chio-bacula.log -#exec 2>>$LOG -#echo "------------------------- $(date) Start $(basename $0) -------------------------" >> $LOG -#set -x +PROGNAME=`basename $0` -# Debug -logger -p user.err "$me $@" +# Uncomment the following line, if you want to log debug output. +#DEBUG=/var/run/bareos/${PROGNAME}.log -# This simulates a barcode reader in the changer. -# The labes of the virtual barcode reader are located in the BARCODE_FILE -SIMULATE_BARCODE=true -BARCODE_FILE=/usr/local/etc/bacula/bacula-barcodes -MTX=/bin/chio -# Set default values (see case statement below for -# free mapping of drive index and tape device -# We have a double drive Qualstar where drive 1 is the default bacula drive -#TAPE=/dev/bacula-tape -TAPE=/dev/nrsa0 -DRIVE=0 -# Time to wait for (un)loading -SLEEP=20 +# Uncomment the following line, if you need to eject a tape before moving +# it from the drive. +#OFFLINE=yes +# Uncomment one or more of the following lines, if you need to wait for +# some time (in seconds) after unloading, loading or transferring a tape. +#OFFLINE_SLEEP=10 +#LOAD_SLEEP=10 +#MOVE_SLEEP=10 + +# Uncomment the following line, if you do not have a changer with volume +# reader. +#FAKE_BARCODES=/usr/local/etc/bareos-barcodes + usage() { - echo "" - echo "The $me script for bacula" - echo "--------------------------------------" - echo "" - echo "usage: $me <changer-device> <command> [slot] [devicename of tapedrive] [drive index]" - echo "" - echo "Valid commands:" - echo "" - echo "unload Unloads a tape into the slot" - echo " from where it was loaded." - echo "load <slot> Loads a tape from the slot <slot>" - echo " (slot-base is calculated to 1 as first slot)" - echo "list Lists full storage slots" - echo "loaded Gives slot from where the tape was loaded." - echo " 0 means the tape drive is empty." - echo "slots Gives Number of aviable slots." - echo "" - echo "Example:" - echo " $me /dev/changer load 1 loads a tape from slot 1" - echo "" - exit 2 -} + cat <<EOF +Usage: ${PROGNAME} <changer-device> <cmd> [slot] [tape-device] [drive-index] -# The changer device -if [ -z "$1" ] ; then - usage; -else - CHANGER=$1 -fi -# The command -if [ -z "$2" ] ; then - usage; -else - COMMAND=$2 -fi -# The slot number -if [ ! -z "$3" ]; then - SLOT=$3 - # btape fill says "... slot 1 drive 0" :-( - if [ "$SLOT" = "slot" ]; then - shift - SLOT=$3 - fi -fi -# Set tape device -if [ ! -z "$4" ]; then - TAPE=$4 -fi +Commands (<cmd>): + unload Unload a tape into the slot from where it was loaded + load <slot> Load a tape from the slot <slot> (1-based) + transfer <slot> <slotdst> Transfer a tape from the slot <slot> to + the slot <slotdst> (1-based) + list List full storage slots + listall List all storage slots and drives with source information + loaded Give slot from where the tape was loaded (0 = empty drive) + slots Give number of available slots -# Here you can map bacula drive number to any tape device -# DRIVE is the chio drive number used below by chio! -case $5 in - 0) - # First Drive in Changer is Bacula drive - DRIVE=0 - #TAPE=/dev/bacula-tape - TAPE=/dev/nrsa0 - ;; - 1) - DRIVE=1 - #TAPE=/dev/bacula-tape2 - TAPE=/dev/nrsa1 - ;; -esac +Example: + ${PROGNAME} /dev/ch0 load 1 Load a tape from the slot 1 -# -# Main -# -case ${COMMAND} in - unload) - # enable the following line if you need to eject the cartridge - mt -f ${TAPE} off - sleep 2 - # if we have a slot, try it - if [ ! -z "$SLOT" ]; then - ${MTX} -f ${CHANGER} move drive ${DRIVE} slot $((${SLOT}-1)) - exit $? - fi - # Try other way (works if source element information is valid for drive) - ${MTX} -f ${CHANGER} return drive ${DRIVE} - # If the changer is power cycled with a tape loaded in a drive - # we can compute the slot in case of a complete filled magazine, with - # one slot free. - if [ "$?" != "0" ]; then - free_slot=`${MTX} -f ${CHANGER} stat | grep "^slot " | grep -v "FULL" | awk '{print $2}'` - free_slot=${free_slot%:} - ${MTX} -f ${CHANGER} move drive ${DRIVE} slot $free_slot - fi - ;; +EOF + exit 1 +} - load) - ${MTX} -f ${CHANGER} move slot $((${SLOT}-1)) drive ${DRIVE} - rtn=$? - # Increase the sleep time if you have a slow device - sleep $SLEEP - exit $rtn - ;; +# Default settings +CHANGER=/dev/ch0 +TAPE=/dev/nsa0 +DRIVE=0 - list) - if [ "${SIMULATE_BARCODE}" = "true" ]; then - if [ -f "$BARCODE_FILE" ]; then - cat $BARCODE_FILE | grep -v -e "^#" -e "^$" - exit 0 - else - echo "Barcode file $BARCODE_FILE missing ... exiting!" - exit 1 - fi - else - ${MTX} -f ${CHANGER} status | grep "^slot .*: .*FULL>" | awk '{print $2}' | awk -F: '{print $1+1" "}' | tr -d "[\r\n]" - fi - ;; +CHIO=/bin/chio +MT=/usr/bin/mt - loaded) - # echo "Request loaded" - ${MTX} -f ${CHANGER} status -S > /tmp/mtx.$$ - rtn=$? - # Try to get chio slot source from drive entry - SLOT=$(cat /tmp/mtx.$$ | grep "^drive ${DRIVE}: <FULL> .*slot" | awk '{print $6+1}' | tr -d ">") - if [ -z "$SLOT" ]; then - # This handles the case a source slot is not available (power on - # of the changer with a drive loaded) and all other slots are - # occupied with a tape! - SLOT=$(cat /tmp/mtx.$$ | grep "^slot .*: <ACCESS>" | awk '{print $2+1}') - if [ -z "$SLOT" ]; then - echo 0 - else - echo $SLOT - fi - else - echo $SLOT - fi - # All tapes are in the slots - #cat /tmp/mtx.$$ | grep "^drive ${DRIVE}: .* source: <>" | awk "{print 0}" - rm -f /tmp/mtx.$$ - exit $rtn - ;; +if [ -n "${DEBUG}" ]; then + MSG=$0 + for PAR; do MSG="${MSG} \"${PAR}\""; done + echo `date +"%Y/%m/%d %H:%M:%S"` ${MSG} >> ${DEBUG} +fi - slots) - # echo "Request slots" - ${MTX} -f ${CHANGER} status | grep "^slot " | tail -1 | awk '{print $2+1}' | tr -d ":" - ;; +if [ -n "$1" ]; then + CHANGER=$1; +fi +COMMAND=$2 +SLOT=$3 +SLOTDST=$4 +if [ -n "$4" ]; then + TAPE=$4 +fi +if [ -n "$5" ]; then + DRIVE=$5 +fi - *) - usage - ;; +case ${COMMAND} in +unload) + if [ "${OFFLINE}" = yes ]; then + ${MT} -f ${TAPE} offline + if [ $? = 0 -a -n "${OFFLINE_SLEEP}" ]; then + sleep ${OFFLINE_SLEEP} + fi + fi + if [ -z "${SLOT}" ]; then + ${CHIO} -f ${CHANGER} return drive ${DRIVE} + else + ${CHIO} -f ${CHANGER} move drive ${DRIVE} slot $((${SLOT} - 1)) + fi + if [ $? -ne 0 ]; then + # In case of an error, try to unload the cartridge to the first free slot + FREE=`${CHIO} -f ${CHANGER} status slot | \ + sed -ne '/FULL/d;s/^slot *\([0-9]*\):.*/\1/p' | \ + awk 'BEGIN { n = 0 } { n = $1 + 1; exit } END { print n }'` + if [ ${FREE} -gt 0 ]; then + ${CHIO} -f ${CHANGER} move drive ${DRIVE} slot $((${FREE} - 1)) + else + exit 1 + fi + fi + ;; +load) + if [ -z "${SLOT}" ]; then + usage + fi + ${CHIO} -f ${CHANGER} move slot $((${SLOT} - 1)) drive ${DRIVE} + if [ $? -ne 0 ]; then + exit 1 + fi + if [ -n "${LOAD_SLEEP}" ]; then + sleep ${LOAD_SLEEP} + fi + ;; +transfer) + if [ -z "${SLOT}" -o -z "${SLOTDST}" ]; then + usage + fi + ${CHIO} -f ${CHANGER} move slot $((${SLOT} - 1)) slot $((${SLOTDST} - 1)) + if [ $? -ne 0 ]; then + exit 1 + fi + if [ -n "${MOVE_SLEEP}" ]; then + sleep ${MOVE_SLEEP} + fi + ;; +list) + if [ -z "${FAKE_BARCODES}" ]; then + ${CHIO} -f ${CHANGER} status -v slot | \ + sed -ne 's/^slot *\([0-9]*\):.*FULL.*voltag.*<\([^:]*\):.*/\1:\2/p' | \ + awk -F: '{ print $1 + 1 ":" $2 }' + else + if [ -f "${FAKE_BARCODES}" ]; then + grep -v -e "^#" -e "^$" < ${FAKE_BARCODES} + else + echo "${PROGNAME}: Barcode file ${FAKE_BARCODES} is missing" + exit 1 + fi + fi + ;; +listall) + if [ -z "${FAKE_BARCODES}" ]; then + ${CHIO} -f ${CHANGER} status -vS | \ + sed -ne ' + s/^slot *\([0-9]*\):.*ENAB.*FULL.*voltag.*<\([^:]*\):.*/I:\1:F:\2/p;t + s/^slot *\([0-9]*\):.*FULL.*voltag.*<\([^:]*\):.*/S:\1:F:\2/p;t + s/^drive *\([0-9]*\):.*FULL.*voltag.*<\([^:]*\):.*source.*<[^0-9]*\([0-9]*\)>.*/D:\1:F:\3:\2/p;t + s/^slot *\([0-9]*\):.*ENAB.*voltag.*<\([^:]*\):.*/I:\1:E/p;t + s/^slot *\([0-9]*\):.*voltag.*<\([^:]*\):.*/S:\1:E/p;t + s/^drive *\([0-9]*\):.*voltag.*<\([^:]*\):.*/D:\1:E/p' | \ + awk -F: '{ for (n = 1; n <= NF; n++) printf "%s%s", + (n == ($1 == "D" ? 4 : 2)) ? ($n == "" ? 0 : $n + 1) : $n, + (n == NF) ? "\n" : ":" }' + else + if [ -f "${FAKE_BARCODES}" ]; then + grep -v -e "^#" -e "^$" < ${FAKE_BARCODES} | \ + awk -F: '{ print "S:" $1 (match($2, "^ *$") ? ":E" : ":F:" $2) }' + else + echo "${PROGNAME}: Barcode file ${FAKE_BARCODES} is missing" + exit 1 + fi + fi + ;; +loaded) + # If a tape is loaded, but the source slot is unknown (for example, + # after library reboot), try to report the first free slot + FREE=`${CHIO} -f ${CHANGER} status slot | \ + sed -ne '/FULL/d;s/^slot *\([0-9]*\):.*/\1/p' | \ + awk 'BEGIN { n = 0 } { n = $1 + 1; exit } END { print n }'` + ${CHIO} -f ${CHANGER} status -S drive | \ + sed -ne 's/^drive *'${DRIVE}':.*FULL.*source.*<[^0-9]*\([0-9]*\)>.*/\1/p' \ + | awk 'BEGIN { n = 0 } { n = ($1 == "") ? '${FREE}' : $1 + 1 } \ + END { print n }' + ;; +slots) + ${CHIO} -f ${CHANGER} status | grep -c "^slot " + ;; +*) + usage + ;; esac Modified: head/sysutils/bareos-traymonitor/Makefile ============================================================================== --- head/sysutils/bareos-traymonitor/Makefile Fri May 18 18:57:15 2018 (r470318) +++ head/sysutils/bareos-traymonitor/Makefile Fri May 18 19:00:37 2018 (r470319) @@ -1,17 +1,16 @@ -# Created by: Alonso Cardenas Marquez <acm@FreeBSD.org> # $FreeBSD$ PORTNAME= bareos PKGNAMESUFFIX= -traymonitor -PORTREVISION= 0 +PORTREVISION= 1 COMMENT= Backup archiving recovery open sourced (traymonitor) LIB_DEPENDS+= libqwt.so:x11-toolkits/qwt5 \ libbareos.so:sysutils/bareos-client -CONFLICTS= bacula*-bat-* +CONFLICTS= bacula*-bat-* bareos16-traymonitor-* USES= pkgconfig gettext-runtime desktop-file-utils USE_QT4= qmake_build uic_build moc_build rcc_build gui corelib @@ -29,8 +28,5 @@ CONFIGURE_ARGS+= --enable-traymonitor=yes \ --enable-client-only \ --with-jansson=${LOCALBASE} \ --enable-nls=yes - -OPTIONS_DEFINE= OPENSSL -OPTIONS_DEFAULT=OPENSSL .include "${MASTERDIR}/Makefile" Modified: head/sysutils/bareos16-bat/Makefile ============================================================================== --- head/sysutils/bareos16-bat/Makefile Fri May 18 18:57:15 2018 (r470318) +++ head/sysutils/bareos16-bat/Makefile Fri May 18 19:00:37 2018 (r470319) @@ -2,14 +2,14 @@ PORTNAME= bareos16 PKGNAMESUFFIX= -bat -PORTREVISION= 0 +PORTREVISION= 1 COMMENT= Backup archiving recovery open sourced (GUI) LIB_DEPENDS+= libqwt.so:x11-toolkits/qwt5 \ libbareos.so:sysutils/bareos16-client -CONFLICTS= bacula*-bat-* bareos-bat-* +CONFLICTS= bacula*-bat-* USES= pkgconfig desktop-file-utils USE_QT4= qmake_build uic_build moc_build rcc_build @@ -25,8 +25,5 @@ CONFIGURE_ARGS+= --enable-bat \ --disable-build-dird \ --disable-build-stored \ --enable-client-only - -OPTIONS_DEFINE= OPENSSL -OPTIONS_DEFAULT=OPENSSL .include "${MASTERDIR}/Makefile" Modified: head/sysutils/bareos16-client-static/Makefile ============================================================================== --- head/sysutils/bareos16-client-static/Makefile Fri May 18 18:57:15 2018 (r470318) +++ head/sysutils/bareos16-client-static/Makefile Fri May 18 19:00:37 2018 (r470319) @@ -1,11 +1,13 @@ # $FreeBSD$ PORTNAME= bareos16 -PORTREVISION= 0 +PORTREVISION= 1 PKGNAMESUFFIX= -client-static COMMENT= Backup archiving recovery open sourced (static client) +CONFLICTS= bareos-client-static-* + PLIST= ${.CURDIR}/pkg-plist MASTERDIR= ${.CURDIR}/../../sysutils/bareos16-server @@ -13,7 +15,6 @@ PLIST_FILES= sbin/bareos-fd-static \ sbin/bconsole-static OPTIONS_DEFINE= NLS LMDB -OPTIONS_DEFAULT=# LMDB_DESC= Enable build of LMDB support CONFIGURE_ARGS+= --enable-client-only \ Modified: head/sysutils/bareos16-client/Makefile ============================================================================== --- head/sysutils/bareos16-client/Makefile Fri May 18 18:57:15 2018 (r470318) +++ head/sysutils/bareos16-client/Makefile Fri May 18 19:00:37 2018 (r470319) @@ -1,13 +1,15 @@ # $FreeBSD$ PORTNAME= bareos16 -PORTREVISION= 0 +PORTREVISION= 1 PKGNAMESUFFIX= -client COMMENT= Backup archiving recovery open sourced (client) BROKEN_aarch64= Fails to link: missing sbrk +CONFLICTS= bareos-client-* + WITH_CLIENT_ONLY=yes USE_RC_SUBR= bareos-fd @@ -15,7 +17,6 @@ PLIST= ${PKGDIR}/pkg-plist.client MASTERDIR= ${.CURDIR}/../../sysutils/bareos16-server OPTIONS_DEFINE= NLS PYTHON LMDB SCSICRYPTO -OPTIONS_DEFAULT=# LMDB_DESC= Enable build of LMDB support .include "${MASTERDIR}/Makefile" Modified: head/sysutils/bareos16-server/Makefile ============================================================================== --- head/sysutils/bareos16-server/Makefile Fri May 18 18:57:15 2018 (r470318) +++ head/sysutils/bareos16-server/Makefile Fri May 18 19:00:37 2018 (r470319) @@ -3,7 +3,7 @@ PORTNAME= bareos16 DISTVERSIONPREFIX= Release/ DISTVERSION= 16.2.7 -PORTREVISION?= 0 +PORTREVISION?= 1 CATEGORIES?= sysutils PKGNAMEPREFIX?= # PKGNAMESUFFIX?= -server @@ -20,7 +20,7 @@ GH_PROJECT= ${PORTNAME:S/16//} USES+= libtool:keepla pkgconfig readline:port shebangfix -CONFLICTS?= bacula*-server-* bareos-server* +CONFLICTS?= bacula*-server-* bareos-server-* LIB_DEPENDS+= liblzo2.so:archivers/lzo2 \ libjansson.so:devel/jansson @@ -40,22 +40,29 @@ LDFLAGS+= -L${LOCALBASE}/lib ETCDIR= ${PREFIX}/etc/${PORTNAME:S/16//} -OPTIONS_DEFINE?= MTX PYTHON NDMP NLS OPENSSL SCSICRYPTO -OPTIONS_DEFAULT?= OPENSSL PGSQL SCSICRYPTO +OPTIONS_DEFAULT= OPENSSL +OPTIONS_SINGLE= CRYPTO +OPTIONS_SINGLE_CRYPTO= OPENSSL GNUTLS OPTIONS_SUB= yes +CRYPTO_DESC= Cryptographic library MTX_DESC= Install mtx for control of autochanger devices NDMP_DESC= Enable build of NDMP support SCSICRYPTO_DESC= Build LTO AME crypto plugin .if ${PKGNAMESUFFIX} == "-server" +OPTIONS_DEFINE= MTX PYTHON NDMP NLS SCSICRYPTO +OPTIONS_DEFAULT+= PGSQL SCSICRYPTO OPTIONS_SINGLE_DATABASE= SQLITE3 MYSQL PGSQL -OPTIONS_SINGLE= DATABASE +OPTIONS_SINGLE+= DATABASE DATABASE_DESC= Database support NDMP_CONFIGURE_ON= --enable-ndmp=yes NDMP_CONFIGURE_OFF= --enable-ndmp=no .endif +GNUTLS_CONFIGURE_WITH= gnutls=${LOCALBASE} +GNUTLS_LIB_DEPENDS= libgnutls.so:security/gnutls + OPENSSL_USES= ssl OPENSSL_CONFIGURE_ON= --with-openssl=${OPENSSLBASE} OPENSSL_CONFIGURE_OFF= --with-openssl="no" @@ -200,6 +207,7 @@ post-patch: @${REINPLACE_CMD} -e 's|../../lib/|$$(LOCALBASE)/lib/|g' ${WRKSRC}/src/plugins/dird/Makefile.in ${WRKSRC}/src/plugins/stored/Makefile.in @${REINPLACE_CMD} -e 's|fd_plugins.h|filed/fd_plugins.h|g' -e 's|dir_plugins.h|dird/dir_plugins.h|g' -e 's|stored.h|stored/stored.h|g' \ ${WRKSRC}/src/tools/bpluginfo.c + @${REINPLACE_CMD} -e 's|perl|$(LOCALBASE)/bin/perl|g' ${WRKSRC}/scripts/mtx-changer.in .endif post-extract: Modified: head/sysutils/bareos16-server/files/chio-bareos ============================================================================== --- head/sysutils/bareos16-server/files/chio-bareos Fri May 18 18:57:15 2018 (r470318) +++ head/sysutils/bareos16-server/files/chio-bareos Fri May 18 19:00:37 2018 (r470319) @@ -1,200 +1,190 @@ #!/bin/sh # -# Bacula interface to FreeBSD chio autoloader command with -# multiple drive support -# (By Lars Köller, lars+bacula@koellers.net, 2004) +# BAREOS interface to tape libraries and autoloaders for FreeBSD +# (by Rudolf Cejka <cej...@fit.vutbr.cz>, v1.2, 2012/11/14) # -# If you set in your Device resource +# If you set in your Device resource +# Changer Command = "path-to-this-script/chio-changer %c %o %S %a %d" +# you will have the following input to this script: +# chio-changer "changer-device" "command" "slot" "tape-device" "drive-index" +# $1 $2 $3 $4 $5 +# for example (on a FreeBSD system): +# chio-changer /dev/ch0 load 1 /dev/nsa0 0 # -# Changer Command = "path-to-this-script/chio-bacula" %c %o %S %a -# you will have the following input to this script: +# If you change the script, take care to return either the chio exit +# code or a 0. If the script exits with a non-zero exit code, BAREOS +# will assume the request failed. # -# chio-bacula "changer-device" "command" "slot" "archive-device" "drive-index" -# $1 $2 $3 $4 $5 -# for example: -# -# chio-bacula /dev/sg0 load 1 /dev/nst0 0 (on a FreeBSD system) -# -# If you need to to an offline, refer to the drive as $4 -# e.g. mt -f $f offline -# -# Many changers need an offline after the unload. Also many -# changers need a sleep 60 after the mtx load. -# -# N.B. If you change the script, take care to return either -# the mtx exit code or a 0. If the script exits with a non-zero -# exit code, Bacula will assume the request failed. -# -me=$(basename $0) -# Debug output, take care this file is writeable for user bacula! -#LOG=/var/db/bacula/chio-bacula.log -#exec 2>>$LOG -#echo "------------------------- $(date) Start $(basename $0) -------------------------" >> $LOG -#set -x +PROGNAME=`basename $0` -# Debug -logger -p user.err "$me $@" +# Uncomment the following line, if you want to log debug output. +#DEBUG=/var/run/bareos/${PROGNAME}.log -# This simulates a barcode reader in the changer. -# The labes of the virtual barcode reader are located in the BARCODE_FILE -SIMULATE_BARCODE=true -BARCODE_FILE=/usr/local/etc/bacula/bacula-barcodes -MTX=/bin/chio -# Set default values (see case statement below for -# free mapping of drive index and tape device -# We have a double drive Qualstar where drive 1 is the default bacula drive -#TAPE=/dev/bacula-tape -TAPE=/dev/nrsa0 -DRIVE=0 -# Time to wait for (un)loading -SLEEP=20 +# Uncomment the following line, if you need to eject a tape before moving +# it from the drive. +#OFFLINE=yes +# Uncomment one or more of the following lines, if you need to wait for +# some time (in seconds) after unloading, loading or transferring a tape. +#OFFLINE_SLEEP=10 +#LOAD_SLEEP=10 +#MOVE_SLEEP=10 + +# Uncomment the following line, if you do not have a changer with volume +# reader. +#FAKE_BARCODES=/usr/local/etc/bareos-barcodes + usage() { - echo "" - echo "The $me script for bacula" - echo "--------------------------------------" - echo "" - echo "usage: $me <changer-device> <command> [slot] [devicename of tapedrive] [drive index]" - echo "" - echo "Valid commands:" - echo "" - echo "unload Unloads a tape into the slot" - echo " from where it was loaded." - echo "load <slot> Loads a tape from the slot <slot>" - echo " (slot-base is calculated to 1 as first slot)" - echo "list Lists full storage slots" - echo "loaded Gives slot from where the tape was loaded." - echo " 0 means the tape drive is empty." - echo "slots Gives Number of aviable slots." - echo "" - echo "Example:" - echo " $me /dev/changer load 1 loads a tape from slot 1" - echo "" - exit 2 -} + cat <<EOF +Usage: ${PROGNAME} <changer-device> <cmd> [slot] [tape-device] [drive-index] -# The changer device -if [ -z "$1" ] ; then - usage; -else - CHANGER=$1 -fi -# The command -if [ -z "$2" ] ; then - usage; -else - COMMAND=$2 -fi -# The slot number -if [ ! -z "$3" ]; then - SLOT=$3 - # btape fill says "... slot 1 drive 0" :-( - if [ "$SLOT" = "slot" ]; then - shift - SLOT=$3 - fi -fi -# Set tape device -if [ ! -z "$4" ]; then - TAPE=$4 -fi +Commands (<cmd>): + unload Unload a tape into the slot from where it was loaded + load <slot> Load a tape from the slot <slot> (1-based) + transfer <slot> <slotdst> Transfer a tape from the slot <slot> to + the slot <slotdst> (1-based) + list List full storage slots + listall List all storage slots and drives with source information + loaded Give slot from where the tape was loaded (0 = empty drive) + slots Give number of available slots -# Here you can map bacula drive number to any tape device -# DRIVE is the chio drive number used below by chio! -case $5 in - 0) - # First Drive in Changer is Bacula drive - DRIVE=0 - #TAPE=/dev/bacula-tape - TAPE=/dev/nrsa0 - ;; - 1) - DRIVE=1 - #TAPE=/dev/bacula-tape2 - TAPE=/dev/nrsa1 - ;; -esac +Example: + ${PROGNAME} /dev/ch0 load 1 Load a tape from the slot 1 -# -# Main -# -case ${COMMAND} in - unload) - # enable the following line if you need to eject the cartridge - mt -f ${TAPE} off - sleep 2 - # if we have a slot, try it - if [ ! -z "$SLOT" ]; then - ${MTX} -f ${CHANGER} move drive ${DRIVE} slot $((${SLOT}-1)) - exit $? - fi - # Try other way (works if source element information is valid for drive) - ${MTX} -f ${CHANGER} return drive ${DRIVE} - # If the changer is power cycled with a tape loaded in a drive - # we can compute the slot in case of a complete filled magazine, with - # one slot free. - if [ "$?" != "0" ]; then - free_slot=`${MTX} -f ${CHANGER} stat | grep "^slot " | grep -v "FULL" | awk '{print $2}'` - free_slot=${free_slot%:} - ${MTX} -f ${CHANGER} move drive ${DRIVE} slot $free_slot - fi - ;; +EOF + exit 1 +} - load) - ${MTX} -f ${CHANGER} move slot $((${SLOT}-1)) drive ${DRIVE} - rtn=$? - # Increase the sleep time if you have a slow device - sleep $SLEEP - exit $rtn - ;; +# Default settings +CHANGER=/dev/ch0 +TAPE=/dev/nsa0 +DRIVE=0 - list) - if [ "${SIMULATE_BARCODE}" = "true" ]; then - if [ -f "$BARCODE_FILE" ]; then - cat $BARCODE_FILE | grep -v -e "^#" -e "^$" - exit 0 - else - echo "Barcode file $BARCODE_FILE missing ... exiting!" - exit 1 - fi - else - ${MTX} -f ${CHANGER} status | grep "^slot .*: .*FULL>" | awk '{print $2}' | awk -F: '{print $1+1" "}' | tr -d "[\r\n]" - fi - ;; +CHIO=/bin/chio +MT=/usr/bin/mt - loaded) - # echo "Request loaded" - ${MTX} -f ${CHANGER} status -S > /tmp/mtx.$$ - rtn=$? - # Try to get chio slot source from drive entry - SLOT=$(cat /tmp/mtx.$$ | grep "^drive ${DRIVE}: <FULL> .*slot" | awk '{print $6+1}' | tr -d ">") - if [ -z "$SLOT" ]; then - # This handles the case a source slot is not available (power on - # of the changer with a drive loaded) and all other slots are - # occupied with a tape! - SLOT=$(cat /tmp/mtx.$$ | grep "^slot .*: <ACCESS>" | awk '{print $2+1}') - if [ -z "$SLOT" ]; then - echo 0 - else - echo $SLOT - fi - else - echo $SLOT - fi - # All tapes are in the slots - #cat /tmp/mtx.$$ | grep "^drive ${DRIVE}: .* source: <>" | awk "{print 0}" - rm -f /tmp/mtx.$$ - exit $rtn - ;; +if [ -n "${DEBUG}" ]; then + MSG=$0 + for PAR; do MSG="${MSG} \"${PAR}\""; done + echo `date +"%Y/%m/%d %H:%M:%S"` ${MSG} >> ${DEBUG} +fi - slots) - # echo "Request slots" - ${MTX} -f ${CHANGER} status | grep "^slot " | tail -1 | awk '{print $2+1}' | tr -d ":" - ;; +if [ -n "$1" ]; then + CHANGER=$1; +fi +COMMAND=$2 +SLOT=$3 +SLOTDST=$4 +if [ -n "$4" ]; then + TAPE=$4 +fi +if [ -n "$5" ]; then + DRIVE=$5 +fi - *) - usage - ;; +case ${COMMAND} in +unload) + if [ "${OFFLINE}" = yes ]; then + ${MT} -f ${TAPE} offline + if [ $? = 0 -a -n "${OFFLINE_SLEEP}" ]; then + sleep ${OFFLINE_SLEEP} + fi + fi + if [ -z "${SLOT}" ]; then + ${CHIO} -f ${CHANGER} return drive ${DRIVE} + else + ${CHIO} -f ${CHANGER} move drive ${DRIVE} slot $((${SLOT} - 1)) + fi + if [ $? -ne 0 ]; then + # In case of an error, try to unload the cartridge to the first free slot + FREE=`${CHIO} -f ${CHANGER} status slot | \ + sed -ne '/FULL/d;s/^slot *\([0-9]*\):.*/\1/p' | \ + awk 'BEGIN { n = 0 } { n = $1 + 1; exit } END { print n }'` + if [ ${FREE} -gt 0 ]; then + ${CHIO} -f ${CHANGER} move drive ${DRIVE} slot $((${FREE} - 1)) + else + exit 1 + fi + fi + ;; +load) + if [ -z "${SLOT}" ]; then + usage + fi + ${CHIO} -f ${CHANGER} move slot $((${SLOT} - 1)) drive ${DRIVE} + if [ $? -ne 0 ]; then + exit 1 + fi + if [ -n "${LOAD_SLEEP}" ]; then + sleep ${LOAD_SLEEP} + fi + ;; +transfer) + if [ -z "${SLOT}" -o -z "${SLOTDST}" ]; then + usage + fi + ${CHIO} -f ${CHANGER} move slot $((${SLOT} - 1)) slot $((${SLOTDST} - 1)) + if [ $? -ne 0 ]; then + exit 1 + fi + if [ -n "${MOVE_SLEEP}" ]; then + sleep ${MOVE_SLEEP} + fi + ;; +list) + if [ -z "${FAKE_BARCODES}" ]; then + ${CHIO} -f ${CHANGER} status -v slot | \ + sed -ne 's/^slot *\([0-9]*\):.*FULL.*voltag.*<\([^:]*\):.*/\1:\2/p' | \ + awk -F: '{ print $1 + 1 ":" $2 }' + else + if [ -f "${FAKE_BARCODES}" ]; then + grep -v -e "^#" -e "^$" < ${FAKE_BARCODES} + else + echo "${PROGNAME}: Barcode file ${FAKE_BARCODES} is missing" + exit 1 + fi *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805181900.w4IJ0bBs039665>