From: Kern Sibbald Date: Wed, 17 Mar 2004 22:15:48 +0000 (+0000) Subject: First cut restore GUI X-Git-Tag: Release-1.34.0~47 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=47b68a3348bc5e83f03fac6515cf5f7add8e20cf;p=bacula%2Fbacula First cut restore GUI git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1137 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/examples/autochangers/Sun-desktop-20Gb-4mm-autoloader b/bacula/examples/autochangers/Sun-desktop-20Gb-4mm-autoloader new file mode 100644 index 0000000000..4ffbda58c8 --- /dev/null +++ b/bacula/examples/autochangers/Sun-desktop-20Gb-4mm-autoloader @@ -0,0 +1,43 @@ +From: Lucas Mingarro +To: +Subject: [Bacula-users] Sun Desktop 20Gb 4mm autoloader +Date: Mon, 2 Dec 2002 15:42:43 -0300 (ART) + +Hi, + If you have an old Sun Desktop 20Gb 4mm autoloader (Archive Python +29279) and you want to make it work on Linux with Bacula here are my conf +files. + +I'm using Redhat Linux 7.1 with Bacula 1.26a. + +First add these lines to your stini.def + +manufacturer=ARCHIVE modepl = "Python 29279" { +scsi2logical=0 can-bsr can-partitions auto-lock +mode1 blocksize=0 compression=0 density=0x13 # /dev/nst0 DDS (61000 bpi) +mode2 blocksize=1024 compression=0 density=0x13 # /dev/nst0l DDS (61000 bpi) +mode3 blocksize=0 compression=1 density=0x24 # /dev/nst0m DDS-2 +mode4 blocksize=1024 compression=1 density=0x24 # /dev/nst0a DDS-2 +} + +and Python29279-autoloader.conf + +# +# This is the definition Lucas uses for a +# Sun Desktop 20Gb 4mm autoloader (Archive Python 29279) +# +Device { + Name = "Python 29279" + Media Type = "4mm" + Archive Device = /dev/nst0a + Auto Changer = Yes + Changer Device = /dev/sg0 + Changer Command = "/usr/local/etc/mtx-changer %c %o %S %a" + AutomaticMount = yes; # when device opened, read it + AlwaysOpen = no; +} + +Thats all +Good Luck + +Lucas Mingarro diff --git a/bacula/examples/autochangers/ak-mtx-changer.txt b/bacula/examples/autochangers/ak-mtx-changer.txt new file mode 100644 index 0000000000..671d2335ca --- /dev/null +++ b/bacula/examples/autochangers/ak-mtx-changer.txt @@ -0,0 +1,218 @@ +#!/bin/sh +# +# The use of this script for Totally Automating Tape usage is +# described in the Tips chapter of the manual. +# +# Bacula interface to mtx autoloader +# +# Created OCT/31/03 by Alexander Kuehn, derived from Ludwig Jaffe's script +# +# Works with the HP C1537A L708 DDS3 +# +#set -x +# these are the labels of the tapes in each virtual slot, not the slots! +labels="PSE-0001 PSE-0002 PSE-0003 PSE-0004 PSE-0005 PSE-0006 PSE-0007 PSE-0008 PSE-0009 PSE-0010 PSE-0011 PSE-0012" + +# who to send a mail to? +recipient=root@localhost +logfile=/var/log/mtx.log + +# Delay in seconds how often to check whether a new tape has been inserted +TAPEDELAY=10 # the default is every 10 seconds +echo `date` ":" $@ >>$logfile + +# change this if mt is not in the path (use different quotes!) +mt=`which mt` +grep=`which grep` +# +# how to run the console application? +console="/usr/local/sbin/console -c /usr/local/etc/console.conf" + +command="$1" + +#TAPEDRIVE0 holds the device/name of your 1st and only drive (Bacula supports only 1 drive currently) +#Read TAPEDRIVE from command line parameters +if [ -z "$2" ] ; then + TAPEDRIVE0=/dev/nsa0 +else + TAPEDRIVE0=$2 +fi + +#Read slot from command line parameters +if [ -z "$3" ] ; then + slot=`expr 1` +else + slot=`expr $3` +fi + +if [ -z "$command" ] ; then + echo "" + echo "The mtx-changer script for Bacula" + echo "---------------------------------" + echo "" + echo "usage: mtx-changer [slot]" + echo " mtx-changer" + echo "" + echo "Valid commands:" + echo "" + echo "unload Unloads a tape into the slot" + echo " from where it was loaded." + echo "load Loads a tape from the 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 avialable slots." + echo "volumes List avialable slots and the label of the." + echo " tape in it (slot:volume)" + echo "Example:" + echo " mtx-changer load /dev/nst0 1 loads a tape from slot1" + echo " mtx-changer %a %o %S " + echo "" + exit 0 +fi + + +case "$command" in + unload) + # At first do mt -f /dev/st0 offline to unload the tape + # + # Check if you want to fool me + echo "unmount"|$console >/dev/null 2>/dev/null + echo "mtx-changer: Checking if drive is loaded before we unload. Request unload" >>$logfile + if $mt -f $TAPEDRIVE0 status >/dev/null 2>/dev/null ; then # mt says status ok + echo "mtx-changer: Doing mt -f $TAPEDRIVE0 rewoffl to rewind and unload the tape!" >>$logfile + $mt -f $TAPEDRIVE0 rewoffl + else + echo "mtx-changer: *** Don't fool me! *** The Drive $TAPEDRIVE0 is empty." >>$logfile + fi + exit 0 + ;; + + load) + #Let's check if drive is loaded before we load it + echo "mtx-changer: Checking if drive is loaded before we load. I Request loaded" >>$logfile + LOADEDVOL=`echo "status Storage"|$console|$grep $TAPEDRIVE0|grep ^Device|grep -v "not open."|grep -v "ERR="|grep -v "no Bacula volume is mounted"|sed -e s/^.*Volume\ //|cut -d\" -f2` +# if [ -z "$LOADEDVOL" ] ; then # this is wrong, becaus Bacula would try to use the tape if we mount it! +# LOADEDVOL=`echo "mount"|$console|$grep $TAPEDRIVE0|grep Device|grep -v "not open."|grep -v "ERR="|sed -e s/^.*Volume\ //|cut -d\" -f2` +# if [ -z "$LOADEDVOL" ] ; then +# echo "mtx-changer: The Drive $TAPEDRIVE0 is empty." >>$logfile +# else # restore state? +# if [ $LOADEDVOL = $3 ] ; then # requested Volume mounted -> exit +# echo "mtx-changer: *** Don't fool me! *** Tape $LOADEDVOL is already in drive $TAPEDRIVE0!" >>$logfile +# exit +# else # oops, wrong volume +# echo "unmount"|$console >/dev/null 2>/dev/null +# fi +# fi +# fi + if [ -z "$LOADEDVOL" ] ; then + echo "unmount"|$console >/dev/null 2>/dev/null + LOADEDVOL=0 + else + #Check if you want to fool me + if [ $LOADEDVOL = $3 ] ; then + echo "mtx-changer: *** Don't fool me! *** Tape $LOADEDVOL is already in drive $TAPEDRIVE0!" >>$logfile + exit + fi + echo "mtx-changer: The Drive $TAPEDRIVE0 is loaded with the tape $LOADEDVOL" >>$logfile + echo "mtx-changer: Unmounting..." >>$logfile + echo "unmount"|$console >/dev/null 2>/dev/null + fi + echo "mtx-changer: Unloading..." >>$logfile + echo "mtx-changer: Doing mt -f $TAPEDRIVE0 rewoffl to rewind and unload the tape!" >>$logfile + mt -f $TAPEDRIVE0 rewoffl 2>/dev/null + #Now we can load the drive as desired + echo "mtx-changer: Doing mtx -f $1 $2 $3" >>$logfile + # extract label for the mail + count=`expr 1` + for label in $labels ; do + if [ $slot -eq $count ] ; then volume=$label ; fi + count=`expr $count + 1` + done + + mail -s "Bacula needs volume $volume." $recipient </dev/null 2>/dev/null + while [ $? -ne 0 ] ; do + sleep $TAPEDELAY + $mt status >/dev/null 2>/dev/null + done + mail -s "Bacula says thank you." $recipient <>$logfile + echo "Loading finished." ; >>$logfile + echo "$slot" + exit 0 + ;; + + list) + echo "mtx-changer: Requested list" >>$logfile + LOADEDVOL=`echo "status Storage"|$console|$grep $TAPEDRIVE0|grep ^Device|grep -v "not open."|grep -v "ERR="|grep -v "no Bacula volume is mounted"|sed -e s/^.*Volume\ //|cut -d\" -f2` + if [ -z $LOADEDVOL ] ; then # try mounting + LOADEDVOL=`echo "mount"|$console|$grep $TAPEDRIVE0|grep Device|grep -v "not open."|grep -v "ERR="|sed -e s/^.*Volume\ //|cut -d\" -f2` + if [ -z $LOADEDVOL ] ; then # no luck + LOADEDVOL="_no_tape" + else # restore state + echo "unmount"|$console >/dev/null 2>/dev/null + fi + fi + count=`expr 1` + for label in $labels ; do + if [ "$label" != "$LOADEDVOL" ] ; then + printf "$count " + fi + count=`expr $count + 1` + done + printf "\n" + ;; + + loaded) + echo "mtx-changer: Request loaded, dev $TAPEDRIVE0" >>$logfile + LOADEDVOL=`echo "status Storage"|$console|$grep $TAPEDRIVE0|grep ^Device|grep -v "not open."|grep -v "ERR="|grep -v "no Bacula volume is mounted"|sed -e s/^.*Volume\ //|cut -d\" -f2` + if [ -z $LOADEDVOL ] ; then + LOADEDVOL=`echo "mount"|$console|$grep $TAPEDRIVE0|grep Device|grep -v "not open."|grep -v "ERR="|grep -v "no Bacula volume is mounted"|sed -e s/^.*Volume\ //|cut -d\" -f2` + if [ -z "$LOADEDVOL" ] ; then # no luck + echo "$TAPEDRIVE0 not mounted!" >>$logfile + else # restore state + echo "unmount"|$console >/dev/null 2>/dev/null + fi + fi + if [ -z "$LOADEDVOL" ] ; then + LOADEDVOL="_no_tape" >>$logfile + echo "0" + else + count=`expr 1` + for label in $labels ; do + if [ $LOADEDVOL = $label ] ; then echo $count ; fi + count=`expr $count + 1` + done + fi + exit 0 + ;; + + slots) + echo "mtx-changer: Request slots" >>$logfile + count=`expr 0` + for label in $labels ; do + count=`expr $count + 1` + done + echo $count + ;; + + volumes) + echo "mtx-changer: Request volumes" >>$logfile + count=`expr 1` + for label in $labels ; do + printf "$count:$label " + count=`expr $count + 1` + done + printf "\n" + ;; +esac diff --git a/bacula/examples/autochangers/bacula-barcodes b/bacula/examples/autochangers/bacula-barcodes new file mode 100644 index 0000000000..534101010a --- /dev/null +++ b/bacula/examples/autochangers/bacula-barcodes @@ -0,0 +1,53 @@ +# +# Bacula barcode simulation file +# used by ${PREFIX}/sbin/chio-bacula (FreeBSD) +# +# Contributed by Lars Koeller +# +# The volumenames are returned by the "changer list" command +# labeling in the console is done by "label barcodes" +# (then all volumes belog to the default pool). +# All Lines with an "#" at the bedinning are ignored +# +# !!!! If you export an tape and reinsert another one, +# !!!! don't forget to change the volume name in this file! +# +1:Volume1-100 +2:Volume1-101 +3:Volume1-102 +4:Volume1-103 +5:Volume1-104 +6:Volume1-105 +7:Volume1-106 +8:Volume1-107 +9:Volume1-108 +10:Volume1-109 +11:Volume1-110 +12:Volume1-111 +# +# Further volumes exported from the changer +# +# 36GB AIT2 tapes +#Volume1-100 +#Volume1-101 +#Volume1-102 +#Volume1-103 +#Volume1-104 +#Volume1-105 +#Volume1-106 +#Volume1-107 +#Volume1-108 +#Volume1-109 +#Volume1-110 +#Volume1-111 +#Volume1-112 +#Volume1-113 +#Volume1-114 +#Volume1-115 +# +# 50GB AIT2 tapes +#Volume2-200 +#Volume2-201 +#Volume2-202 +#Volume2-203 +#Volume2-204 diff --git a/bacula/examples/autochangers/chio-bacula b/bacula/examples/autochangers/chio-bacula new file mode 100644 index 0000000000..bd864a6407 --- /dev/null +++ b/bacula/examples/autochangers/chio-bacula @@ -0,0 +1,138 @@ +#!/bin/sh +# +# Bacula interface to mtx autoloader +# (By Lars Koeller, lars+bacula@koellers.net) +# +# If you set in your Device resource +# +# Changer Command = "path-to-this-script/chio-bacula" %c %o %S %a +# you will have the following input to this script: +# +# chio-bacula "changer-device" "command" "slot" "archive-device" +# +# for example: +# +# chio-bacula /dev/sg0 load 1 /dev/nst0 (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. +# + +# 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-barcodes + +me=$(basename $0) + +# Debug +echo "$me $@" > /dev/console + +if [ -z "$1" ] ; then + usage; +fi + +if [ -z "$2" ] ; then + usage; +fi + +MTX=/bin/chio +CHANGER=$1 +COMMAND=$2 +if [ ! -z "$3" ]; then + SLOT=$3 +fi +if [ ! -z "$4" ]; then + TAPE=$4 +else + TAPE=/dev/nrsa2 +fi + +# Time to wait for loading +SLEEP=20 +# What drive of the autochanger should be used primary +# At the moment bacula (1.31a) could not deal with more drives +DRIVE=1 + +usage() +{ + echo "" + echo "The $me script for bacula" + echo "--------------------------------------" + echo "" + echo "usage: $me [slot] [devicename of tapedrive]" + echo "" + echo "Valid commands:" + echo "" + echo "unload Unloads a tape into the slot" + echo " from where it was loaded." + echo "load Loads a tape from the 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 " mtx-changer /dev/changer load 1 loads a tape from slot 1" + echo "" + exit 2 +} + + +case ${COMMAND} in + unload) + # enable the following line if you need to eject the cartridge + #mt -f ${TAPE} off + #sleep 2 + ${MTX} -f ${CHANGER} return drive ${DRIVE} + ;; + + 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 + ;; + + list) + if [ "${SIMULATE_BARCODE}" = "true" ]; then + if [ -f "$BARCODE_FILE" ]; then + cat $BARCODE_FILE | grep -v "^#" + 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 + ;; + + loaded) + # echo "Request loaded" + ${MTX} -f ${CHANGER} status -S > /tmp/mtx.$$ + rtn=$? + cat /tmp/mtx.$$ | grep "^drive ${DRIVE}: " | awk '{print $6+1}' | tr -d ">" + cat /tmp/mtx.$$ | grep "^drive ${DRIVE}: source: <>" | awk "{print 0}" + rm -f /tmp/mtx.$$ + exit $rtn + ;; + + slots) + # echo "Request slots" + ${MTX} -f ${CHANGER} status | grep "^slot " | tail -1 | awk '{print $2+1}' | tr -d ":" + ;; + + *) + usage + ;; +esac diff --git a/bacula/examples/autochangers/chio-changer b/bacula/examples/autochangers/chio-changer new file mode 100644 index 0000000000..5437cba65f --- /dev/null +++ b/bacula/examples/autochangers/chio-changer @@ -0,0 +1,125 @@ +#!/bin/sh +# +# Bacula interface to autoloader +# +# By Pascal Pederiva +# +# Known to work on FreeBSD 5.2 with a TZ875 changer. +# +# This script mimics mtx-changer with the following differences +# - it automatically stows the cartridge to the slot it came from when +# unloading. +# - a load will automatically unload the drive if there is a + different cartridge loaded. +# - it uses chio instead of mtx (which is + available as a package) +# +# If you set in your Device resource +# +# Changer Command = "path-to-this-script/chio-changer" %c %o %S %a +# you will have the following input to this script: +# +# chio-changer "changer-device" "command" "slot" "archive-device" +# +# for example: +# +# chio-changer /dev/sg0 load 1 /dev/nst0 (on a Linux system) +# +# If you need to to an offline, refer to the drive as $4 +# e.g. mt -f $4 offline +# +# Many changers need an offline after the unload. Also many +# changers need a sleep 60 after the chio load. +# +# N.B. 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, Bacula will assume the request failed. +# +# Examples: +# chio-changer load 1 ; load slot 1 into drive 0 (and unload old cartridge if necessary) +# chio-changer unload N ; unload drive into source slot (slot number is ignored) +# chio-changer loaded N ; Return loaded slot # +# chio-changer /dev/ch0 loaded N /dev/nsa0 ; has the same effect + + +#echo `date` "chio: $*" >>/tmp/changer + +# If the first parameter is not a device, assume it is a command +# and you want to use the default changer + +if [ -c $1 ]; then + CHANGER=$1 + shift +else + CHANGER=/dev/ch0 +fi + +COMMAND=$1 +ELEMENT=$2 +DRIVE=$3 + +MTX=chio + +############################################################################## + +case "$COMMAND" in + unload) + +# enable the following line if you need to eject the cartridge +# mt -f $DRIVE offline + SOURCE=`${MTX} status -S | grep drive | grep FULL | cut -d: -f 3 | tr -d '<>a-z '` + if [ ! -z "$SOURCE" ]; then + echo -n "Unloading Data Transfer Element into Storage Element $ELEMENT..." + ${MTX} -f $CHANGER move drive 0 slot $SOURCE + rtn=$? + echo "done" + else + echo "Storage Element $ELEMENT is Already Full" + fi + exit $rtn + ;; + + load) + if [ -z "$ELEMENT" ]; then + echo "ERROR: load reguired" + return 1 + fi + TARGET=$ELEMENT + if [ $TARGET -le 0 ]; then + TARGET=1 + fi + TARGET=`expr $TARGET - 1` + + SOURCE=`${MTX} status -S | grep drive | grep FULL | cut -d: -f 3 | tr -d '<>a-z '` + if [ ! -z "$SOURCE" ]; then + if [ "$SOURCE" != "$TARGET" ]; then + # Only unload if there is something different in the drive + ${MTX} -f $CHANGER move drive 0 slot $SOURCE + fi + fi + + if [ "$SOURCE" != "$TARGET" ]; then + ${MTX} -f $CHANGER move slot $TARGET drive 0 + rtn=$? + fi + exit $rtn + ;; + + list) + ${MTX} -f $CHANGER status slot | grep "FULL" | awk '{print $2+1":"}' + ;; + + loaded) + SOURCE=`${MTX} status -S | grep drive | grep FULL | cut -d: -f 3 | tr -d '<>a-z '` + rtn=$? + if [ -z "$SOURCE" ]; then + SOURCE=-1 + fi + echo `expr 1 + ${SOURCE}` + exit $rtn + ;; + + slots) + ${MTX} -f $CHANGER status slot | wc -l + ;; +esac diff --git a/bacula/examples/autochangers/mtx-changer.Adic-Scalar-100 b/bacula/examples/autochangers/mtx-changer.Adic-Scalar-100 new file mode 100755 index 0000000000..8c09ba3c3d --- /dev/null +++ b/bacula/examples/autochangers/mtx-changer.Adic-Scalar-100 @@ -0,0 +1,1180 @@ +From bacula-users-admin@lists.sourceforge.net Wed Dec 10 15:04:47 2003 +Return-Path: +Received: from sc8-sf-mx1.sourceforge.net (lists.sourceforge.net + [66.35.250.206]) by matou.sibbald.com (8.11.6/8.11.6) with ESMTP id + hBAE4lY32735 for ; Wed, 10 Dec 2003 15:04:47 +0100 +Received: from sc8-sf-list2-b.sourceforge.net ([10.3.1.8] + helo=sc8-sf-list2.sourceforge.net) by sc8-sf-mx1.sourceforge.net with esmtp + (TLSv1:AES256-SHA:256) (Exim 4.24) id 1AU4wc-0007gs-Ls; Wed, 10 Dec 2003 + 06:04:02 -0800 +Received: from localhost.localdomain ([127.0.0.1] + helo=projects.sourceforge.net) by sc8-sf-list2.sourceforge.net with esmtp + (Exim 4.24) id 1AU4wc-0006AC-FQ; Wed, 10 Dec 2003 06:04:02 -0800 +Received: from sc8-sf-mx2-b.sourceforge.net ([10.3.1.12] + helo=sc8-sf-mx2.sourceforge.net) by sc8-sf-list2.sourceforge.net with esmtp + (Exim 4.24) id 1AU4vz-00068m-GL for bacula-users@lists.sourceforge.net; + Wed, 10 Dec 2003 06:03:23 -0800 +Received: from mta2.navair.navy.mil ([192.58.199.164]) by + sc8-sf-mx2.sourceforge.net with esmtp (Exim 4.24) id 1AU4vy-0006U5-2Q for + bacula-users@lists.sourceforge.net; Wed, 10 Dec 2003 06:03:22 -0800 +Received: by mta2.navair.navy.mil (Postfix, from userid 0) id EEB0B16C1FD; + Wed, 10 Dec 2003 09:03:10 -0500 (EST) +Received: from neim02.nawcad.navy.mil (neim02.nawcad.navy.mil + [140.229.37.205]) by mta2.navair.navy.mil (Postfix) with ESMTP id + 64D5116C2A9; Wed, 10 Dec 2003 09:03:10 -0500 (EST) +Received: by neim02.nawcad.navy.mil with Internet Mail Service + (5.5.2657.72) id ; Wed, 10 Dec 2003 09:02:18 -0500 +Message-ID: +From: "Kirkpatrick, Drew (ARINC)" +To: "'terry@mrtux.co.uk'" , bacula-users@lists.sourceforge.net +Subject: RE: [Bacula-users] Re: Autochanger setup +MIME-Version: 1.0 +X-Mailer: Internet Mail Service (5.5.2657.72) +Content-Type: text/plain; charset="ISO-8859-1" +X-Spam-Score: 0.0 (/) +X-Spam-Report: Spam Filtering performed by sourceforge.net. See + http://spamassassin.org/tag/ for more details. Report problems to + https://sf.net/tracker/?func=add&group_id=1&atid=200001 0.0 CLICK_BELOW + Asks you to click below +Sender: bacula-users-admin@lists.sourceforge.net +Errors-To: bacula-users-admin@lists.sourceforge.net +X-BeenThere: bacula-users@lists.sourceforge.net +X-Mailman-Version: 2.0.9-sf.net +Precedence: bulk +List-Unsubscribe: + , + +List-Id: Bacula user's email list for support and discussions + +List-Post: +List-Help: +List-Subscribe: + , + +List-Archive: + +Date: Wed, 10 Dec 2003 09:02:14 -0500 +X-Spam-Score: 0.0 (/) +X-Spam-Report: Spam Filtering performed by sourceforge.net. See + http://spamassassin.org/tag/ for more details. Report problems to + https://sf.net/tracker/?func=add&group_id=1&atid=200001 0.0 CLICK_BELOW + Asks you to click below +Status: RO +X-Status: F +X-Keywords: +X-UID: 76 +Content-Transfer-Encoding: 8bit + +So far this seems to be working for me, but it's not all quite finished :) + +Device { + Name = "firstTapeDrive" + Media Type = AIT3 + Archive Device = /dev/nst0 + Changer Device = /dev/sg3 + Changer Command = "/etc/bacula/mtx-changer %c %o %S %a" + AutoChanger = yes + Backward Space Record = no + RemovableMedia = yes + AlwaysOpen = yes + AutomaticMount = yes + LabelMedia = no +# HardwareEndOfMedium = no +} + + + +And here's the current version of my mtx-changer script (which changes +frequently as I figure out more of this stuff) + +**************************************************************************** +********************** + +#!/bin/bash + +# mtx-changer script modded to work with a Adic Scalar 100 better +# Drew Kirkpatrick, kirkpatricda@navair.navy.mil + + +echo "mtx-change called with: "$@ + + +AUTOLOADERDEV=$1 +DRIVE=0 +DRIVE_0_SEARCH="Data Transfer Element 0" +DRIVE_1_SEARCH="Data Transfer Element 1" +MTX=/usr/local/sbin/mtx + + + + +######################### Functions + + + + +# Take a single argument, a barcode number +# and returns the slot in which said tape +# should reside according to the +# tapeSlotMap file. That file is +# created using the setTapeSlotMap +# script +getSlotNum() +{ + if [ -z "$1" ] + then + echo getSlotNum"() called" \ + "without a parameter, error!!!" + exit 1 + fi + +# makes sure there is an entry in .tapeSlotMap file +# for that barcode number + found=`grep "$1" /etc/bacula/.tapeSlotMap | wc -l | awk '{print $1}'` + + if [ "$found" -ne 1 ] + then + echo "FATAL ERROR, in getSlotNum($1), error looking up" + echo "that barcode number. Found ($found) instances in the" + echo "tapeSlotMap file. There should be 1 instance. Do you" + echo "need to update this file with setTapeSlotMap script???" + exit 1 + fi + + slotNum=`grep "$1" /etc/bacula/.tapeSlotMap | awk '{print $1}'` + return $slotNum +} + + + + + + +# Take 1 arg, a 0 or 1 (or, how about the DRIVE var: ) +# for the drive it is interested in +# returns 1 if that drive has a tape loaded, and 0 if not +doesDriveGottaTape() +{ + if [ -z "$1" ] + then + echo "doesDriveGottaTape() called" \ + "without a parameter, error fool!!!" + exit 1 + else + case "$1" in + 0 ) + ANSWER=`${MTX} -f $AUTOLOADERDEV status | grep +"$DRIVE_0_SEARCH" \ + | awk '{sub("0:",""); print $4}'` + ;; + 1 ) + ANSWER=`${MTX} -f $AUTOLOADERDEV status | grep +"$DRIVE_1_SEARCH" \ + | awk '{sub("1:",""); print $4}'` + ;; + * ) + echo "Invalid drive num passed to +doesDriveGottaTape($1)" + exit 1 + ;; + esac + fi + + case "$ANSWER" in + Full ) + return 1 + ;; + Empty ) + return 0 + ;; + * ) + echo "Fatal error, invalid answer in doesDriveGottaTape(), +$ANSWER" + exit 1 + ;; + esac +} + + + + + + +# This handles 'correctly' unloading a drive to make sure it ends up +# in the slot it originaly came from. If you're moving/adding tapes +# please check the setTapeSlotMap script, and use accordingly +# to update the barcode->slot mappings. +# This function is needed because the Adic Scalar 100 +# doesn't seem to like returning a tape to it's original slot +# everytime. It seems to pick the first available, and I can't +# seem to figure out how to make it stop doing this. +# oh, and it takes 1 arg, the drive to unload +unloadDrive() +{ + if [ -z "$1" ] + then + echo "unloadDrive() called " \ + "without a parameter, error!!!" + exit 1 + fi + + +# double check to see if that drive does actually have a tape in it + doesDriveGottaTape "$1" + rtn=$? + if [ "$rtn" == 0 ] + then + echo "errrm, in unloadDrive($1), that drive " \ + "doesn't have a tape in it!!!" + return 0 + fi + + +# Get the barcode of the tape in the drive + case "$1" in + 0 ) + barcode=`${MTX} -f $AUTOLOADERDEV status | grep +"$DRIVE_0_SEARCH" | awk '{print $10}'` + ;; + 1 ) + barcode=`${MTX} -f $AUTOLOADERDEV status | grep +"$DRIVE_1_SEARCH" | awk '{print $10}'` + ;; + * ) + echo "ERROR, invalid drive num in unloadDrive($1)" + exit 1 + ;; + esac + +# return tape with barcode to which slot??? + getSlotNum "$barcode" + returnTo=$? + + +# unloading the tape now + ${MTX} -f $AUTOLOADERDEV unload $returnTo $1 + rtn=$? + if [ "$rtn" -ne 0 ] + then + echo "MTX came back with code ($rtn)" + echo "ERROR, in unloadDrive($1), mtx unload failed" + exit 1 + fi + return $rtn +} + + + + +# This handles loading tapes into drives +# It checks if there is currently a tape +# in the target drive, and if there is +# it unloads it prior to loading the new tape +# just in case bacula doesn't explicitly +# request this. +# This function take two args, the drive +# to load, and the tape slot to load from +loadDrive() +{ + if [ -z "$1" ] || [ -z "$2" ] + then + echo "loadDrive() not called " \ + "with the correct params, error!!!" + exit 1 + fi + +# Check to see if it already has a tape in it... + doesDriveGottaTape "$1" + rtn=$? + if [ "$rtn" == 1 ] + then + echo "Oops, in loadDrive() that drive" + echo "already has a tape. Unloading it now" + unloadDrive "$1" + fi + + +# You're now ready to load the drive + echo "Now loading tape in slot $2 into drive $1" + + ${MTX} -f $AUTOLOADERDEV load $2 $1 + rtn=$? + if [ "$rtn" -ne 0 ] + then + echo "MTX came back with code ($rtn)" + echo "ERROR, in loadDrive($1, $2), mtx load failed" + exit 1 + fi + return $rtn +} + + + + + +####################### End Functions + + + + +####################### Start Script + +# Changes the nst* device bacula passes to a number that mtx likes +if [ "$2" == load ] || [ "$2" == unload ] +then + echo "In mtx-changer drive selection code...." + case "$4" in + /dev/nst0 ) + DRIVE="0" + ;; + + /dev/nst1 ) + DRIVE="1" + ;; + + * ) + echo "Error, invalid drive for autoloader." + echo "Maybe you mispelled the drive name, or tried to" + echo "use a drive that doesn't exist" + echo "Only two drives handled in /etc/bacula/mtx-changer script" + exit 1 + ;; + esac +fi + + + + +case "$2" in + unload) + unloadDrive "$DRIVE" + rtn=$? + + sleep 35 + exit $rtn + ;; + + load) + loadDrive "$DRIVE" "$3" + rtn=$? + sleep 55 + exit $rtn + ;; + + list) + echo "Requested list, DREW YOU HAVEN'T IMPLEMENTED YET!!!!" + ${MTX} -f $1 status | grep " *Storage Element [0-9]*:.*Full" | \ + awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//" + + rtn=$? + echo "mtx-changer returning value: $rtn" + ;; + + loaded) + echo "Request loaded, DREW YOU HAVEN'T IMPLEMENTED YET!!!!" + ${MTX} -f $1 status >/tmp/mtx.$$ + rtn=$? + cat /tmp/mtx.$$ | grep "^Data Transfer Element 0:Full" | awk "{print +\$7}" + cat /tmp/mtx.$$ | grep "^Data Transfer Element 0:Empty" | awk "{print +0}" +# cat /tmp/mtx.$$ | grep "^Data Transfer Element 1:Full" | awk "{print +\$7}" +# cat /tmp/mtx.$$ | grep "^Data Transfer Element 1:Empty" | awk +"{print 0}" + rm -f /tmp/mtx.$$ + + echo "mtx-changer returning value: $rtn" + exit $rtn + ;; + + slots) + echo "Request slots, DREW YOU HAVEN'T IMPLEMENTED YET!!!!" + ${MTX} -f $1 status | grep " *Storage Changer" | awk "{print \$5}" + rtn=$? + echo "mtx-changer returning value: $rtn" + ;; +esac + + +**************************************************************************** +** + + + + + +Hope that helps. Sorry, it's kinda setup for our Adic, and for two drives. + + + +-Drew + + +-----Original Message----- +From: Terry [mailto:terry@mrtux.co.uk] +Sent: Wednesday, December 10, 2003 8:23 AM +To: bacula-users@lists.sourceforge.net +Subject: [Bacula-users] Re: Autochanger setup + + +bacula-users-request@lists.sourceforge.net wrote: + +>Send Bacula-users mailing list submissions to +> bacula-users@lists.sourceforge.net +> +>To subscribe or unsubscribe via the World Wide Web, visit +> https://lists.sourceforge.net/lists/listinfo/bacula-users +>or, via email, send a message with subject or body 'help' to +> bacula-users-request@lists.sourceforge.net +> +>You can reach the person managing the list at +> bacula-users-admin@lists.sourceforge.net +> +>When replying, please edit your Subject line so it is more specific +>than "Re: Contents of Bacula-users digest..." +> +> +>Today's Topics: +> +> 1. Two beta releases (Kern Sibbald) +> 2. Re: Current Volume "Cinta-0006" not acceptable +> because (Kern Sibbald) +> 3. Re: Jobs awaiting execution? (Kern Sibbald) +> 4. Re: Mount need for every job... me too (Gregory Brauer) +> 5. Importtant: BIG Problems with schedule / bacula doesn't do +Differnetial +> backups (Volker Sauer) +> 6. Re: Mount need for every job... me too (fixed!) (Gregory Brauer) +> +>--__--__-- +> +>Message: 1 +>From: Kern Sibbald +>To: bacula-announce +>Cc: bacula-users +>Organization: +>Date: 09 Dec 2003 22:11:47 +0100 +>Subject: [Bacula-users] Two beta releases +> +>Hello, +> +>I have just made two Beta releases. Unfortunately, I mistakenly put the +>1.32e-08Dec03 Windows binaries in main win-binaries section rather than +>win-binaries-beta. At this point, I won't change it because it would +>require a new upload, ... +> +>The 1.33-08Dec03 release is definitely a Beta release in the sense that +>version 1.33 is still under very active development. The main features +>of this release are: +>- all features in 1.32e-08Dec03 +>- update slots (marks any other Volumes in the same pool with the same +> Slot number as "not InChanger"). This permits retaining the Slot on +> Volumes not currently in the magazine. +>- update slots=,,, ... +> where slot1, slot2 are slot numbers you want updated from barcode +> information and slot-range is a slot-number1-slot-number2 (e.g. 3-5). +>- update slots[=...] scan +> causes the Storage daemon to read the volume label for each slot +> listed, or in the absence of a slot list, all slots occupied. +>- Automatic synchronization of clocks between DIR and FD so that there +> is no missed files due to timezone differences or shewed clocks. +>- A database upgrade is mandatory. +>- None of the daemons are compatible with version 1.32x, which means +> you must upgrade all or nothing. +>- NOTE! FreeBSD users must add: +> Two EOF = yes +> to each of their tape Device resources in the SD. I forgot to document +> this elsewhere!!!!! +> +>Release 1.32e-08Dec03 was meant to be an official 1.32e release with all +>the current patches and a few strategic updates from 1.33. In the end, I +>threw in *all* the updates from 1.33 except those that require a +>database upgrade or force a daemon incompatibility, or other operating +>incompatibility. +> +>I haven't made 1.32-08Dec03 an official release for three reasons: +>- I cannot test it in production because my production system is on +> release 1.33. +>- There is still a bit more documentation to do. +>- I added more of the 1.33 code than I originally planned, but some of +> it such as the new 10 job history for each daemon is so neat that I +> wanted to put it in your hands (one of the features not yet +> documented). +> +>That said, I think this is a very good release. I have HEAVILY tested it +>with my regression testing, and 95% of the code has been running in my +>production 1.33 system since 24 November. I encourage all of you to +>test it. Note, all of the daemons should be totally compatible with any +>other 1.32x release -- please send feedback. +> +>Once I finish the documentation and get some feedback on how it runs, +>I'll "officially" release it. +> +>As most of you know, from tomorrow morning, I will be out for one week +>and then a bit slow responding for a week or two. Thanks for all the +>well wishes I have received. +> +>Regards, Kern +> +> +> +> +> +> +>--__--__-- +> +>Message: 2 +>Subject: Re: [Bacula-users] Current Volume "Cinta-0006" not acceptable +> because +>From: Kern Sibbald +>To: Carlos Molina Molina +>Cc: Phil Stracchino , +> bacula-users +>Organization: +>Date: 09 Dec 2003 22:30:07 +0100 +> +> +>--=-HANNTFvbGW9Q5KQ00dee +>Content-Type: text/plain; charset=ISO-8859-1 +>Content-Transfer-Encoding: quoted-printable +> +>On Tue, 2003-12-09 at 19:03, Carlos Molina Molina wrote: +> +> +>>no, I haven't the volume.... but the only thing that I need from bacula i= +>> +>> +>t's=20 +> +> +>>that write in any volume +>>other thing it's that when finish it send this part of messages. I put "u= +>> +>> +>se=20 +> +> +>>any volume" +>>=20 +>>AZOG: Naboo-Backup.2003-12-09_14.12.07 Warning: Unexpected Client Job=20 +>>message: 2801 End Backup Job TermCode=3D84 JobFiles=3D56064 ReadBytes=3D1= +>> +>> +>501707569=20 +> +> +>>JobBytes=3D621946654 +>>=20 +>>AZOG: Naboo-Backup.2003-12-09_14.12.07 Fatal error: No Job status returne= +>> +>> +>d=20 +> +> +>>from FD. +>>=20 +>>What means??? +>> +>> +> +>I cannot comment on the tape Volume error messages, but the message +>listed above "Unexpected Client Job message ..." seems to me to come +>from the fact that you have upgraded that client (File daemon) to a more +>recent version of Bacula than you are running on your Director. Please +>check your version numbers. If they are both the same number they should +>work together. If not, you need to get them both on the same version. +> +>Be sure to read the ReleaseNotes on any upgrade to ensure you do any +>required database upgrading. +> +>Regards, Kern +> +> +> +> +>>Thank +>>=20 +>> +>> +>>>From: Phil Stracchino +>>>To: bacula-users@lists.sourceforge.net +>>>Subject: Re: [Bacula-users] Current Volume "Cinta-0006" not acceptable=20 +>>>because +>>>Date: Tue, 9 Dec 2003 12:56:43 -0500 +>>> +>>>On Tue, Dec 09, 2003 at 03:47:29PM +0000, Carlos Molina Molina wrote: +>>> +>>> +>>>>How I avoid this message???, The only solution it's that I erase the=20 +>>>> +>>>> +>>>tape +>>> +>>> +>>>>manually... +>>>> +>>>> +>>>>SDT-10000: Naboo-Backup.2003-12-09_12.38.04 Warning: mount.c:232=20 +>>>> +>>>> +>>>Director +>>> +>>> +>>>>wanted Volume "Cinta-0001". +>>>> Current Volume "Cinta-0006" not acceptable because: +>>>> 1997 Volume "Cinta-0006" not in catalog. +>>>>SDT-10000: Please mount Volume "Cinta-0001" on Storage Device=20 +>>>> +>>>> +>>>"SDT-10000" +>>> +>>> +>>>>for Job Naboo-Backup.2003-12-09_12.38.04 +>>>>Use "mount" command to release Job. +>>>> +>>>> +>>>Don't you have the volume it's asking for? +>>> +>>> +>>>-- +>>> .********* Fight Back! It may not be just YOUR life at risk. =20 +>>>*********. +>>> : phil stracchino : unix ronin : renaissance man : mystic zen biker ge= +>>> +>>> +>ek=20 +> +> +>>>: +>>> : alaric@caerllewys.net : alaric-ruthven@earthlink.net : phil@latt.ne= +>>> +>>> +>t =20 +> +> +>>>: +>>> : 2000 CBR929RR, 1991 VFR750F3 (foully murdered), 1986 VF500F (sold)= +>>> +>>> +> =20 +> +> +>>>: +>>> : Linux Now! ...Because friends don't let friends use Microsoft. = +>>> +>>> +> =20 +> +> +>>>: +>>> +>>> +>>>------------------------------------------------------- +>>>This SF.net email is sponsored by: SF.net Giveback Program. +>>>Does SourceForge.net help you be more productive? Does it +>>>help you create better code? SHARE THE LOVE, and help us help +>>>YOU! Click Here: http://sourceforge.net/donate/ +>>>_______________________________________________ +>>>Bacula-users mailing list +>>>Bacula-users@lists.sourceforge.net +>>>https://lists.sourceforge.net/lists/listinfo/bacula-users +>>> +>>> +>>=20 +>>_________________________________________________________________ +>>MSN Amor: busca tu =BD naranja http://latam.msn.com/amor/ +>>=20 +>>=20 +>>=20 +>>------------------------------------------------------- +>>This SF.net email is sponsored by: SF.net Giveback Program. +>>Does SourceForge.net help you be more productive? Does it +>>help you create better code? SHARE THE LOVE, and help us help +>>YOU! Click Here: http://sourceforge.net/donate/ +>>_______________________________________________ +>>Bacula-users mailing list +>>Bacula-users@lists.sourceforge.net +>>https://lists.sourceforge.net/lists/listinfo/bacula-users +>> +>> +> +>--=-HANNTFvbGW9Q5KQ00dee +>Content-Type: application/pgp-signature; name=signature.asc +>Content-Description: This is a digitally signed message part +> +>-----BEGIN PGP SIGNATURE----- +>Version: GnuPG v1.2.1 (GNU/Linux) +> +>iD8DBQA/1j7fNgfoSvWqwEgRAsEDAJ0aF6qvQVHiH0X4DCTwXQh3wux1gACfQLxl +>wKgzEjDQMg3v1vh4yS6kUys= +>=6xcc +>-----END PGP SIGNATURE----- +> +>--=-HANNTFvbGW9Q5KQ00dee-- +> +> +> +>--__--__-- +> +>Message: 3 +>Subject: Re: [Bacula-users] Jobs awaiting execution? +>From: Kern Sibbald +>To: Danie Theron +>Cc: bacula-users +>Organization: +>Date: 09 Dec 2003 22:39:39 +0100 +> +>Hello, +> +>Move up to version 1.32d or 1.32e. The job scheduler was totally +>rewritten between 1.31 and 1.32 and a number of bizarre little problems +>that some people (not me) were having totally went away. I suspect that +>they were pthreads related on non-Linux systems, but who knows ... +> +>Regards, Kern +> +>On Tue, 2003-12-09 at 12:09, Danie Theron wrote: +> +> +>>Hi +>> +>>I have recently split my backups into more manageable sets , and now it +>>seems they are not running automatically. Here is an output when I do a +>>"status" command : +>> +>>Last Job BackupCatalog.2003-12-09_01.10.00 finished at 09-Dec-2003 01:10 +>> Files=1 Bytes=43,308,017 Termination Status=OK +>>Console connected at 09-Dec-2003 19:06 +>>JobId 132 Job prometheus-rapstech.2003-12-09_19.00.03 is waiting +>>execution. +>>JobId 131 Job prometheus-consult-gis.2003-12-09_19.00.02 is waiting +>>execution. +>>JobId 130 Job prometheus-consult-documents.2003-12-09_19.00.01 is +>>waiting on max +>> Client jobs. +>>JobId 129 Job prometheus-system.2003-12-09_19.00.00 is running. +>>Level Type Scheduled Name +>>================================================================= +>>Incremental Backup 10-Dec-2003 19:00 prometheus-system +>>Incremental Backup 10-Dec-2003 19:00 prometheus-consult-documents +>>Incremental Backup 10-Dec-2003 19:00 prometheus-consult-gis +>>Incremental Backup 10-Dec-2003 19:00 prometheus-rapstech +>>Full Backup 10-Dec-2003 01:10 BackupCatalog +>>==== +>>Connecting to Storage daemon File at localhost:9103 +>> +>>prometheus-sd Version: 1.31a (02 Aug 2003) +>>Daemon started 08-Dec-2003 19:30, 3 Jobs run. +>>Last Job BackupCatalog.2003-12-09_01.10.00 finished at 09-Dec-2003 01:10 +>> Files=1 Bytes=43,308,119 Termination Status=OK +>>Device /data/server is mounted with Volume "backup" +>> Total Bytes=791,751,921 Blocks=12,274 Bytes/block=64,506 +>> Positioned at File=0 Block=9,351 +>>Device /data/server is not open. +>>Device /data/server is not open. +>>Device /data/server is not open. +>>Device /data/server is not open. +>>Full Backup job backup using Volume +>>"prometheus-system.2003-12-09_19.00.00" on d +>>evice /data/server +>> Files=15,341 Bytes=602,255,638 Bytes/sec=1,517,016 +>> FDReadSeqNo=134,036 in_msg=96746 out_msg=5 fd=6 +>> +>> +>>When I manually run a job it backups fine. +>> +>>Ta in advance +>>Daniel +>> +>> +>> +>>------------------------------------------------------- +>>This SF.net email is sponsored by: SF.net Giveback Program. +>>Does SourceForge.net help you be more productive? Does it +>>help you create better code? SHARE THE LOVE, and help us help +>>YOU! Click Here: http://sourceforge.net/donate/ +>>_______________________________________________ +>>Bacula-users mailing list +>>Bacula-users@lists.sourceforge.net +>>https://lists.sourceforge.net/lists/listinfo/bacula-users +>> +>> +> +> +> +>--__--__-- +> +>Message: 4 +>Date: Tue, 09 Dec 2003 14:57:32 -0800 +>From: Gregory Brauer +>To: bacula-users +>Subject: Re: [Bacula-users] Mount need for every job... me too +> +> +>I have looked at all of the comments in this thread, but I +>am also having this problem and cannot seem to fix it. +>I am using an autochanger that blocks waiting for me to type +>the "mount" command every time it autoloads a tape. It +>worked fine for me with 1.31, but has been doing this +>since I upgraded to 1.32d. Here are some excerpts from my +>configuration: +> +> +> From bacula-dir.conf: +> +>Storage { +> Autochanger = yes +> Name = "kiev AIT2 Autoloader" +> Address = kiev +> SDPort = 9103 +> Password = "yV3C5gZXhF/RrYadlwKWnwAbTV1oUCXVqUIrAaUjMov+" +> Device = "AIT2 Autoloader" +> MediaType = "AIT2" +>} +> +> +> From bacula-sd.conf: +> +>Device { +> Autochanger = yes +> Changer Device = /dev/sg0 +> Changer Command = "/etc/bacula/mtx-changer %c %o %S %a" +> Name = "AIT2 Autoloader" +> Media Type = "AIT2" +> Archive Device = /dev/nst0 +> Hardware end of medium = No; +> Automatic Mount = yes; +> Always Open = yes; +> Removable Media = yes; +>} +> +>I had tried this with both Always Open = yes, and no... it worked fine +>with "no" under 1.31. +> +> +>I have also noticed that every time bacula issues a "load slot" command, +>I get an error message saying mtx-changer exited 1. +> +> +>09-Dec-2003 14:42 kiev-sd: 3303 Issuing autochanger "load slot 15" command. +>09-Dec-2003 14:44 kiev-sd: 3992 Bad autochanger "load slot" status=1. +> +> +>But if I run mtx-changer manually from the command line, it always +>seems to exit 0, so I'm not sure where bacula is seeing this error. +> +> +>basic [root@kiev bacula]$ ./mtx-changer /dev/sg0 load 15 /dev/nst0 +>basic [root@kiev bacula]$ echo $status +>0 +> +> +>I have tried increasing my sleep time on load to arbitrarily high +>values, but that hasn't helped. +> +> +> load) +># echo "Doing mtx -f $1 load $3" +> ${MTX} -f $1 load $3 +> rtn=$? +># +># Increase the sleep time if you have a slow device +> #sleep 15 +> sleep 120 +> exit $rtn +> ;; +> +> +>What else can I check? +> +>Greg +> +> +> +>--__--__-- +> +>Message: 5 +>Date: Wed, 10 Dec 2003 00:48:19 +0100 +>From: Volker Sauer +>To: Kern Sibbald , +> bacula-users +>Subject: [Bacula-users] Importtant: BIG Problems with schedule / bacula +doesn't do Differnetial +> backups +> +>This is an OpenPGP/MIME signed message (RFC 2440 and 3156) +>--------------enig1AEBD91EBCB59C2EB43FEF98 +>Content-Type: text/plain; charset=us-ascii; format=flowed +>Content-Transfer-Encoding: 7bit +> +>Hallo Kern, +> +>as I already worried about in 2 other mails is now proven: +> +>Bacula doesn't do a diffential backup! +> +>My schedule is this: +> +>Schedule { +> Name = "WeeklyCycle" +> Run = Level=Full Pool=Full 1st tue at 2:00pm +> Run = Level=Differential Pool=Full 2nd-5th tue at 7:00pm +> Run = Level=Incremental Pool=Inc wed-mon at 7:00pm +>} +> +> +>and this is what list jobs says (I hope you can read that): +> +> +>| 55 | Zaphod | 2003-12-02 14:00:04 | B | F | +>504,634 | 20,669,282,940 | T | +>| 56 | Arthur | 2003-12-02 16:31:30 | B | F | +>380,719 | 15,498,385,751 | T | +>| 57 | Alexis | 2003-12-02 18:23:45 | B | F | +>167,710 | 5,157,651,432 | T | +>| 58 | BackupCatalog | 2003-12-02 19:23:13 | B | F | +> 1 | 404,663,640 | T | +>| 59 | ReminderIncCartridge | 2003-12-03 08:00:05 | D | F | +> 0 | 0 | T | +>| 60 | Zaphod | 2003-12-03 19:00:04 | B | I | +> 693 | 262,166,208 | T | +>| 61 | Arthur | 2003-12-03 19:12:57 | B | I | +> 314 | 889,290,521 | T | +>| 62 | Alexis | 2003-12-03 19:24:46 | B | I | +> 748 | 56,013,471 | T | +>| 63 | BackupCatalog | 2003-12-03 22:00:04 | B | F | +> 1 | 404,846,132 | T | +>| 64 | Zaphod | 2003-12-04 19:00:05 | B | I | +> 740 | 385,140,941 | T | +>| 65 | Arthur | 2003-12-04 19:16:03 | B | I | +> 441 | 904,698,439 | T | +>| 66 | Alexis | 2003-12-04 19:28:09 | B | I | +> 669 | 68,876,161 | T | +>| 67 | BackupCatalog | 2003-12-04 22:00:04 | B | F | +> 1 | 253,231,104 | E | +>| 68 | BackupCatalog | 0000-00-00 00:00:00 | B | I | +> 0 | 0 | C | +>| 69 | BackupCatalog | 0000-00-00 00:00:00 | B | I | +> 0 | 0 | C | +>| 70 | BackupCatalog | 2003-12-05 01:25:19 | B | I | +> 1 | 405,045,253 | T | +>| 71 | Zaphod | 2003-12-05 19:00:04 | B | I | +> 8,389 | 373,643,708 | T | +>| 72 | Arthur | 2003-12-05 19:13:59 | B | I | +> 6,904 | 1,007,785,097 | T | +>| 73 | Alexis | 2003-12-05 19:28:23 | B | I | +> 4,085 | 114,727,583 | T | +>| 74 | BackupCatalog | 2003-12-05 22:00:04 | B | F | +> 1 | 407,222,289 | T | +>| 75 | Zaphod | 2003-12-06 19:00:05 | B | I | +> 923 | 175,466,045 | T | +>| 76 | Arthur | 2003-12-06 19:14:01 | B | I | +> 1,872 | 516,372,637 | T | +>| 77 | Alexis | 2003-12-06 19:25:01 | B | I | +> 5,422 | 190,847,977 | T | +>| 78 | BackupCatalog | 2003-12-06 22:00:04 | B | F | +> 1 | 408,121,544 | T | +>| 79 | Zaphod | 2003-12-07 19:00:04 | B | I | +> 1,347 | 93,787,356 | T | +>| 80 | Arthur | 2003-12-07 19:12:06 | B | I | +> 705 | 496,647,729 | T | +>| 81 | Alexis | 2003-12-07 19:25:08 | B | I | +> 1,414 | 102,756,100 | T | +>| 82 | BackupCatalog | 2003-12-07 22:00:04 | B | F | +> 1 | 408,519,580 | T | +>| 83 | Zaphod | 2003-12-08 19:00:05 | B | I | +> 4,428 | 461,132,237 | T | +>| 84 | Arthur | 2003-12-08 19:15:59 | B | I | +> 307 | 384,713,540 | T | +>| 85 | Alexis | 2003-12-08 19:25:56 | B | I | +> 708 | 78,420,311 | T | +>| 86 | BackupCatalog | 2003-12-08 22:00:04 | B | F | +> 1 | 409,139,688 | T | +>| 87 | ReminderFullCartridge | 2003-12-09 06:00:05 | D | F | +> 0 | 0 | T | +>| 88 | Zaphod | 2003-12-09 19:00:05 | B | F | +>507,058 | 21,050,750,780 | T | +>| 89 | Arthur | 2003-12-09 21:27:07 | B | F | +>382,397 | 15,246,847,324 | T | +>| 90 | Alexis | 2003-12-09 23:18:30 | B | F | +>167,868 | 4,595,334,742 | T | +>| 91 | BackupCatalog | 2003-12-10 00:10:05 | B | F | +> 1 | 528,055,685 | T | +>+-------+-----------------------+---------------------+------+-------+----- +-----+----------------+-----------+ +>* +> +>Bacula did a FullBackup on December 2nd, which was the first Tuesday in +>this month. Correct. Then it did Incremenatial backups from 3rd until +>8th. Also correct. +>Yesterday, on December 9th - according to my schedule there should have +>been a differential backup!! But as you can see above, bacula did a Full +>backup - without reason, I think!! +>(This brings real big problems to my storage managment, because I don't +>have enough space for 4 Full-Backups a month. I urgently need diffential +>backups in the conecept) +>Could the cause be, that there's a pool change! Should the diffential +>backup better go to the inc-pool?? +> +>Please help!! +> +>Regards +>Volker +> +>P.S.: this is the job output of the jobs from Tue 9th, which should have +>been differential: +> +> +>z217-dir: Start Backup JobId 88, Job=Zaphod.2003-12-09_19.00.00 +>z217-sd: 3301 Issuing autochanger "loaded" command. +>z217-sd: Volume "F-6" previously written, moving to end of data. +>z217-sd: Ready to append to end of Volume at file=6. +>z217-sd: block.c:480 End of medium on device /dev/tape. Write of 64512 +>bytes got 32768. +>z217-sd: End of medium on Volume "F-6" Bytes=23,935,131,136 +>Blocks=371,020 at 09-Dec-2003 21:06. +>z217-sd: 3301 Issuing autochanger "loaded" command. +>z217-sd: 3302 Issuing autochanger "unload" command. +>z217-sd: 3303 Issuing autochanger "load slot 7" command. +>z217-sd: 3304 Autochanger "load slot 7" status is OK. +>z217-sd: Wrote label to prelabeled Volume "F-7" on device /dev/tape +>z217-sd: New volume "F-7" mounted on device /dev/tape at 09-Dec-2003 21:08. +>z217-dir: Bacula 1.32d (02Nov03): 09-Dec-2003 21:27 +>JobId: 88 +>Job: Zaphod.2003-12-09_19.00.00 +>Backup Level: Full +>Client: zaphod-fd +>FileSet: "Set Zaphod" 2003-11-21 16:32:26 +>Start time: 09-Dec-2003 19:00 +>End time: 09-Dec-2003 21:27 +>FD Files Written: 507,058 +>SD Files Written: 507,058 +>FD Bytes Written: 21,050,750,780 +>SD Bytes Written: 21,121,287,812 +>Rate: 2387.2 KB/s +>Software Compression: None +>Volume name(s): F-6|F-7 +>Volume Session Id: 14 +>Volume Session Time: 1070650983 +>Last Volume Bytes: 2,327,668,804 +>Non-fatal FD errors: 0 +>SD Errors: 0 +>FD termination status: OK +>SD termination status: OK +>Termination: Backup OK +> +>z217-dir: Begin pruning Jobs. +>z217-dir: No Jobs found to prune. +>z217-dir: Begin pruning Files. +>z217-dir: No Files found to prune. +>z217-dir: End auto prune. +> +> +> +>z217-dir: Start Backup JobId 89, Job=Arthur.2003-12-09_19.00.01 +>z217-dir: Bacula 1.32d (02Nov03): 09-Dec-2003 23:18 +>JobId: 89 +>Job: Arthur.2003-12-09_19.00.01 +>Backup Level: Full +>Client: z217-fd +>FileSet: "Set Arthur" 2003-11-21 18:47:14 +>Start time: 09-Dec-2003 21:27 +>End time: 09-Dec-2003 23:18 +>FD Files Written: 382,397 +>SD Files Written: 382,397 +>FD Bytes Written: 15,246,847,324 +>SD Bytes Written: 15,300,937,041 +>Rate: 2283.1 KB/s +>Software Compression: None +>Volume name(s): F-7 +>Volume Session Id: 15 +>Volume Session Time: 1070650983 +>Last Volume Bytes: 17,654,556,715 +>Non-fatal FD errors: 0 +>SD Errors: 0 +>FD termination status: OK +>SD termination status: OK +>Termination: Backup OK +> +>z217-dir: Begin pruning Jobs. +>z217-dir: No Jobs found to prune. +>z217-dir: Begin pruning Files. +>z217-dir: No Files found to prune. +>z217-dir: End auto prune. +> +> +> +>z217-dir: Start Backup JobId 90, Job=Alexis.2003-12-09_19.00.02 +>z217-dir: Bacula 1.32d (02Nov03): 10-Dec-2003 00:10 +>JobId: 90 +>Job: Alexis.2003-12-09_19.00.02 +>Backup Level: Full +>Client: alexis-fd +>FileSet: "Set Alexis" 2003-11-21 20:58:58 +>Start time: 09-Dec-2003 23:18 +>End time: 10-Dec-2003 00:10 +>FD Files Written: 167,868 +>SD Files Written: 167,868 +>FD Bytes Written: 4,595,334,742 +>SD Bytes Written: 4,616,435,343 +>Rate: 1487.2 KB/s +>Software Compression: None +>Volume name(s): F-7 +>Volume Session Id: 16 +>Volume Session Time: 1070650983 +>Last Volume Bytes: 22,280,313,500 +>Non-fatal FD errors: 0 +>SD Errors: 0 +>FD termination status: OK +>SD termination status: OK +>Termination: Backup OK +> +>z217-dir: Begin pruning Jobs. +>z217-dir: No Jobs found to prune. +>z217-dir: Begin pruning Files. +>z217-dir: No Files found to prune. +>z217-dir: End auto prune. +> +> +I'm trying to setup a surestore 12000e autochanger so far in my +bacula-sd.conf i have added this +Device { + Name = autochanger # + Media Type = DDS-2 + Archive Device = /dev/sa1 + AutomaticMount = yes; # when device opened, read it + AlwaysOpen = yes; + LabelMedia = yes; + RemovableMedia = yes; + Autochanger = yes; + Changer Device = /dev/pass0 #changer device +} +But i need to make an entry for the Changer Command = .I have +installed mtx but there are no sample files to be found or any +bacula samples for autochangers +Cheers Terry + + + + +------------------------------------------------------- +This SF.net email is sponsored by: SF.net Giveback Program. +Does SourceForge.net help you be more productive? Does it +help you create better code? SHARE THE LOVE, and help us help +YOU! Click Here: http://sourceforge.net/donate/ +_______________________________________________ +Bacula-users mailing list +Bacula-users@lists.sourceforge.net +https://lists.sourceforge.net/lists/listinfo/bacula-users + + +------------------------------------------------------- +This SF.net email is sponsored by: SF.net Giveback Program. +Does SourceForge.net help you be more productive? Does it +help you create better code? SHARE THE LOVE, and help us help +YOU! Click Here: http://sourceforge.net/donate/ +_______________________________________________ +Bacula-users mailing list +Bacula-users@lists.sourceforge.net +https://lists.sourceforge.net/lists/listinfo/bacula-users diff --git a/bacula/examples/autochangers/mtx-changer.Adic-Scalar-24 b/bacula/examples/autochangers/mtx-changer.Adic-Scalar-24 new file mode 100755 index 0000000000..16577cd605 --- /dev/null +++ b/bacula/examples/autochangers/mtx-changer.Adic-Scalar-24 @@ -0,0 +1,40 @@ +#!/bin/sh +# +# Bacula interface to mtx autoloader +# +# mtx-changer "changer-device" "command" "slot" +# +# Modified for Adic Scalar 24 with one LTO drive by +# M. Ludovic Strappozon +# +case "$2" in + unload) +# echo "Doing mtx -f $1 $2" + mtx -f $1 $2 + ;; + + load) +# echo "Doing mtx -f $1 $2 $3" + mtx -f $1 $2 $3 + sleep 20 + ;; + + list) +# echo "Requested list" +# mtx -f $1 status | grep " *Storage Element [0-9]*:.*Full" | awk "{print \$3}" | sed "s/:.*$/ /g" | tr -d "[\r\n]" + mtx -f $1 status | grep " *Storage Element [0-9]*:.*Full" | awk "{print \$3 \$4}" | sed "s/Full *\(:VolumeTag=\)*//" + ;; + + loaded) +# echo "Request loaded" + mtx -f $1 status >/tmp/mtx.$$ + cat /tmp/mtx.$$ | grep "^Data Transfer Element 0:Full" | awk "{print \$7}" + cat /tmp/mtx.$$ | grep "^Data Transfer Element 0:Empty" | awk "{print 0}" + rm -f /tmp/mtx.$$ + ;; + + slots) +# echo "Request slots" + mtx -f $1 status | grep " *Storage Changer" | awk "{print \$5}" + ;; +esac diff --git a/bacula/examples/autochangers/mtx-changer.StorageTek-HPA4853 b/bacula/examples/autochangers/mtx-changer.StorageTek-HPA4853 new file mode 100755 index 0000000000..d2eacf96a2 --- /dev/null +++ b/bacula/examples/autochangers/mtx-changer.StorageTek-HPA4853 @@ -0,0 +1,137 @@ +#!/bin/sh +# +# Bacula interface to mtx autoloader +# +# Created JAN/23/02 by Ludwig Jaffe +# +# Works with the HP A4853 DLT Library +# and the Storagetek Timberwolf 9730 DLT Library +# +#TAPEDRIVE0 holds the device/name of your 1st and only DLT drive (Bacula supports only 1 drive currently) +# +#Read TAPEDRIVE from command line parameters +if [ -z "$4" ] ; then + TAPEDRIVE0=/dev/st0 +else + TAPEDRIVE0=$4 +fi + +#Delay in seconds the tape needs to load the tape. Needed to stop bacula from using the tape too early. +TAPEDELAY=65 #The StorageTek Timberwolf 9730 with DLT7000 needs approx. 50 seconds to load. 65 sec gives safety +MTXCHVERBOSE=1 +if [ -z "$1" ] ; then + echo "" + echo "The mtx-changer script for bacula" + echo "---------------------------------" + echo "" + echo "usage: mtx-changer [slot] [devicename of tapedrive]" + echo " mtx-changer" + echo "" + echo "Valid commands:" + echo "" + echo "unload Unloads a tape into the slot" + echo " from where it was loaded." + echo "load Loads a tape from the 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 " mtx-changer /dev/changer load 1 loads a tape from slot1" + echo "" + exit +fi + + +case "$2" in + unload) +# At first do mt -f /dev/st0 offline to unload the tape because HP A4853 aka Timberwolf9730 +# refuses to unload the tape from the drive if the DLT streamer did not unloaded it!!! +# + #Check if you want to fool me + if [ $MTXCHVERBOSE -eq 1 ] ; then echo "mtx-changer: Checking if drive is loaded before we unload. I Request loaded" ; fi + mtx -f $1 status >/tmp/mtx.$$ + rm -f /tmp/mtxloaded + cat /tmp/mtx.$$ | grep "^Data Transfer Element 0:Full" | awk "{print \$7}" > /tmp/mtxloaded + rm -f /tmp/mtx.$$ + read LOADEDVOL /tmp/mtx.$$ + rm -f /tmp/mtxloaded + cat /tmp/mtx.$$ | grep "^Data Transfer Element 0:Full" | awk "{print \$7}" > /tmp/mtxloaded + rm -f /tmp/mtx.$$ + read LOADEDVOL /tmp/mtx.$$ + cat /tmp/mtx.$$ | grep "^Data Transfer Element 0:Full" | awk "{print \$7}" + cat /tmp/mtx.$$ | grep "^Data Transfer Element 0:Empty" | awk "{print 0}" + rm -f /tmp/mtx.$$ + ;; + + slots) + if [ $MTXCHVERBOSE -eq 1 ] ; then echo "mtx-changer: Request slots" ; fi + mtx -f $1 status | grep "[ ]Storage Changer" | awk "{print \$5}" + ;; +esac diff --git a/bacula/examples/backup-acls.txt b/bacula/examples/backup-acls.txt new file mode 100644 index 0000000000..8aa1f4ff5b --- /dev/null +++ b/bacula/examples/backup-acls.txt @@ -0,0 +1,22 @@ +From: Volker Sauer +To: =?ISO-8859-1?Q?Daniel_Ch=E9nard?= +CC: Bacula users +Subject: Re: [Bacula-users] Bacula and the ACL +Date: Tue, 20 Jan 2004 23:32:52 +0100 + +You could use a script like that to dump the acls to a file which you +could restore with "setfacl --restore=" in case of a restore. + + +#!/bin/bash + +BACKUP_DIRS="/foo /bar" + +STORE_ACL=/root/acl-backup +umask 077 + +for i in $BACKUP_DIRS; do + cd $i + /usr/bin/getfacl -R --skip-base . >$STORE_ACL/${i//\//_} +done + diff --git a/bacula/examples/conf/bacula-dir.conf b/bacula/examples/conf/bacula-dir.conf new file mode 100644 index 0000000000..c3188e6a24 --- /dev/null +++ b/bacula/examples/conf/bacula-dir.conf @@ -0,0 +1,449 @@ +# +# Kerns Production Bacula Director Daemon Configuration file +# + +Director { + Name = HeadMan + DIRport = 9101 # where we listen for UA connections + QueryFile = "/home/bacula/bin/query.sql" + WorkingDirectory = "/home/bacula/bin/working" + PidDirectory = "/home/bacula/bin/working" + SubSysDirectory = "/home/bacula/bin/working" + Maximum Concurrent Jobs = 1 + Password = +} + +Schedule { + Name = "PolyMatouWeeklyCycle" + Run = Level=Full sun at 1:05 + Run = Level=Incremental mon-sat at 1:05 +} + +Schedule { + Name = "MatouWeeklyCycle" + Run = Level=Full 1st sat at 1:05 + Run = Level=Differential 2nd-5th sat at 1:05 + Run = Level=Incremental sun-fri at 1:05 +} + +Schedule { + Name = "VerifyCycle" + Run = Level=Catalog sun-sat at 5:05 +} + + +Schedule { + Name = "MinimatouWeeklyCycle" + Run = Level=Full fri at 1:05 + Run = Level=Incremental sat-thu at 1:05 +} + +Schedule { + Name = "MinouWeeklyCycle" + Run = Level=Full thu at 1:05 + Run = Level=Incremental fri-wed at 1:05 +} + +Schedule { + Name = "RufusWeeklyCycle" + Run = Level=Full 1st mon at 1:05 + Run = Level=Differential 2nd-5th mon at 1:05 + Run = Level=Incremental tue-sun at 1:05 +} + +Schedule { + Name = "CatalogSched" + Run = Level=Full sun-sat at 1:10 +} + +Schedule { + Name = "Watchdog" + Run = Level=Full sun-sat at 6:05 +} + + +Job { + Name = "Matou" + Type = Backup + Level = Incremental + Client=Matou + FileSet="Matou Set" + Messages = Standard + Storage = DLTDrive + Pool = Default + Schedule = "MatouWeeklyCycle" + Write Bootstrap = "/mnt/deuter/files/backup/matou.bsr" + Priority = 10 +} + +Job { + Name = "Polymatou" + Type = Backup + Level = Incremental + Client=Polymatou + FileSet="Full Set" + Messages = Standard + Storage = DLTDrive + Pool = Default + Schedule = "PolyMatouWeeklyCycle" + Write Bootstrap = "/mnt/deuter/files/backup/pmatou.bsr" + Priority = 10 +} + +Job { + Name = "Rufus" + Type = Backup + Level = Incremental + Client=Rufus + FileSet="RufusAll" + Messages = Standard + Storage = DLTDrive + Pool = Default + Schedule = "RufusWeeklyCycle" + Write Bootstrap = "/mnt/deuter/files/backup/rufus.bsr" + Priority = 10 +} + +Job { + Name = "Minimatou" + Type = Backup + Level = Incremental + Client=Minimatou + FileSet="Win32 Full Set" + Messages = Standard + Storage = DLTDrive + Pool = Default + Schedule = "MinimatouWeeklyCycle" + Write Bootstrap = "/mnt/deuter/files/backup/mmatou.bsr" + Priority = 11 +} + +Job { + Name = "Minou" + Type = Backup + Level = Incremental + Client=Minou + FileSet="Minou Full Set" + Messages = Standard + Storage = DLTDrive + Pool = Default + Schedule = "MinouWeeklyCycle" + Write Bootstrap = "/mnt/deuter/files/backup/minou.bsr" + Priority = 11 +} + +Job { + Name = "PmatouVerify" + Type = Verify + Level = Catalog + Client=PmatouVerify + FileSet="Verify Set" + Messages = Standard + Storage = DLTDrive + Pool = Default + Schedule = "VerifyCycle" + Priority = 20 # run after backups +} + +Job { + Name = "MatouVerify" + Type = Verify + Level = Catalog + Client=MatouVerify + FileSet="Verify Set" + Messages = Standard + Storage = DLTDrive + Pool = Default + Schedule = "VerifyCycle" + Priority = 20 +} + +Job { + Name = "RufusVerify" + Type = Verify + Level = Catalog + Client=RufusVerify + FileSet="Verify Set" + Messages = Standard + Storage = DLTDrive + Pool = Default + Schedule = "VerifyCycle" + Priority = 20 +} + +Job { + Name = "CatalogBackup" + Type = Backup + Level = Full + Client = Polymatou + FileSet = "CatalogFile" + Messages = Standard + Storage = DLTDrive + Pool = Default + Schedule = "CatalogSched" + RunBeforeJob = "/home/bacula/bin/make_catalog_backup" + RunAfterJob = "/home/bacula/bin/delete_catalog_backup" + Write Bootstrap = "/mnt/deuter/files/backup/catalog.bsr" + Priority = 15 # run after backups, but before Verifies +} + +Job { + Name = "Watchdog" + Type = Admin + Client=Watchdog + FileSet="Verify Set" + Messages = Standard + Storage = DLTDrive + Pool = Default + Schedule = "Watchdog" + RunAfterJob = "/home/bacula/bin/watchdog" + Priority = 99 # last job to run +} + +# Standard Restore template, to be changed by Console program +Job { + Name = "RestoreFiles" + Type = Restore + Client=Rufus + FileSet="Full Set" + Storage = DLTDrive + Messages = Standard + Pool = Default + Where = /tmp/bacula-restores +} + + +FileSet { + Name = "Matou Set" + Include = signature=MD5 { + / + /home + /usr + /files + } + Exclude = { /tmp/* } +} + + +FileSet { + Name = "Full Set" + Include = signature=MD5 { + @/etc/backup.list + } + Exclude = { } +} + +FileSet { + Name = "RufusAll" + Include = signature=MD5 { + / + /boot + /home + /usr + } + Exclude = { } +} + +# Backup the copy of the catalog +FileSet { + Name = "CatalogFile" + Include = signature=MD5 { + /home/bacula/bin/working/bacula.sql + } +} + + +FileSet { + Name = "Verify Set" + Include = verify=pins5 signature=MD5 { + /boot + /bin + /sbin + /usr/bin + /lib + /root/.ssh + /home/kern/.ssh + /var/named + /etc/sysconfig + /etc/ssh + /etc/security + /etc/exports + /etc/rc.d/init.d + /etc/sendmail.cf + /etc/sysctl.conf + /etc/services + /etc/xinetd.d + /etc/hosts.allow + /etc/hosts.deny + /etc/hosts + /etc/modules.conf + /etc/named.conf + /etc/pam.d + /etc/resolv.conf + } + Exclude = { } +} + + +FileSet { + Name = "Win32 Full Set" + Include = signature=MD5 { + "c:/My Documents" + } + Exclude = { } +} + +FileSet { + Name = "Minou Full Set" + Include = signature=MD5 { + "d:/My Documents" + } + Exclude = { } +} + +# Definition of tape storage device +Storage { + Name = DLTDrive + Address = lpmatou + SDPort = 9103 + Password = + Device = "HP DLT 80" # must be same as Device in Storage daemon + Media Type = DLT8000 # must be same as MediaType in Storage daemon +} + +#Storage { +# Name = "8mmDrive" +# Address = lpmatou +# SDPort = 9103 +# Password = +# Device = "Exabyte 8mm" +# MediaType = "8mm" +#} + +Client { + Name = Matou + Address = lmatou + FDPort = 9102 + Catalog = BackupDB + Password = + File Retention = 30d # 80 days + Job Retention = 1y # one year + AutoPrune = yes # Prune expired Jobs/Files +} + +Client { + Name = Polymatou + Address = lpmatou + FDPort = 9102 + Catalog = BackupDB + Password = + File Retention = 30d # 80 days + Job Retention = 1y # one year + AutoPrune = yes # Prune expired Jobs/Files +} + +Client { + Name = Rufus + Address = rufus + FDPort = 9102 + Catalog = BackupDB + Password = + File Retention = 30d # 80 days + Job Retention = 1y # one year + AutoPrune = yes # Prune expired Jobs/Files +} + +Client { + Name = Minimatou + Address = minimatou + FDPort = 9102 + Catalog = BackupDB + Password = + File Retention = 30d # 80 days + Job Retention = 1y # one year + AutoPrune = yes # Prune expired Jobs/Files +} + +Client { + Name = Minou + Address = minou + FDPort = 9102 + Catalog = BackupDB + Password = + File Retention = 30d # 80 days + Job Retention = 1y # one year + AutoPrune = yes # Prune expired Jobs/Files +} + +Client { + Name = MatouVerify + Address = lmatou + FDPort = 9102 + Catalog = Verify + Password = + File Retention = 30d # 30 days + Job Retention = 30d # 30 days + AutoPrune = yes # Prune expired Jobs/Files +} + +Client { + Name = PmatouVerify + Address = lpmatou + FDPort = 9102 + Catalog = Verify + Password = + File Retention = 30d # 30 days + Job Retention = 30d # 30 days + AutoPrune = yes # Prune expired Jobs/Files +} + +Client { + Name = RufusVerify + Address = rufus + FDPort = 9102 + Catalog = Verify + Password = + File Retention = 30d # 30 days + Job Retention = 30d # 30 days + AutoPrune = yes # Prune expired Jobs/Files +} + +Client { + Name = Watchdog + Address = rufus + FDPort = 9102 + Catalog = Verify + Password = + File Retention = 1d # 1 days + Job Retention = 1m # 1 month + AutoPrune = yes # Prune expired Jobs/Files +} + +Catalog { + Name = BackupDB + dbname = bacula; user = bacula; password = "" +} + +Catalog { + Name = Verify + dbname = verify; user = bacula; password = "" +} + +Messages { + Name = Standard + mailcommand = "/home/bacula/bin/smtp -h mail.sibbald.com -f \"\(Bacula\) %r\" -s \"Bacula: %t %e of %c %l\" %r" + operatorcommand = "/home/bacula/bin/smtp -h YOUR-SMTP_SERVER.com -f \"\(Bacula\) %r\" -s \"Bacula: Intervention needed for %j\" %r" + MailOnError = YOUR-EMAIL@YOU.com = all + append = "/home/bacula/bin/log" = all + operator = YOUR-EMAIL@YOU.com = mount + console = all +} + + +Pool { + Name = Default + Pool Type = Backup + Recycle = yes # Bacula can automatically recycle Volumes + AutoPrune = yes # Prune expired volumes + Volume Retention = 1y # one year +} diff --git a/bacula/examples/conf/bacula-fd.conf b/bacula/examples/conf/bacula-fd.conf new file mode 100644 index 0000000000..2e5fd48354 --- /dev/null +++ b/bacula/examples/conf/bacula-fd.conf @@ -0,0 +1,31 @@ +# +# Kern's Production Bacula File Daemon Configuration file +# +# +# "Global" File daemon configuration specifications +# +Client { # this is me + Name = "PolymatouFD" + FDport = 9102 # where we listen for the director + WorkingDirectory = "/home/bacula/bin/working" + PidDirectory = "/home/bacula/bin/working" + SubSysDirectory = "/home/bacula/bin/working" +} + +# +# List Directors who are permitted to contact the File daemon +# +Director { + Name = HeadMan + Password = "" +} + +Director { + Name = RightHandMan + Password = xxxxx +} + +Messages { + Name = Standard + director = HeadMan = all, !skipped +} diff --git a/bacula/examples/conf/bacula-sd.conf b/bacula/examples/conf/bacula-sd.conf new file mode 100644 index 0000000000..35521378b4 --- /dev/null +++ b/bacula/examples/conf/bacula-sd.conf @@ -0,0 +1,53 @@ +# +# Kern's Production Bacula Storage Daemon Configuration file +# + +# +# "Global" Storage daemon configuration specifications +# +Storage { + Name = "MainSD" + SDPort = 9103 # Directors port + WorkingDirectory = "/home/bacula/bin/working" + PidDirectory = "/home/bacula/bin/working" + SubSysDirectory = "/home/bacula/bin/working" +} + +# +# List Directors who are permitted to contact Storage daemon +# +Director { + Name = HeadMan + Password = "" +} + +# +# Devices supported by this Storage daemon +# To connect, the Director must have the same Name and MediaType, +# which are sent to the File daemon +# +Device { + Name = "HP DLT 80" + Media Type = DLT8000 + Archive Device = /dev/nst0 + AutomaticMount = yes; # when device opened, read it + AlwaysOpen = yes; + RemovableMedia = yes; +} + +#Device { +# Name = "Exabyte 8mm" +# Media Type = "8mm" +# Archive Device = /dev/nst1 +# Hardware end of medium = No; +## LabelMedia = yes; # lets Bacula label unlabelled media +# AutomaticMount = yes; # when device opened, read it +# AlwaysOpen = Yes; +# RemovableMedia = yes; +#} + +Messages { + Name = Standard + director = HeadMan = all + operator = root = mount +} diff --git a/bacula/examples/conf/console.conf b/bacula/examples/conf/console.conf new file mode 100644 index 0000000000..f5e70f153e --- /dev/null +++ b/bacula/examples/conf/console.conf @@ -0,0 +1,10 @@ +# +# Kern's Production Bacula User Agent Configuration File +# + +Director { + Name = HeadMan + DIRport = 9101 + address = "localhost" + Password = "" # Console password +} diff --git a/bacula/examples/conf/defaultconfig b/bacula/examples/conf/defaultconfig new file mode 100755 index 0000000000..d3e90537be --- /dev/null +++ b/bacula/examples/conf/defaultconfig @@ -0,0 +1,24 @@ +#!/bin/sh +# +# This is a default configuration file for Bacula that +# sets reasonable defaults, and assumes that you do not +# have MySQL running. It will "install" Bacula into +# bin and etc in the current directory. +# + +CFLAGS="-g -Wall" \ + ./configure \ + --sbindir=$HOME/bacula/bin \ + --sysconfdir=$HOME/bacula/bin \ + --with-pid-dir=$HOME/bacula/bin/working \ + --with-subsys-dir=$HOME/bacula/bin/working \ + --enable-smartalloc \ + --enable-gnome \ + --enable-static-tools \ + --with-mysql=$HOME/mysql \ + --with-working-dir=$HOME/bacula/bin/working \ + --with-dump-email=root@localhost \ + --with-job-email=root@localhost \ + --with-smtp-host=localhost + +exit 0 diff --git a/bacula/examples/conf/gnome-console.conf b/bacula/examples/conf/gnome-console.conf new file mode 100644 index 0000000000..f5e70f153e --- /dev/null +++ b/bacula/examples/conf/gnome-console.conf @@ -0,0 +1,10 @@ +# +# Kern's Production Bacula User Agent Configuration File +# + +Director { + Name = HeadMan + DIRport = 9101 + address = "localhost" + Password = "" # Console password +} diff --git a/bacula/examples/conf/kernsconfig b/bacula/examples/conf/kernsconfig new file mode 100755 index 0000000000..c8edf8918e --- /dev/null +++ b/bacula/examples/conf/kernsconfig @@ -0,0 +1,17 @@ +#!/bin/sh +# +# This is Kern's configure script for a test Bacula +# +CFLAGS="-g -O2 -Wall" ./configure \ + --sbindir=$HOME/bacula/bin \ + --sysconfdir=$HOME/bacula/bin \ + --with-pid-dir=$HOME/bacula/bin/working \ + --with-subsys-dir=$HOME/bacula/bin/working \ + --enable-gnome \ + --enable-smartalloc \ + --with-mysql=$HOME/mysql \ + --with-working-dir=$HOME/bacula/working \ + --with-dump-email=$USER \ + --with-job-email=$USER + +exit 0 diff --git a/bacula/examples/conf/many-clients.txt b/bacula/examples/conf/many-clients.txt new file mode 100644 index 0000000000..d8dba6638c --- /dev/null +++ b/bacula/examples/conf/many-clients.txt @@ -0,0 +1,106 @@ +From: Dan Langille +To: bacula-devel@lists.sourceforge.net +Subject: [Bacula-devel] script for creating many client FDs +Date Tue, 2 Dec 2003 19:41:28 -0500 (EST) + +I created this script which may be useful to others. If you have to +create a bacula-fd.conf file for more than a few clients, it can become +time consuming, not to mention error prone. + +Here is the usage: + +$ sh client-build.sh +client-build.sh : usage client-build.sh DIRNAME DIRPASSWD CLIENTNAME +[CLIENTNAME...] + +Where DIRNAME is the director name which can contact this client + PASSWD is the passwd to be supplied by the director + CLIENTNAME is the name of the client file daemon + +The script creates ./tmp and places all output there. + +bacula-fd.conf.in is the template it uses for creating the client scripts +and it must reside in the same directory as the script. + +Enjoy +-- +Dan Langille - http://www.langille.org/ + +==== bacula-fd.conf.in template ====== +# +# Default Bacula File Daemon Configuration file +# +# For Bacula release 1.32b (14 Oct 2003) -- freebsd 4.8-STABLE +# +# There is not much to change here except perhaps the +# File daemon Name to +# + +# +# List Directors who are permitted to contact this File daemon +# +Director { + Name = @dir-name@ + Password = "@dir-password@" +} + +# +# "Global" File daemon configuration specifications +# +FileDaemon { + Name = @client-name@ + FDport = 9102 # where we listen for the director + WorkingDirectory = /var/db/bacula + Pid Directory = /var/run +} + +# Send all messages except skipped files back to Director +Messages { + Name = Standard + director = undef-dir = all, !skipped +} +=== end bacula-fd.conf.in template ======== + + +==== client-build.sh =========== +#!/bin/sh +# +# Copyright 2003 Dan Langille +# +# Use as you wish, but keep retain this copyright notice. +# Please forward improvements. +# +# usage client-build.sh DIRNAME DIRPASSWD CLIENTNAME [CLIENTNAME...] +# +# Where DIRNAME is the director name which can contact this client +# PASSWD is the passwd to be supplied by the director +# CLIENTNAME is the name of the client file daemon +# +# This script creates ./tmp and places all output there. +# +# bacula-fd.conf.in is the template it uses for creating the client scripts. +# + + +if [ $# -lt 3 ] +then + echo $0 : usage $0 DIRNAME DIRPASSWD CLIENTNAME [CLIENTNAME...] + exit 1 +fi + +mkdir -p ./tmp + +DIRNAME=$1 +DIRPASSWD=$2 + +shift 2 + +echo creating stuff for $DIRNAME with password $DIRPASSWD + +while [ $# -gt 0 ] ; do + CLIENT=$1 + shift + echo "creating config for " $CLIENT + sed "s/@dir-name@/undef-dir/;s/@dir-password@/password/;s/@client-name@/$CLIENT/" bacula-fd.conf.in > ./tmp/$CLIENT-bacula-fd.conf +done +=== end client-build.sh =============== diff --git a/bacula/examples/dbdump/postgresql-dump.txt b/bacula/examples/dbdump/postgresql-dump.txt new file mode 100644 index 0000000000..7c82c3f17e --- /dev/null +++ b/bacula/examples/dbdump/postgresql-dump.txt @@ -0,0 +1,42 @@ +To: bacula-users@lists.sourceforge.net +Subject: Re: [Bacula-users] backup postgresql databases +From: Valtteri Vuorikoski +Date: 11 Mar 2004 14:56:13 +0000 + +Mathieu Arnold writes: + +> I was wondering if someone already had some script, or ways of doings scripts +> to backup (and maybe restore) pgsql databases. I'm balancing between taking a +> snapshot of the database directory and backuping that, dumping the datas into +> .sql.gz files, into .tgz files, or into a pipe letting bacula deal with the +> compression. + +Here's a quick shell script hack to dump all databases into separate tars +with pg_dump: + +do_pgsql() { + mkdir $dump_pg || exit 3 + psql -Atc 'select datname from pg_database where datistemplate=false' template1 postgres > $dump_pg/databases || exit 4 + + touch $dump_pg/dump.log + for d in `cat $dump_pg/databases` ; do + pg_dump -U postgres -Ft "$d" > $dump_pg/"$d.tar" >> $dump_pg/dump.log 2>&1 + [ "$retval" -eq 0 ] && retval=$? + done +} + +Set the variable dump_pg to point to the directly where you want the dump. Then +back it up and delete when you're done. + +You could probably use fs snapshots if you LOCK EXCLUSIVE all tables and CHECKPOINT +the transaction log, but as postgresql's relationship between files and tables is +not very transparent (such as with mysql), I think particularly partial restores +would end up being rather problematic. + +Backup/restore capability does not really appear to be postgresql's +forte, unfortunately. + +-- + Valtteri Vuorikoski + MagentaSites Oy + diff --git a/bacula/examples/dbdump/postgresql-mysql-dump.txt b/bacula/examples/dbdump/postgresql-mysql-dump.txt new file mode 100644 index 0000000000..68963f7aac --- /dev/null +++ b/bacula/examples/dbdump/postgresql-mysql-dump.txt @@ -0,0 +1,99 @@ +From: Mathieu Arnold +To: bacula-users@lists.sourceforge.net +Subject: Re: [Bacula-users] backup postgresql databases +Date: Fri, 12 Mar 2004 22:31:58 +0100 + ++-Le 11/03/2004 15:20 +0100, Mathieu Arnold a dit : +| Hi, +| +| I was wondering if someone already had some script, or ways of doings +| scripts to backup (and maybe restore) pgsql databases. I'm balancing +| between taking a snapshot of the database directory and backuping that, +| dumping the datas into .sql.gz files, into .tgz files, or into a pipe +| letting bacula deal with the compression. +| +| Any ideas ? :) + +Thanks to all ppl I got answers from (many used awfully hard way to get +databases), I cooked up my scripts (I needed mysql too), and here they are : + +-------------------------------------------- +#!/bin/sh + +export TMPDIR="/usr/tmp/" +export TEMP="/usr/tmp/" +export SAVE="/usr/tmp/dumps/" +export LANG="C" + +pg_user=pgsql +pg_dbuser=pgsql +pg_template=template1 +exclude=template +host=plouf + +sed=/usr/bin/sed +pg_dump=/usr/local/bin/pg_dump +pg_dumpall=/usr/local/bin/pg_dumpall +psql=/usr/local/bin/psql + +gzip="| /usr/bin/gzip -nc9" +gzext=".gz" + +if [ ! -d $SAVE ] +then + mkdir $SAVE +else + rm -f $SAVE/$host-pgsql* +fi + +su - $pg_user -c "$pg_dumpall -g $gzip" > $SAVE/$host-pgsql$gzext + +for i in $($psql -l $pg_template $pg_dbuser|sed -e '1,4d' -e +'/rows)$/,/\eof/d' -e '/template/d' -e 's/ \([^ ]*\).*$/\1/') +do + su - $pg_user -c "$pg_dump -c -F p $i $gzip" > $SAVE/$host-pgsql-$i$gzext +done +-------------------------------------------- + +For those using complicate selects to get databases list, I advise psql -l +:) + +and for mysql : + +-------------------------------------------- +#!/bin/sh + +export TMPDIR="/usr/tmp/" +export TEMP="/usr/tmp/" +export SAVE="/usr/tmp/dumps/" +export LANG="C" + +my_user=root +my_passwd=password +host=plouf + +sed=/usr/bin/sed +mysql=/usr/local/bin/mysql +mysqldump=/usr/local/bin/mysqldump + +gzip="/usr/bin/gzip -nc9" +gzext=".gz" + +if [ ! -d $SAVE ] +then + mkdir $SAVE +else + rm -f $SAVE/$host-mysql* +fi + +for i in $($mysql -u $my_user -p$my_passwd -e 'show databases'|$sed '1d') +do + $mysqldump -u $my_user -p$my_passwd $i | $gzip > $SAVE/$host-mysql-$i$gzext +done +-------------------------------------------- + +maybe those scripts will save some ppl some time :) + +-- +Mathieu Arnold + diff --git a/bacula/examples/nagios.txt b/bacula/examples/nagios.txt index f26fec33f2..03af14010d 100644 --- a/bacula/examples/nagios.txt +++ b/bacula/examples/nagios.txt @@ -1,56 +1,6 @@ -From bacula-users-admin@lists.sourceforge.net Wed Mar 3 22:08:24 2004 -Return-Path: -Received: from sc8-sf-list2.sourceforge.net (lists.sourceforge.net - [66.35.250.206]) by matou.sibbald.com (8.12.10/8.12.10) with ESMTP id - i23L8Nb7003158 for ; Wed, 3 Mar 2004 22:08:24 +0100 -Received: from localhost ([127.0.0.1] helo=projects.sourceforge.net) by - sc8-sf-list2.sourceforge.net with esmtp (Exim 4.30) id 1Ayddz-0005F7-EZ; - Wed, 03 Mar 2004 13:11:07 -0800 -Received: from sc8-sf-mx1-b.sourceforge.net ([10.3.1.11] - helo=sc8-sf-mx1.sourceforge.net) by sc8-sf-list2.sourceforge.net with esmtp - (Exim 4.30) id 1AyddU-00058Y-25 for bacula-users@lists.sourceforge.net; - Wed, 03 Mar 2004 13:10:36 -0800 -Received: from zola.netways.de ([213.95.25.82] - helo=net-sql2.int.netways.de) by sc8-sf-mx1.sourceforge.net with esmtp - (Exim 4.30) id 1AydXy-0008Im-KW for bacula-users@lists.sourceforge.net; - Wed, 03 Mar 2004 13:04:54 -0800 -Content-class: urn:content-classes:message -MIME-Version: 1.0 -Content-Type: text/plain; charset="iso-8859-1" Subject: RE: [Bacula-users] monitoring bacula with Nagios -X-MimeOLE: Produced By Microsoft Exchange V6.5.6944.0 -Message-ID: <2F6750F2110CAD41BE0BC33BB428B568FB9F@net-sql2.int.netways.de> -X-MS-Has-Attach: -X-MS-TNEF-Correlator: -Thread-Topic: [Bacula-users] monitoring bacula with Nagios -Thread-Index: AcPflloclgso3C9CREycI4VSOMnJBghyXnSwAACsf0A= From: "Julian Hein" To: -X-Spam-Score: 0.0 (/) -X-Spam-Report: Spam Filtering performed by sourceforge.net. See - http://spamassassin.org/tag/ for more details. Report problems to - http://sf.net/tracker/?func=add&group_id=1&atid=200001 -Sender: bacula-users-admin@lists.sourceforge.net -Errors-To: bacula-users-admin@lists.sourceforge.net -X-BeenThere: bacula-users@lists.sourceforge.net -X-Mailman-Version: 2.0.9-sf.net -Precedence: bulk -List-Unsubscribe: - , - -List-Id: Bacula user's email list for support and discussions - -List-Post: -List-Help: -List-Subscribe: - , - -List-Archive: - -Date: Wed, 3 Mar 2004 22:04:49 +0100 -X-MIME-Autoconverted: from quoted-printable to 8bit by matou.sibbald.com id - i23L8Nb7003158 -Content-Transfer-Encoding: 8bit Hi, @@ -127,20 +77,20 @@ use DBI; use Getopt::Long; use vars qw( $opt_help - $opt_job - $opt_critical - $opt_warning - $opt_hours - $opt_usage - $opt_version - $out - $sql - $date_start - $date_stop - $state - $count - ); - + $opt_job + $opt_critical + $opt_warning + $opt_hours + $opt_usage + $opt_version + $out + $sql + $date_start + $date_stop + $state + $count + ); + sub print_help(); sub print_usage(); sub get_now(); @@ -148,22 +98,22 @@ sub get_date; my $progname = basename($0); -my %ERRORS = ( 'UNKNOWN' => '-1', - 'OK' => '0', - 'WARNING' => '1', - 'CRITICAL' => '2'); +my %ERRORS = ( 'UNKNOWN' => '-1', + 'OK' => '0', + 'WARNING' => '1', + 'CRITICAL' => '2'); Getopt::Long::Configure('bundling'); GetOptions - ( - "c=s" => \$opt_critical, "critical=s" => \$opt_critical, - "w=s" => \$opt_warning, "warning=s" => \$opt_warning, - "H=s" => \$opt_hours, "hours=s" => \$opt_hours, - "j=s" => \$opt_job, "job=s" => \$opt_job, - "h" => \$opt_help, "help" => \$opt_help, - "usage" => \$opt_usage, - "V" => \$opt_version, "version" => \$opt_version - ) || die "Try '$progname --help' for more information.\n"; + ( + "c=s" => \$opt_critical, "critical=s" => \$opt_critical, + "w=s" => \$opt_warning, "warning=s" => \$opt_warning, + "H=s" => \$opt_hours, "hours=s" => \$opt_hours, + "j=s" => \$opt_job, "job=s" => \$opt_job, + "h" => \$opt_help, "help" => \$opt_help, + "usage" => \$opt_usage, + "V" => \$opt_version, "version" => \$opt_version + ) || die "Try '$progname --help' for more information.\n"; sub print_help() { print "\n"; @@ -253,15 +203,3 @@ Fon.0911/92885-0 D-90429 N Fax.0911/92885-31 jhein@netways.de www.netways.de - - - -------------------------------------------------------- -This SF.Net email is sponsored by: IBM Linux Tutorials -Free Linux tutorial presented by Daniel Robbins, President and CEO of -GenToo technologies. Learn everything from fundamentals to system -administration.http://ads.osdn.com/?ad_id70&alloc_id638&opÃŒk -_______________________________________________ -Bacula-users mailing list -Bacula-users@lists.sourceforge.net -https://lists.sourceforge.net/lists/listinfo/bacula-users diff --git a/bacula/kernstodo b/bacula/kernstodo index 24249fc5e6..175ff2db24 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -72,15 +72,15 @@ For 1.33 Testing/Documentation: Overland Neo2000 (LVD) For 1.33 +- On unknown client in restore "client=xxx" + Could not find Client "Matou": ERR=Query failed: DROP TABLE temp1: + ERR=no such table: temp1 From Chris Hull: it seems to be complaining about 12:00pm which should be a valid 12 hour time. I changed the time to 11:59am and everything works fine. Also 12:00am works fine. 0:00pm also works (which I don't think should). None of the values 12:00pm - 12:59pm work for that matter. - Use SHA1 on authentication if possible. -- Check: Run = Level=Differential feb-dec 1 at 1:05 to see if wday is empty. -- Look at installation file permissions with Scott so that make install - and the rpms agree. - Restore attributes of directory if replace=never set but directory did not exist. - Allow "delete job jobid=xx jobid=xxx". @@ -90,10 +90,7 @@ From Chris Hull: then list last 20 backups. - Allow browsing the catalog to see all versions of a file (with stat data on each file). -- Finish code passing files=nnn to restore start. - Add level to estimate command. -- Symbolic link a directory to another one, then backup the symbolic link. -- Check and possibly fix problems with hard links. - Fix "llist jobid=xx" where no fileset or client exists. - Add all pools in Dir conf to DB also update them to catch changed LabelFormats and such. @@ -103,16 +100,13 @@ From Chris Hull: it cannot be called recursively and set dequeuing flag. - Add a .list all files in the restore tree (probably also a list all files) Do both a long and short form. -- Finish work on conio.c -- See comtest-xxx.zip for Windows code to talk to USB. +- Finish work on conio.c -- particularly linking. - Phil says that Windows file sizes mismatch in Verify when they should, and that either the file size or the catalog size was zero. - Check time/dates printed during restore when using Win32 API. -- Add ctl-c to console to stop current command and discard buffered - output. -- Estimate to Tibs never returns. - Later: +- See comtest-xxx.zip for Windows code to talk to USB. - Make btape accept Device Names in addition to Archive names. - Add Events and Perl scripting. - Add John's appended files: @@ -1408,3 +1402,12 @@ Block Position: 0 - Rescue builds incorrect script files on Rufus. - Release SQLite 2.8.9 - During install, copy any console.conf to bconsole.conf. +- Check: Run = Level=Differential feb-dec 1 at 1:05 to see if wday is empty. +- Look at installation file permissions with Scott so that make install + and the rpms agree. +- Finish code passing files=nnn to restore start. +- Add ctl-c to console to stop current command and discard buffered + output. +- Estimate to Tibs never returns. +- Symbolic link a directory to another one, then backup the symbolic link. +- Check and possibly fix problems with hard links. diff --git a/bacula/src/cats/sql.c b/bacula/src/cats/sql.c index a3a291c31f..50b96467c7 100644 --- a/bacula/src/cats/sql.c +++ b/bacula/src/cats/sql.c @@ -297,56 +297,21 @@ void db_end_transaction(JCR *jcr, B_DB *mdb) * and filename parts. They are returned in pool memory * in the mdb structure. */ -void split_path_and_filename(JCR *jcr, B_DB *mdb, char *fname) +void split_path_and_file(JCR *jcr, B_DB *mdb, const char *fname) { - char *p, *f; - - /* Find path without the filename. - * I.e. everything after the last / is a "filename". - * OK, maybe it is a directory name, but we treat it like - * a filename. If we don't find a / then the whole name - * must be a path name (e.g. c:). - */ - for (p=f=fname; *p; p++) { - if (*p == '/') { - f = p; /* set pos of last slash */ - } - } - if (*f == '/') { /* did we find a slash? */ - f++; /* yes, point to filename */ - } else { /* no, whole thing must be path name */ - f = p; - } - - /* If filename doesn't exist (i.e. root directory), we - * simply create a blank name consisting of a single - * space. This makes handling zero length filenames - * easier. - */ - mdb->fnl = p - f; - if (mdb->fnl > 0) { - mdb->fname = check_pool_memory_size(mdb->fname, mdb->fnl+1); - memcpy(mdb->fname, f, mdb->fnl); /* copy filename */ - mdb->fname[mdb->fnl] = 0; - } else { + split_path_and_filename(fname, &mdb->path, &mdb->pnl, &mdb->fname, &mdb->fnl); + if (mdb->fnl == 0) { mdb->fname[0] = ' '; /* blank filename */ mdb->fname[1] = 0; mdb->fnl = 1; } - - mdb->pnl = f - fname; - if (mdb->pnl > 0) { - mdb->path = check_pool_memory_size(mdb->path, mdb->pnl+1); - memcpy(mdb->path, fname, mdb->pnl); - mdb->path[mdb->pnl] = 0; - } else { + if (mdb->pnl == 0) { Mmsg1(&mdb->errmsg, _("Path length is zero. File=%s\n"), fname); Jmsg(jcr, M_ERROR, 0, "%s", mdb->errmsg); mdb->path[0] = ' '; mdb->path[1] = 0; mdb->pnl = 1; } - Dmsg2(400, "split path=%s file=%s\n", mdb->path, mdb->fname); } diff --git a/bacula/src/cats/sql_create.c b/bacula/src/cats/sql_create.c index 4209ef52c9..a69471623d 100644 --- a/bacula/src/cats/sql_create.c +++ b/bacula/src/cats/sql_create.c @@ -55,7 +55,7 @@ extern void print_result(B_DB *mdb); extern int QueryDB(char *file, int line, JCR *jcr, B_DB *db, char *select_cmd); extern int InsertDB(char *file, int line, JCR *jcr, B_DB *db, char *select_cmd); extern int UpdateDB(char *file, int line, JCR *jcr, B_DB *db, char *update_cmd); -extern void split_path_and_filename(JCR *jcr, B_DB *mdb, char *fname); +extern void split_path_and_file(JCR *jcr, B_DB *mdb, const char *fname); /* Create a new record for the Job @@ -529,7 +529,7 @@ int db_create_file_attributes_record(JCR *jcr, B_DB *mdb, ATTR_DBR *ar) db_lock(mdb); - split_path_and_filename(jcr, mdb, ar->fname); + split_path_and_file(jcr, mdb, ar->fname); if (!db_create_filename_record(jcr, mdb, ar)) { db_unlock(mdb); diff --git a/bacula/src/cats/sql_get.c b/bacula/src/cats/sql_get.c index 700b6ba636..a1abcbd323 100644 --- a/bacula/src/cats/sql_get.c +++ b/bacula/src/cats/sql_get.c @@ -56,7 +56,7 @@ static int db_get_path_record(JCR *jcr, B_DB *mdb); /* Imported subroutines */ extern void print_result(B_DB *mdb); extern int QueryDB(char *file, int line, JCR *jcr, B_DB *db, char *select_cmd); -extern void split_path_and_filename(JCR *jcr, B_DB *mdb, char *fname); +extern void split_path_and_file(JCR *jcr, B_DB *mdb, const char *fname); @@ -73,7 +73,7 @@ int db_get_file_attributes_record(JCR *jcr, B_DB *mdb, char *fname, JOB_DBR *jr, Dmsg1(100, "db_get_file_att_record fname=%s \n", fname); db_lock(mdb); - split_path_and_filename(jcr, mdb, fname); + split_path_and_file(jcr, mdb, fname); fdbr->FilenameId = db_get_filename_record(jcr, mdb); diff --git a/bacula/src/console2.glade b/bacula/src/console2.glade index c62ae83ae8..5011ed46ef 100644 --- a/bacula/src/console2.glade +++ b/bacula/src/console2.glade @@ -4,15 +4,17 @@ - + True Bacula Console GTK_WINDOW_TOPLEVEL GTK_WIN_POS_CENTER False + 700 + 600 True False - + @@ -458,7 +460,7 @@ True - + False False GTK_JUSTIFY_LEFT @@ -546,6 +548,8 @@ 1 + 400 + 640 True True True @@ -586,7 +590,7 @@ True - Bacula Console 1.32c (24 Oct 03) + Bacula Console 1.34.0 (16 Mar 04) False False @@ -619,7 +623,7 @@ True - Copyright (c) 1999 - 2002, Kern Sibbald and John Walker + Copyright (c) 2000 - 2004, Kern Sibbald and John Walker False False GTK_JUSTIFY_LEFT @@ -2190,14 +2194,19 @@ - + + 640 + 480 True Restore File Selection GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE True + 640 + 400 True False + @@ -2206,28 +2215,244 @@ 0 - + True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT + GTK_SHADOW_OUT + GTK_POS_LEFT + GTK_POS_TOP - + True - True - True - False - False - True + + + + True + GNOMEUIINFO_MENU_FILE_TREE + + + + + + + True + GNOMEUIINFO_MENU_NEW_ITEM + _New + True + + + + + + + True + GNOMEUIINFO_MENU_OPEN_ITEM + + + + + + + True + GNOMEUIINFO_MENU_SAVE_ITEM + + + + + + + True + GNOMEUIINFO_MENU_SAVE_AS_ITEM + + + + + + + True + + + + + + True + GNOMEUIINFO_MENU_EXIT_ITEM + + + + + + + + + + + True + GNOMEUIINFO_MENU_EDIT_TREE + + + + + + + True + GNOMEUIINFO_MENU_CUT_ITEM + + + + + + + True + GNOMEUIINFO_MENU_COPY_ITEM + + + + + + + True + GNOMEUIINFO_MENU_PASTE_ITEM + + + + + + + True + GNOMEUIINFO_MENU_CLEAR_ITEM + + + + + + + True + + + + + + True + GNOMEUIINFO_MENU_PROPERTIES_ITEM + + + + + + + True + + + + + + True + GNOMEUIINFO_MENU_PREFERENCES_ITEM + + + + + + + + + + + True + GNOMEUIINFO_MENU_VIEW_TREE + + + + + + + + + + + True + GNOMEUIINFO_MENU_HELP_TREE + + + + + + + True + GNOMEUIINFO_MENU_ABOUT_ITEM + + + + + + + 0 - True - True + False + False + + + + + + True + GTK_SHADOW_OUT + GTK_POS_LEFT + GTK_POS_TOP + + + + True + GTK_ORIENTATION_HORIZONTAL + GTK_TOOLBAR_BOTH + True + + + + True + gtk-go-up + True + + + + + + + True + gtk-add + True + + + + + + + True + gtk-remove + True + + + + + + + + + + + + + + + + 0 + False + False @@ -2240,7 +2465,7 @@ True - cwd: + Current dir: False False GTK_JUSTIFY_CENTER @@ -2259,13 +2484,9 @@ - + True - Enter Commands Here - True - True True - True True True 0 @@ -2273,8 +2494,6 @@ True * False - - 0 @@ -2290,52 +2509,129 @@ + + + True + True + GTK_POLICY_ALWAYS + GTK_POLICY_ALWAYS + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + + + + 0 + True + True + + + True - False + True 0 - + True - + False False - GTK_JUSTIFY_FILL + GTK_JUSTIFY_LEFT False False - 0.5 + 0.94 0.5 - 59 + 0 0 0 True - False + True - - 9 + True True gtk-ok True GTK_RELIEF_NORMAL - + 0 - True + False + True + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + + + + 0 + False + True + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False False - 0 + 7 False True @@ -2344,9 +2640,9 @@ - + True - Restore Files + Label a Volume GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE True @@ -2355,43 +2651,43 @@ True - + True False 0 - + True GTK_BUTTONBOX_END - + True GTK_BUTTONBOX_END 8 - + True True True gtk-ok True GTK_RELIEF_NORMAL - + - + True True True gtk-cancel True GTK_RELIEF_NORMAL - + @@ -2406,304 +2702,13 @@ - + True False 0 - - 8 - True - 0 - 0.5 - GTK_SHADOW_ETCHED_IN - - - - True - False - 0 - - - - True - - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - GTK_PACK_END - - - - - - True - False - 0 - - - - True - - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 2 - - - 0 - False - False - - - - - - 3 - True - True - Select most recent backup - True - GTK_RELIEF_NORMAL - True - False - True - - - 0 - False - False - - - - - - 5 - True - True - Select list of Jobs - True - GTK_RELIEF_NORMAL - False - False - True - - - 0 - False - False - - - - - - 4 - True - True - Find a specific file - True - GTK_RELIEF_NORMAL - False - False - True - - - 0 - False - False - - - - - - True - - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - 0 - True - True - - - - - - - - True - Select by: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - label_item - - - - - 0 - True - True - - - - - - True - False - 0 - - - - - - - - 50 - True - True - gtk-apply - True - GTK_RELIEF_NORMAL - - - - 0 - False - False - - - - - - - - - 0 - False - False - - - - - 0 - True - True - - - - - - - - True - Label a Volume - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - True - True - False - True - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - GTK_BUTTONBOX_END - 8 - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - - - - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - - - - - - - - 0 - False - True - GTK_PACK_END - - - - - - True - False - 0 - - - + True Label a Volume False @@ -3110,4 +3115,922 @@ + + True + Restore Files Dialog + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 300 + 200 + True + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-help + True + GTK_RELIEF_NORMAL + -11 + + + + + + True + True + True + GTK_RELIEF_NORMAL + 0 + + + + + True + 0.5 + 0.5 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-apply + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Select Files + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + -6 + + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + False + 0 + + + + True + False + 0 + + + + True + Restore Files + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 9 + + + 2 + False + False + + + + + + True + 0.5 + 0.5 + 1 + 1 + + + + True + False + 0 + + + + True + False + 0 + + + + 66 + 16 + True + Job: + False + False + GTK_JUSTIFY_RIGHT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + True + False + False + True + False + + + + True + True + False + True + 0 + + True + * + False + + + + + + + True + GTK_SELECTION_BROWSE + + + + True + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + + + + + + + 1 + True + True + + + + + + True + + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 27 + False + False + + + + + 0 + True + True + + + + + + + 2 + False + False + + + + + + True + False + 0 + + + + 66 + 16 + True + Client: + False + False + GTK_JUSTIFY_RIGHT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + True + False + False + True + False + + + + True + True + False + True + 0 + + True + * + False + + + + + + True + GTK_SELECTION_BROWSE + + + + True + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + + + + + + + 1 + True + True + + + + + + True + + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 25 + False + False + + + + + 0 + True + True + + + + + + True + False + 0 + + + + 66 + 16 + True + FileSet: + False + False + GTK_JUSTIFY_RIGHT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + True + False + False + True + False + + + + True + True + False + True + 0 + + True + * + False + + + + + + True + GTK_SELECTION_BROWSE + + + + True + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + + + + + + + 0 + True + True + + + + + + True + + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 23 + False + False + + + + + 2 + True + True + + + + + + True + False + 0 + + + + 66 + 16 + True + Pool: + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + True + False + False + True + False + + + + True + True + False + True + 0 + + True + * + False + + + + + + True + GTK_SELECTION_BROWSE + + + + True + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + + + + + + True + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + + + + + + + 0 + True + True + + + + + + True + + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 21 + False + False + + + + + 2 + True + True + + + + + + True + False + 0 + + + + 66 + 16 + True + Storage: + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + True + False + False + True + False + + + + True + True + False + True + 0 + + True + * + False + + + + + + True + GTK_SELECTION_BROWSE + + + + True + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + + + + + + True + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + + + + + + + 0 + True + True + + + + + + True + + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 21 + False + False + + + + + 0 + True + True + + + + + 0 + True + True + + + + + + True + False + 0 + + + + 66 + 16 + True + Before: + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + True + True + True + 0 + + True + * + False + + + 0 + True + True + + + + + + True + + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 53 + False + False + + + + + 0 + True + True + + + + + + True + + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + 0 + True + True + + + + + + diff --git a/bacula/src/dird/ua_restore.c b/bacula/src/dird/ua_restore.c index 22357d7107..a79eb8b0fc 100644 --- a/bacula/src/dird/ua_restore.c +++ b/bacula/src/dird/ua_restore.c @@ -309,9 +309,10 @@ static int user_select_jobids_or_files(UAContext *ua, RESTORE_CTX *rx) "pool", /* 5 */ "client", /* 6 */ "storage", /* 7 */ - "where", /* 8 */ - "all", /* 9 */ - "yes", /* 10 */ + "fileset", /* 8 */ + "where", /* 9 */ + "all", /* 10 */ + "yes", /* 11 */ NULL }; diff --git a/bacula/src/gnome2-console/Makefile.in b/bacula/src/gnome2-console/Makefile.in index d83d184e42..0431bdd6e7 100644 --- a/bacula/src/gnome2-console/Makefile.in +++ b/bacula/src/gnome2-console/Makefile.in @@ -26,8 +26,10 @@ GNOME_LIBS = @GNOME_LIBS@ # -CONSSRCS = console.c console_conf.c authenticate.c support.c interface.c callbacks.c -CONSOBJS = console.o console_conf.o authenticate.o support.o interface.o callbacks.o +CONSSRCS = console.c console_conf.c authenticate.c support.c interface.c callbacks.c \ + restore.c +CONSOBJS = console.o console_conf.o authenticate.o support.o interface.o callbacks.o \ + restore.o # these are the objects that are changed by the .configure process EXTRAOBJS = @OBJLIST@ diff --git a/bacula/src/gnome2-console/callbacks.c b/bacula/src/gnome2-console/callbacks.c index 2d2f6544d6..fc03aba734 100644 --- a/bacula/src/gnome2-console/callbacks.c +++ b/bacula/src/gnome2-console/callbacks.c @@ -20,7 +20,7 @@ #define KEY_Right 65363 gboolean -on_app1_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) +on_console_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) { gtk_main_quit(); return FALSE; @@ -78,14 +78,6 @@ on_clear1_activate(GtkMenuItem *menuitem, gpointer user_data) } - -void -on_properties1_activate(GtkMenuItem *menuitem, gpointer user_data) -{ - -} - - void on_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data) { @@ -430,14 +422,6 @@ on_view_fileset_clicked(GtkButton *button, gpointer user_data) { } -void -on_restore_ok_clicked(GtkButton *button, gpointer user_data) -{ - gtk_widget_hide(restore_dialog); - gtk_main_quit(); - set_status_ready(); -} - void on_restore_cancel_clicked(GtkButton *button, gpointer user_data) @@ -447,19 +431,6 @@ on_restore_cancel_clicked(GtkButton *button, gpointer user_data) set_status_ready(); } -void -on_apply_button_clicked(GtkButton *button, gpointer user_data) -{ - gtk_widget_show(restore_files); - gtk_main(); -} - -void -on_restore_file_clicked(GtkButton *button, gpointer user_data) -{ - gtk_widget_hide(restore_files); - gtk_main_quit(); -} void on_label_button_clicked(GtkButton *button, gpointer user_data) @@ -502,3 +473,213 @@ on_label_cancel_clicked(GtkButton *button, gpointer user_data) gtk_main_quit(); set_status_ready(); } + + +void +on_select_files_button_clicked(GtkButton *button, gpointer user_data) +{ + char *job, *fileset, *client, *pool, *before, *storage; + + gtk_widget_hide(restore_dialog); + + job = get_combo_text(restore_dialog, "combo_restore_job"); + fileset = get_combo_text(restore_dialog, "combo_restore_fileset"); + client = get_combo_text(restore_dialog, "combo_restore_client"); + pool = get_combo_text(restore_dialog, "combo_restore_pool"); + storage = get_combo_text(restore_dialog, "combo_restore_storage"); + + before = get_entry_text(restore_dialog, "restore_before_entry"); + + if (!job || !fileset || !client || !pool || !storage || !before) { + set_status_ready(); + return; + } + + bsnprintf(cmd, sizeof(cmd), + "restore select current fileset=\"%s\" client=\"%s\" pool=\"%s\" " + "storage=\"%s\"", fileset, client, pool, storage); + write_director(cmd); + gtk_widget_show(restore_file_selection); + select_restore_files(); /* put up select files dialog */ +} + +void +on_restore_select_ok_clicked(GtkButton *button, gpointer user_data) +{ + gtk_widget_hide(restore_file_selection); + write_director("done"); + gtk_main_quit(); + set_status_ready(); +} + + +void +on_restore_select_cancel_clicked(GtkButton *button, gpointer user_data) +{ + gtk_widget_hide(restore_file_selection); + write_director("quit"); + gtk_main_quit(); + set_status_ready(); +} + +gboolean +on_restore_files_delete_event(GtkWidget *widget, GdkEvent *event, gpointer user_data) +{ + gtk_widget_hide(restore_file_selection); + gtk_main_quit(); + set_status_ready(); + return FALSE; +} + + +void +on_new1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_open1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_save1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_save_as1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_quit1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_cut2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_copy2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_paste2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_clear2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_properties1_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_preferences2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + + +void +on_about2_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + +} + +/* + * Set correct default values in the Restore dialog box + */ +void set_restore_dialog_defaults() +{ + GtkWidget *combo; + char *job, *def; + GList *item, *list; + char cmd[1000]; + int pos; + + stop_director_reader(NULL); + + combo = lookup_widget(restore_dialog, "combo_restore_job"); + job = (char *)gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(combo)->entry)); + bsnprintf(cmd, sizeof(cmd), ".defaults job=\"%s\"", job); + write_director(cmd); + while (bnet_recv(UA_sock) > 0) { + def = strchr(UA_sock->msg, '='); + if (!def) { + continue; + } + *def++ = 0; + if (strcmp(UA_sock->msg, "job") == 0 || + strcmp(UA_sock->msg, "when") == 0 || + strcmp(UA_sock->msg, "where") == 0 || + strcmp(UA_sock->msg, "messages") == 0 || + strcmp(UA_sock->msg, "level") == 0 || + strcmp(UA_sock->msg, "type") == 0) { + continue; + } + + /* Now handle combo boxes */ + list = find_combo_list(UA_sock->msg); + if (!list) { + continue; + } + item = g_list_find_custom(list, def, compare_func); + bsnprintf(cmd, sizeof(cmd), "combo_restore_%s", UA_sock->msg); + combo = lookup_widget(restore_dialog, cmd); + if (!combo) { + continue; + } + pos = g_list_position(list, item); + gtk_list_select_item(GTK_LIST(GTK_COMBO(combo)->list), pos); + } + start_director_reader(NULL); +} + + +void +on_restore_job_entry_changed(GtkEditable *editable, gpointer user_data) +{ + /* Set defaults that correspond to new job selection */ + set_restore_dialog_defaults(); +} diff --git a/bacula/src/gnome2-console/callbacks.h b/bacula/src/gnome2-console/callbacks.h index 184ba9c4ea..dda3101dd8 100644 --- a/bacula/src/gnome2-console/callbacks.h +++ b/bacula/src/gnome2-console/callbacks.h @@ -238,3 +238,105 @@ on_label_ok_clicked (GtkButton *button, void on_label_cancel_clicked (GtkButton *button, gpointer user_data); + +void +on_new1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_open1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_save1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_save_as1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_quit1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_cut2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_copy2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_paste2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_clear2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_properties1_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_preferences2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void +on_about2_activate (GtkMenuItem *menuitem, + gpointer user_data); + +gboolean +on_restore_files_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); + +void +on_restore_up_button_clicked (GtkButton *button, + gpointer user_data); + +void +on_restore_add_button_clicked (GtkButton *button, + gpointer user_data); + +void +on_restore_remove_button_clicked (GtkButton *button, + gpointer user_data); + +void +on_restore_ok_clicked (GtkButton *button, + gpointer user_data); + +void +on_restore_cancel_clicked (GtkButton *button, + gpointer user_data); + +void +on_restore_select_ok_clicked (GtkButton *button, + gpointer user_data); + +void +on_restore_select_cancel_clicked (GtkButton *button, + gpointer user_data); + +gboolean +on_console_delete_event (GtkWidget *widget, + GdkEvent *event, + gpointer user_data); + +void +on_select_files_button_clicked (GtkButton *button, + gpointer user_data); + +void +on_restore_job_entry_changed (GtkEditable *editable, + gpointer user_data); + +void +on_select_files_button_clicked (GtkButton *button, + gpointer user_data); + +void +on_restore_cancel_clicked (GtkButton *button, + gpointer user_data); diff --git a/bacula/src/gnome2-console/console.c b/bacula/src/gnome2-console/console.c index 02459c1ec6..f4039b4142 100644 --- a/bacula/src/gnome2-console/console.c +++ b/bacula/src/gnome2-console/console.c @@ -33,9 +33,10 @@ /* Imported functions */ int authenticate_director(JCR *jcr, DIRRES *director, CONRES *cons); +void select_restore_setup(); /* Exported variables */ -GtkWidget *app1; /* application window */ +GtkWidget *console; /* application window */ GtkWidget *text1; /* text window */ GtkWidget *entry1; /* entry box */ GtkWidget *status1; /* status bar */ @@ -44,7 +45,7 @@ GtkWidget *scroll1; /* main scroll bar */ GtkWidget *run_dialog; /* run dialog */ GtkWidget *dir_dialog; /* director selection dialog */ GtkWidget *restore_dialog; /* restore dialog */ -GtkWidget *restore_files; /* restore files dialog */ +GtkWidget *restore_file_selection; GtkWidget *dir_select; GtkWidget *about1; /* about box */ GtkWidget *label_dialog; @@ -69,7 +70,7 @@ static void set_scroll_bar_to_end(void); static char *configfile = NULL; static DIRRES *dir; static int ndir; -static int director_reader_running = FALSE; +static bool director_reader_running = false; static bool at_prompt = false; static bool ready = false; static bool quit = false; @@ -183,20 +184,21 @@ Without that I don't how to speak to the Director :-(\n"), configfile); - app1 = create_app1(); - gtk_window_set_default_size(GTK_WINDOW(app1), 800, 700); + console = create_console(); + gtk_window_set_default_size(GTK_WINDOW(console), 800, 700); run_dialog = create_RunDialog(); label_dialog = create_label_dialog(); - restore_dialog = create_restore_dialog(); - restore_files = create_restore_files(); + restore_dialog = create_RestoreDialog(); about1 = create_about1(); - gtk_widget_show(app1); + text1 = lookup_widget(console, "text1"); + entry1 = lookup_widget(console, "entry1"); + status1 = lookup_widget(console, "status1"); + scroll1 = lookup_widget(console, "scroll1"); - text1 = lookup_widget(app1, "text1"); - entry1 = lookup_widget(app1, "entry1"); - status1 = lookup_widget(app1, "status1"); - scroll1 = lookup_widget(app1, "scroll1"); + select_restore_setup(); + + gtk_widget_show(console); /* * Thanks to Phil Stracchino for providing the font configuration code. @@ -231,11 +233,11 @@ Without that I don't how to speak to the Director :-(\n"), configfile); text_font = gdk_font_load("-misc-fixed-medium-r-normal-*-*-130-*-*-c-*-iso8859-1"); } font_desc = pango_font_description_from_string("LucidaTypewriter 9"); - gtk_widget_modify_font (app1, font_desc); - gtk_widget_modify_font (text1, font_desc); - gtk_widget_modify_font (entry1, font_desc); - gtk_widget_modify_font (status1, font_desc); - pango_font_description_free (font_desc); + gtk_widget_modify_font(console, font_desc); + gtk_widget_modify_font(text1, font_desc); + gtk_widget_modify_font(entry1, font_desc); + gtk_widget_modify_font(status1, font_desc); + pango_font_description_free(font_desc); if (test_config) { terminate_console(0); @@ -339,7 +341,6 @@ int connect_to_director(gpointer data) { GList *dirs = NULL; GtkWidget *combo; - char buf[1000]; JCR jcr; @@ -350,9 +351,6 @@ int connect_to_director(gpointer data) if (ndir > 1) { LockRes(); foreach_res(dir, R_DIRECTOR) { - sprintf(buf, "%s at %s:%d", dir->hdr.name, dir->address, - dir->DIRport); - printf("%s\n", buf); dirs = g_list_append(dirs, dir->hdr.name); } UnlockRes(); @@ -360,7 +358,6 @@ int connect_to_director(gpointer data) combo = lookup_widget(dir_dialog, "combo1"); dir_select = lookup_widget(dir_dialog, "dirselect"); gtk_combo_set_popdown_strings(GTK_COMBO(combo), dirs); - printf("dialog run\n"); gtk_widget_show(dir_dialog); gtk_main(); @@ -384,7 +381,6 @@ int connect_to_director(gpointer data) } if (!dir) { - printf("dir is NULL\n"); return 0; } @@ -436,9 +432,18 @@ int connect_to_director(gpointer data) type_list = get_and_fill_combo(run_dialog, "combo_type", ".types"); level_list = get_and_fill_combo(run_dialog, "combo_level", ".levels"); + /* Fill the label dialog combo boxes */ fill_combo(label_dialog, "label_combo_storage", storage_list); fill_combo(label_dialog, "label_combo_pool", pool_list); + + /* Fill the restore_dialog combo boxes */ + fill_combo(restore_dialog, "combo_restore_job", job_list); + fill_combo(restore_dialog, "combo_restore_client", client_list); + fill_combo(restore_dialog, "combo_restore_fileset", fileset_list); + fill_combo(restore_dialog, "combo_restore_pool", pool_list); + fill_combo(restore_dialog, "combo_restore_storage", storage_list); + set_status(" Connected"); return 1; } @@ -497,9 +502,8 @@ void start_director_reader(gpointer data) if (director_reader_running || !UA_sock) { return; } - director_reader_running = TRUE; - tag = gdk_input_add(UA_sock->fd, GDK_INPUT_READ, read_director, NULL); + director_reader_running = true; } void stop_director_reader(gpointer data) @@ -508,7 +512,17 @@ void stop_director_reader(gpointer data) return; } gdk_input_remove(tag); - director_reader_running = FALSE; + gdk_input_remove(tag); + gdk_input_remove(tag); + gdk_input_remove(tag); + gdk_input_remove(tag); + gdk_input_remove(tag); + gdk_input_remove(tag); + gdk_input_remove(tag); + gdk_input_remove(tag); + gdk_input_remove(tag); + gdk_input_remove(tag); + director_reader_running = false; } diff --git a/bacula/src/gnome2-console/console.h b/bacula/src/gnome2-console/console.h index 200ca32288..783e6225f7 100644 --- a/bacula/src/gnome2-console/console.h +++ b/bacula/src/gnome2-console/console.h @@ -24,10 +24,10 @@ extern GtkWidget *entry1; /* entry box */ extern GtkWidget *combo1; /* Directory combo */ extern GtkWidget *dir_dialog; extern GtkWidget *dir_select; -extern GtkWidget *run_dialog; /* run dialog */ +extern GtkWidget *run_dialog; /* run dialog */ extern GtkWidget *label_dialog; extern GtkWidget *restore_dialog; /* restore dialog */ -extern GtkWidget *restore_files; /* restore files dialog */ +extern GtkWidget *restore_file_selection; /* restore files dialog */ extern GtkWidget *about1; extern GList *job_list, *client_list, *fileset_list; extern GList *messages_list, *pool_list, *storage_list; @@ -57,5 +57,7 @@ void start_director_reader(gpointer data); void stop_director_reader(gpointer data); void write_director(gchar *msg); void read_director(gpointer data, gint fd, GdkInputCondition condition); +void set_restore_dialog_defaults(); +void select_restore_files(); #endif diff --git a/bacula/src/gnome2-console/interface.c b/bacula/src/gnome2-console/interface.c index d9f585cbd0..9dbfc71f1d 100644 --- a/bacula/src/gnome2-console/interface.c +++ b/bacula/src/gnome2-console/interface.c @@ -164,9 +164,9 @@ static GnomeUIInfo menubar1_uiinfo[] = }; GtkWidget* -create_app1 (void) +create_console (void) { - GtkWidget *app1; + GtkWidget *console; GtkWidget *vbox6; GtkWidget *handlebox1; GtkWidget *menubar1; @@ -193,13 +193,14 @@ create_app1 (void) tooltips = gtk_tooltips_new (); - app1 = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (app1), _("Bacula Console")); - gtk_window_set_position (GTK_WINDOW (app1), GTK_WIN_POS_CENTER); + console = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_window_set_title (GTK_WINDOW (console), _("Bacula Console")); + gtk_window_set_position (GTK_WINDOW (console), GTK_WIN_POS_CENTER); + gtk_window_set_default_size (GTK_WINDOW (console), 700, 600); vbox6 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox6); - gtk_container_add (GTK_CONTAINER (app1), vbox6); + gtk_container_add (GTK_CONTAINER (console), vbox6); handlebox1 = gtk_handle_box_new (); gtk_widget_show (handlebox1); @@ -322,14 +323,14 @@ create_app1 (void) gtk_widget_show (frame2); gtk_box_pack_start (GTK_BOX (hbox19), frame2, TRUE, TRUE, 0); - status1 = gtk_label_new (""); + status1 = gtk_label_new (_(" ")); gtk_widget_show (status1); gtk_container_add (GTK_CONTAINER (frame2), status1); gtk_label_set_justify (GTK_LABEL (status1), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment (GTK_MISC (status1), 0, 0.5); - g_signal_connect ((gpointer) app1, "delete_event", - G_CALLBACK (on_app1_delete_event), + g_signal_connect ((gpointer) console, "delete_event", + G_CALLBACK (on_console_delete_event), NULL); g_signal_connect ((gpointer) connect_button1, "clicked", G_CALLBACK (on_connect_button_clicked), @@ -354,50 +355,50 @@ create_app1 (void) NULL); /* Store pointers to all widgets, for use by lookup_widget(). */ - GLADE_HOOKUP_OBJECT_NO_REF (app1, app1, "app1"); - GLADE_HOOKUP_OBJECT (app1, vbox6, "vbox6"); - GLADE_HOOKUP_OBJECT (app1, handlebox1, "handlebox1"); - GLADE_HOOKUP_OBJECT (app1, menubar1, "menubar1"); - GLADE_HOOKUP_OBJECT (app1, menubar1_uiinfo[0].widget, "file1"); - GLADE_HOOKUP_OBJECT (app1, file1_menu_uiinfo[0].widget, "connect1"); - GLADE_HOOKUP_OBJECT (app1, file1_menu_uiinfo[1].widget, "disconnect1"); - GLADE_HOOKUP_OBJECT (app1, file1_menu_uiinfo[2].widget, "menuitem4"); - GLADE_HOOKUP_OBJECT (app1, file1_menu_uiinfo[3].widget, "exit1"); - GLADE_HOOKUP_OBJECT (app1, menubar1_uiinfo[1].widget, "edit1"); - GLADE_HOOKUP_OBJECT (app1, edit1_menu_uiinfo[0].widget, "cut1"); - GLADE_HOOKUP_OBJECT (app1, edit1_menu_uiinfo[1].widget, "copy1"); - GLADE_HOOKUP_OBJECT (app1, edit1_menu_uiinfo[2].widget, "paste1"); - GLADE_HOOKUP_OBJECT (app1, edit1_menu_uiinfo[3].widget, "clear1"); - GLADE_HOOKUP_OBJECT (app1, edit1_menu_uiinfo[4].widget, "separator1"); - GLADE_HOOKUP_OBJECT (app1, menubar1_uiinfo[2].widget, "item1"); - GLADE_HOOKUP_OBJECT (app1, item1_menu_uiinfo[0].widget, "msgs"); - GLADE_HOOKUP_OBJECT (app1, menubar1_uiinfo[3].widget, "settings1"); - GLADE_HOOKUP_OBJECT (app1, settings1_menu_uiinfo[0].widget, "preferences1"); - GLADE_HOOKUP_OBJECT (app1, menubar1_uiinfo[4].widget, "help1"); - GLADE_HOOKUP_OBJECT (app1, help1_menu_uiinfo[0].widget, "about1"); - GLADE_HOOKUP_OBJECT (app1, handlebox2, "handlebox2"); - GLADE_HOOKUP_OBJECT (app1, toolbar2, "toolbar2"); - GLADE_HOOKUP_OBJECT (app1, connect_button1, "connect_button1"); - GLADE_HOOKUP_OBJECT (app1, run_button1, "run_button1"); - GLADE_HOOKUP_OBJECT (app1, msgs_button, "msgs_button"); - GLADE_HOOKUP_OBJECT (app1, restore_button, "restore_button"); - GLADE_HOOKUP_OBJECT (app1, label_button, "label_button"); - GLADE_HOOKUP_OBJECT (app1, vbox7, "vbox7"); - GLADE_HOOKUP_OBJECT (app1, scroll1, "scroll1"); - GLADE_HOOKUP_OBJECT (app1, text1, "text1"); - GLADE_HOOKUP_OBJECT (app1, hbox18, "hbox18"); - GLADE_HOOKUP_OBJECT (app1, label38, "label38"); - GLADE_HOOKUP_OBJECT (app1, entry1, "entry1"); - GLADE_HOOKUP_OBJECT (app1, hbox19, "hbox19"); - GLADE_HOOKUP_OBJECT (app1, frame1, "frame1"); - GLADE_HOOKUP_OBJECT (app1, label39, "label39"); - GLADE_HOOKUP_OBJECT (app1, frame2, "frame2"); - GLADE_HOOKUP_OBJECT (app1, status1, "status1"); - GLADE_HOOKUP_OBJECT_NO_REF (app1, tooltips, "tooltips"); + GLADE_HOOKUP_OBJECT_NO_REF (console, console, "console"); + GLADE_HOOKUP_OBJECT (console, vbox6, "vbox6"); + GLADE_HOOKUP_OBJECT (console, handlebox1, "handlebox1"); + GLADE_HOOKUP_OBJECT (console, menubar1, "menubar1"); + GLADE_HOOKUP_OBJECT (console, menubar1_uiinfo[0].widget, "file1"); + GLADE_HOOKUP_OBJECT (console, file1_menu_uiinfo[0].widget, "connect1"); + GLADE_HOOKUP_OBJECT (console, file1_menu_uiinfo[1].widget, "disconnect1"); + GLADE_HOOKUP_OBJECT (console, file1_menu_uiinfo[2].widget, "menuitem4"); + GLADE_HOOKUP_OBJECT (console, file1_menu_uiinfo[3].widget, "exit1"); + GLADE_HOOKUP_OBJECT (console, menubar1_uiinfo[1].widget, "edit1"); + GLADE_HOOKUP_OBJECT (console, edit1_menu_uiinfo[0].widget, "cut1"); + GLADE_HOOKUP_OBJECT (console, edit1_menu_uiinfo[1].widget, "copy1"); + GLADE_HOOKUP_OBJECT (console, edit1_menu_uiinfo[2].widget, "paste1"); + GLADE_HOOKUP_OBJECT (console, edit1_menu_uiinfo[3].widget, "clear1"); + GLADE_HOOKUP_OBJECT (console, edit1_menu_uiinfo[4].widget, "separator1"); + GLADE_HOOKUP_OBJECT (console, menubar1_uiinfo[2].widget, "item1"); + GLADE_HOOKUP_OBJECT (console, item1_menu_uiinfo[0].widget, "msgs"); + GLADE_HOOKUP_OBJECT (console, menubar1_uiinfo[3].widget, "settings1"); + GLADE_HOOKUP_OBJECT (console, settings1_menu_uiinfo[0].widget, "preferences1"); + GLADE_HOOKUP_OBJECT (console, menubar1_uiinfo[4].widget, "help1"); + GLADE_HOOKUP_OBJECT (console, help1_menu_uiinfo[0].widget, "about1"); + GLADE_HOOKUP_OBJECT (console, handlebox2, "handlebox2"); + GLADE_HOOKUP_OBJECT (console, toolbar2, "toolbar2"); + GLADE_HOOKUP_OBJECT (console, connect_button1, "connect_button1"); + GLADE_HOOKUP_OBJECT (console, run_button1, "run_button1"); + GLADE_HOOKUP_OBJECT (console, msgs_button, "msgs_button"); + GLADE_HOOKUP_OBJECT (console, restore_button, "restore_button"); + GLADE_HOOKUP_OBJECT (console, label_button, "label_button"); + GLADE_HOOKUP_OBJECT (console, vbox7, "vbox7"); + GLADE_HOOKUP_OBJECT (console, scroll1, "scroll1"); + GLADE_HOOKUP_OBJECT (console, text1, "text1"); + GLADE_HOOKUP_OBJECT (console, hbox18, "hbox18"); + GLADE_HOOKUP_OBJECT (console, label38, "label38"); + GLADE_HOOKUP_OBJECT (console, entry1, "entry1"); + GLADE_HOOKUP_OBJECT (console, hbox19, "hbox19"); + GLADE_HOOKUP_OBJECT (console, frame1, "frame1"); + GLADE_HOOKUP_OBJECT (console, label39, "label39"); + GLADE_HOOKUP_OBJECT (console, frame2, "frame2"); + GLADE_HOOKUP_OBJECT (console, status1, "status1"); + GLADE_HOOKUP_OBJECT_NO_REF (console, tooltips, "tooltips"); gtk_widget_grab_focus (entry1); gtk_widget_grab_default (entry1); - return app1; + return console; } GtkWidget* @@ -432,7 +433,7 @@ create_about1 (void) gtk_widget_show (vbox9); gtk_box_pack_start (GTK_BOX (vbox8), vbox9, TRUE, TRUE, 0); - about_head = gtk_label_new (_("Bacula Console 1.32c (24 Oct 03)\n")); + about_head = gtk_label_new (_("Bacula Console 1.34.0 (16 Mar 04)\n")); gtk_widget_show (about_head); gtk_box_pack_start (GTK_BOX (vbox9), about_head, FALSE, FALSE, 0); @@ -440,7 +441,7 @@ create_about1 (void) gtk_widget_show (hseparator1); gtk_box_pack_start (GTK_BOX (vbox9), hseparator1, FALSE, FALSE, 0); - copyright = gtk_label_new (_("Copyright (c) 1999 - 2002, Kern Sibbald and John Walker")); + copyright = gtk_label_new (_("Copyright (c) 2000 - 2004, Kern Sibbald and John Walker")); gtk_widget_show (copyright); gtk_box_pack_start (GTK_BOX (vbox9), copyright, TRUE, FALSE, 0); gtk_label_set_justify (GTK_LABEL (copyright), GTK_JUSTIFY_LEFT); @@ -473,6 +474,7 @@ create_about1 (void) about_button = gtk_button_new_from_stock ("gtk-ok"); gtk_widget_show (about_button); gtk_box_pack_start (GTK_BOX (hbox20), about_button, FALSE, FALSE, 0); + gtk_widget_set_size_request (about_button, 400, 640); gtk_container_set_border_width (GTK_CONTAINER (about_button), 1); GTK_WIDGET_SET_FLAGS (about_button, GTK_CAN_DEFAULT); @@ -1047,249 +1049,224 @@ create_RunDialog (void) return RunDialog; } +static GnomeUIInfo file2_menu_uiinfo[] = +{ + GNOMEUIINFO_MENU_NEW_ITEM (N_("_New"), NULL, on_new1_activate, NULL), + GNOMEUIINFO_MENU_OPEN_ITEM (on_open1_activate, NULL), + GNOMEUIINFO_MENU_SAVE_ITEM (on_save1_activate, NULL), + GNOMEUIINFO_MENU_SAVE_AS_ITEM (on_save_as1_activate, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_EXIT_ITEM (on_quit1_activate, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo edit2_menu_uiinfo[] = +{ + GNOMEUIINFO_MENU_CUT_ITEM (on_cut2_activate, NULL), + GNOMEUIINFO_MENU_COPY_ITEM (on_copy2_activate, NULL), + GNOMEUIINFO_MENU_PASTE_ITEM (on_paste2_activate, NULL), + GNOMEUIINFO_MENU_CLEAR_ITEM (on_clear2_activate, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_PROPERTIES_ITEM (on_properties1_activate, NULL), + GNOMEUIINFO_SEPARATOR, + GNOMEUIINFO_MENU_PREFERENCES_ITEM (on_preferences2_activate, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo view1_menu_uiinfo[] = +{ + GNOMEUIINFO_END +}; + +static GnomeUIInfo help2_menu_uiinfo[] = +{ + GNOMEUIINFO_MENU_ABOUT_ITEM (on_about2_activate, NULL), + GNOMEUIINFO_END +}; + +static GnomeUIInfo menubar2_uiinfo[] = +{ + GNOMEUIINFO_MENU_FILE_TREE (file2_menu_uiinfo), + GNOMEUIINFO_MENU_EDIT_TREE (edit2_menu_uiinfo), + GNOMEUIINFO_MENU_VIEW_TREE (view1_menu_uiinfo), + GNOMEUIINFO_MENU_HELP_TREE (help2_menu_uiinfo), + GNOMEUIINFO_END +}; + GtkWidget* -create_restore_files (void) +create_restore_file_selection (void) { - GtkWidget *restore_files; + GtkWidget *restore_file_selection; GtkWidget *vbox13; - GtkWidget *scrolledwindow4; - GtkWidget *ctree2; + GtkWidget *handlebox4; + GtkWidget *menubar2; + GtkWidget *handlebox3; + GtkWidget *toolbar3; + GtkWidget *restore_up_button; + GtkWidget *restore_add_button; + GtkWidget *restore_remove_button; GtkWidget *hbox38; GtkWidget *label88; - GtkWidget *entry25; + GtkWidget *restore_dir; + GtkWidget *scrolled; GtkWidget *hbox44; - GtkWidget *label105; - GtkWidget *restore_file; - GtkTooltips *tooltips; - - tooltips = gtk_tooltips_new (); - - restore_files = gtk_window_new (GTK_WINDOW_TOPLEVEL); - gtk_window_set_title (GTK_WINDOW (restore_files), _("Restore File Selection")); - gtk_window_set_modal (GTK_WINDOW (restore_files), TRUE); + GtkWidget *label115; + GtkWidget *restore_select_ok; + GtkWidget *label116; + GtkWidget *restore_select_cancel; + GtkWidget *label117; + + restore_file_selection = gtk_window_new (GTK_WINDOW_TOPLEVEL); + gtk_widget_set_size_request (restore_file_selection, 640, 480); + gtk_window_set_title (GTK_WINDOW (restore_file_selection), _("Restore File Selection")); + gtk_window_set_modal (GTK_WINDOW (restore_file_selection), TRUE); + gtk_window_set_default_size (GTK_WINDOW (restore_file_selection), 640, 400); vbox13 = gtk_vbox_new (FALSE, 0); gtk_widget_show (vbox13); - gtk_container_add (GTK_CONTAINER (restore_files), vbox13); + gtk_container_add (GTK_CONTAINER (restore_file_selection), vbox13); + + handlebox4 = gtk_handle_box_new (); + gtk_widget_show (handlebox4); + gtk_box_pack_start (GTK_BOX (vbox13), handlebox4, FALSE, FALSE, 0); + + menubar2 = gtk_menu_bar_new (); + gtk_widget_show (menubar2); + gtk_container_add (GTK_CONTAINER (handlebox4), menubar2); + gnome_app_fill_menu (GTK_MENU_SHELL (menubar2), menubar2_uiinfo, + NULL, FALSE, 0); + + handlebox3 = gtk_handle_box_new (); + gtk_widget_show (handlebox3); + gtk_box_pack_start (GTK_BOX (vbox13), handlebox3, FALSE, FALSE, 0); - scrolledwindow4 = gtk_scrolled_window_new (NULL, NULL); - gtk_widget_show (scrolledwindow4); - gtk_box_pack_start (GTK_BOX (vbox13), scrolledwindow4, TRUE, TRUE, 0); - GTK_WIDGET_UNSET_FLAGS (scrolledwindow4, GTK_CAN_FOCUS); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow4), GTK_SHADOW_IN); + toolbar3 = gtk_toolbar_new (); + gtk_widget_show (toolbar3); + gtk_container_add (GTK_CONTAINER (handlebox3), toolbar3); + gtk_toolbar_set_style (GTK_TOOLBAR (toolbar3), GTK_TOOLBAR_BOTH); - ctree2 = gtk_tree_view_new (); - gtk_widget_show (ctree2); - gtk_container_add (GTK_CONTAINER (scrolledwindow4), ctree2); + restore_up_button = gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar3), + "gtk-go-up", + NULL, + NULL, NULL, NULL, -1); + gtk_widget_show (restore_up_button); + + restore_add_button = gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar3), + "gtk-add", + NULL, + NULL, NULL, NULL, -1); + gtk_widget_show (restore_add_button); + + restore_remove_button = gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar3), + "gtk-remove", + NULL, + NULL, NULL, NULL, -1); + gtk_widget_show (restore_remove_button); hbox38 = gtk_hbox_new (FALSE, 0); gtk_widget_show (hbox38); gtk_box_pack_start (GTK_BOX (vbox13), hbox38, FALSE, TRUE, 0); - label88 = gtk_label_new (_(" cwd:")); + label88 = gtk_label_new (_("Current dir:")); gtk_widget_show (label88); gtk_box_pack_start (GTK_BOX (hbox38), label88, FALSE, TRUE, 0); - entry25 = gtk_entry_new (); - gtk_widget_show (entry25); - gtk_box_pack_start (GTK_BOX (hbox38), entry25, TRUE, TRUE, 0); - GTK_WIDGET_SET_FLAGS (entry25, GTK_CAN_DEFAULT); - gtk_tooltips_set_tip (tooltips, entry25, _("Enter Commands Here"), NULL); + restore_dir = gtk_entry_new (); + gtk_widget_show (restore_dir); + gtk_box_pack_start (GTK_BOX (hbox38), restore_dir, TRUE, TRUE, 0); - hbox44 = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox44); - gtk_box_pack_start (GTK_BOX (vbox13), hbox44, FALSE, TRUE, 0); - - label105 = gtk_label_new (_(" ")); - gtk_widget_show (label105); - gtk_box_pack_start (GTK_BOX (hbox44), label105, TRUE, FALSE, 0); - gtk_label_set_justify (GTK_LABEL (label105), GTK_JUSTIFY_FILL); - gtk_misc_set_padding (GTK_MISC (label105), 59, 0); - - restore_file = gtk_button_new_from_stock ("gtk-ok"); - gtk_widget_show (restore_file); - gtk_box_pack_start (GTK_BOX (hbox44), restore_file, TRUE, FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (restore_file), 9); + scrolled = gtk_scrolled_window_new (NULL, NULL); + gtk_widget_show (scrolled); + gtk_box_pack_start (GTK_BOX (vbox13), scrolled, TRUE, TRUE, 0); - g_signal_connect ((gpointer) entry25, "key_press_event", - G_CALLBACK (on_entry1_key_press_event), + hbox44 = gtk_hbox_new (TRUE, 0); + gtk_widget_show (hbox44); + gtk_box_pack_start (GTK_BOX (vbox13), hbox44, FALSE, TRUE, 7); + + label115 = gtk_label_new (_(" ")); + gtk_widget_show (label115); + gtk_box_pack_start (GTK_BOX (hbox44), label115, TRUE, TRUE, 0); + gtk_label_set_justify (GTK_LABEL (label115), GTK_JUSTIFY_LEFT); + gtk_misc_set_alignment (GTK_MISC (label115), 0.94, 0.5); + + restore_select_ok = gtk_button_new_from_stock ("gtk-ok"); + gtk_widget_show (restore_select_ok); + gtk_box_pack_start (GTK_BOX (hbox44), restore_select_ok, FALSE, TRUE, 0); + + label116 = gtk_label_new (""); + gtk_widget_show (label116); + gtk_box_pack_start (GTK_BOX (hbox44), label116, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label116), GTK_JUSTIFY_LEFT); + + restore_select_cancel = gtk_button_new_from_stock ("gtk-cancel"); + gtk_widget_show (restore_select_cancel); + gtk_box_pack_start (GTK_BOX (hbox44), restore_select_cancel, FALSE, TRUE, 0); + + label117 = gtk_label_new (""); + gtk_widget_show (label117); + gtk_box_pack_start (GTK_BOX (hbox44), label117, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (label117), GTK_JUSTIFY_LEFT); + + g_signal_connect ((gpointer) restore_file_selection, "delete_event", + G_CALLBACK (on_restore_files_delete_event), NULL); - g_signal_connect ((gpointer) entry25, "key_release_event", - G_CALLBACK (on_entry1_key_release_event), + g_signal_connect ((gpointer) restore_up_button, "clicked", + G_CALLBACK (on_restore_up_button_clicked), NULL); - g_signal_connect ((gpointer) restore_file, "clicked", - G_CALLBACK (on_restore_file_clicked), + g_signal_connect ((gpointer) restore_add_button, "clicked", + G_CALLBACK (on_restore_add_button_clicked), NULL); - - /* Store pointers to all widgets, for use by lookup_widget(). */ - GLADE_HOOKUP_OBJECT_NO_REF (restore_files, restore_files, "restore_files"); - GLADE_HOOKUP_OBJECT (restore_files, vbox13, "vbox13"); - GLADE_HOOKUP_OBJECT (restore_files, scrolledwindow4, "scrolledwindow4"); - GLADE_HOOKUP_OBJECT (restore_files, ctree2, "ctree2"); - GLADE_HOOKUP_OBJECT (restore_files, hbox38, "hbox38"); - GLADE_HOOKUP_OBJECT (restore_files, label88, "label88"); - GLADE_HOOKUP_OBJECT (restore_files, entry25, "entry25"); - GLADE_HOOKUP_OBJECT (restore_files, hbox44, "hbox44"); - GLADE_HOOKUP_OBJECT (restore_files, label105, "label105"); - GLADE_HOOKUP_OBJECT (restore_files, restore_file, "restore_file"); - GLADE_HOOKUP_OBJECT_NO_REF (restore_files, tooltips, "tooltips"); - - gtk_widget_grab_focus (entry25); - gtk_widget_grab_default (entry25); - return restore_files; -} - -GtkWidget* -create_restore_dialog (void) -{ - GtkWidget *restore_dialog; - GtkWidget *dialog_vbox8; - GtkWidget *hbox42; - GtkWidget *frame3; - GtkWidget *hbox43; - GtkWidget *label102; - GtkWidget *vbox15; - GtkWidget *label103; - GtkWidget *rb_most_recent; - GSList *rb_most_recent_group = NULL; - GtkWidget *rb_jobs; - GSList *rb_jobs_group = NULL; - GtkWidget *rb_file; - GSList *rb_file_group = NULL; - GtkWidget *label104; - GtkWidget *label106; - GtkWidget *vbox14; - GtkWidget *apply_button; - GtkWidget *dialog_action_area7; - GtkWidget *hbuttonbox2; - GtkWidget *restore_ok; - GtkWidget *restore_cancel; - - restore_dialog = gtk_dialog_new (); - gtk_window_set_title (GTK_WINDOW (restore_dialog), _("Restore Files")); - gtk_window_set_modal (GTK_WINDOW (restore_dialog), TRUE); - - dialog_vbox8 = GTK_DIALOG (restore_dialog)->vbox; - gtk_widget_show (dialog_vbox8); - - hbox42 = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox42); - gtk_box_pack_start (GTK_BOX (dialog_vbox8), hbox42, TRUE, TRUE, 0); - - frame3 = gtk_frame_new (NULL); - gtk_widget_show (frame3); - gtk_box_pack_start (GTK_BOX (hbox42), frame3, TRUE, TRUE, 0); - gtk_container_set_border_width (GTK_CONTAINER (frame3), 8); - - hbox43 = gtk_hbox_new (FALSE, 0); - gtk_widget_show (hbox43); - gtk_container_add (GTK_CONTAINER (frame3), hbox43); - - label102 = gtk_label_new (_(" ")); - gtk_widget_show (label102); - gtk_box_pack_end (GTK_BOX (hbox43), label102, FALSE, FALSE, 0); - - vbox15 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox15); - gtk_box_pack_start (GTK_BOX (hbox43), vbox15, TRUE, TRUE, 0); - - label103 = gtk_label_new (""); - gtk_widget_show (label103); - gtk_box_pack_start (GTK_BOX (vbox15), label103, FALSE, FALSE, 0); - gtk_misc_set_padding (GTK_MISC (label103), 0, 2); - - rb_most_recent = gtk_radio_button_new_with_mnemonic (NULL, _("Select most recent backup")); - gtk_widget_show (rb_most_recent); - gtk_box_pack_start (GTK_BOX (vbox15), rb_most_recent, FALSE, FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (rb_most_recent), 3); - gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_most_recent), rb_most_recent_group); - rb_most_recent_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_most_recent)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (rb_most_recent), TRUE); - - rb_jobs = gtk_radio_button_new_with_mnemonic (NULL, _("Select list of Jobs")); - gtk_widget_show (rb_jobs); - gtk_box_pack_start (GTK_BOX (vbox15), rb_jobs, FALSE, FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (rb_jobs), 5); - gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_jobs), rb_jobs_group); - rb_jobs_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_jobs)); - - rb_file = gtk_radio_button_new_with_mnemonic (NULL, _("Find a specific file")); - gtk_widget_show (rb_file); - gtk_box_pack_start (GTK_BOX (vbox15), rb_file, FALSE, FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (rb_file), 4); - gtk_radio_button_set_group (GTK_RADIO_BUTTON (rb_file), rb_file_group); - rb_file_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (rb_file)); - - label104 = gtk_label_new (""); - gtk_widget_show (label104); - gtk_box_pack_start (GTK_BOX (vbox15), label104, FALSE, FALSE, 0); - - label106 = gtk_label_new (_("Select by:")); - gtk_widget_show (label106); - gtk_frame_set_label_widget (GTK_FRAME (frame3), label106); - gtk_label_set_justify (GTK_LABEL (label106), GTK_JUSTIFY_LEFT); - - vbox14 = gtk_vbox_new (FALSE, 0); - gtk_widget_show (vbox14); - gtk_box_pack_start (GTK_BOX (hbox42), vbox14, FALSE, FALSE, 0); - - apply_button = gtk_button_new_from_stock ("gtk-apply"); - gtk_widget_show (apply_button); - gtk_box_pack_start (GTK_BOX (vbox14), apply_button, FALSE, FALSE, 0); - gtk_container_set_border_width (GTK_CONTAINER (apply_button), 50); - - dialog_action_area7 = GTK_DIALOG (restore_dialog)->action_area; - gtk_widget_show (dialog_action_area7); - gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area7), GTK_BUTTONBOX_END); - - hbuttonbox2 = gtk_hbutton_box_new (); - gtk_widget_show (hbuttonbox2); - gtk_container_add (GTK_CONTAINER (dialog_action_area7), hbuttonbox2); - gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox2), GTK_BUTTONBOX_END); - gtk_box_set_spacing (GTK_BOX (hbuttonbox2), 8); - - restore_ok = gtk_button_new_from_stock ("gtk-ok"); - gtk_widget_show (restore_ok); - gtk_container_add (GTK_CONTAINER (hbuttonbox2), restore_ok); - GTK_WIDGET_SET_FLAGS (restore_ok, GTK_CAN_DEFAULT); - - restore_cancel = gtk_button_new_from_stock ("gtk-cancel"); - gtk_widget_show (restore_cancel); - gtk_container_add (GTK_CONTAINER (hbuttonbox2), restore_cancel); - GTK_WIDGET_SET_FLAGS (restore_cancel, GTK_CAN_DEFAULT); - - g_signal_connect ((gpointer) apply_button, "clicked", - G_CALLBACK (on_apply_button_clicked), + g_signal_connect ((gpointer) restore_remove_button, "clicked", + G_CALLBACK (on_restore_remove_button_clicked), NULL); - g_signal_connect ((gpointer) restore_ok, "clicked", - G_CALLBACK (on_restore_ok_clicked), + g_signal_connect ((gpointer) restore_select_ok, "clicked", + G_CALLBACK (on_restore_select_ok_clicked), NULL); - g_signal_connect ((gpointer) restore_cancel, "clicked", - G_CALLBACK (on_restore_cancel_clicked), + g_signal_connect ((gpointer) restore_select_cancel, "clicked", + G_CALLBACK (on_restore_select_cancel_clicked), NULL); /* Store pointers to all widgets, for use by lookup_widget(). */ - GLADE_HOOKUP_OBJECT_NO_REF (restore_dialog, restore_dialog, "restore_dialog"); - GLADE_HOOKUP_OBJECT_NO_REF (restore_dialog, dialog_vbox8, "dialog_vbox8"); - GLADE_HOOKUP_OBJECT (restore_dialog, hbox42, "hbox42"); - GLADE_HOOKUP_OBJECT (restore_dialog, frame3, "frame3"); - GLADE_HOOKUP_OBJECT (restore_dialog, hbox43, "hbox43"); - GLADE_HOOKUP_OBJECT (restore_dialog, label102, "label102"); - GLADE_HOOKUP_OBJECT (restore_dialog, vbox15, "vbox15"); - GLADE_HOOKUP_OBJECT (restore_dialog, label103, "label103"); - GLADE_HOOKUP_OBJECT (restore_dialog, rb_most_recent, "rb_most_recent"); - GLADE_HOOKUP_OBJECT (restore_dialog, rb_jobs, "rb_jobs"); - GLADE_HOOKUP_OBJECT (restore_dialog, rb_file, "rb_file"); - GLADE_HOOKUP_OBJECT (restore_dialog, label104, "label104"); - GLADE_HOOKUP_OBJECT (restore_dialog, label106, "label106"); - GLADE_HOOKUP_OBJECT (restore_dialog, vbox14, "vbox14"); - GLADE_HOOKUP_OBJECT (restore_dialog, apply_button, "apply_button"); - GLADE_HOOKUP_OBJECT_NO_REF (restore_dialog, dialog_action_area7, "dialog_action_area7"); - GLADE_HOOKUP_OBJECT (restore_dialog, hbuttonbox2, "hbuttonbox2"); - GLADE_HOOKUP_OBJECT (restore_dialog, restore_ok, "restore_ok"); - GLADE_HOOKUP_OBJECT (restore_dialog, restore_cancel, "restore_cancel"); - - return restore_dialog; + GLADE_HOOKUP_OBJECT_NO_REF (restore_file_selection, restore_file_selection, "restore_file_selection"); + GLADE_HOOKUP_OBJECT (restore_file_selection, vbox13, "vbox13"); + GLADE_HOOKUP_OBJECT (restore_file_selection, handlebox4, "handlebox4"); + GLADE_HOOKUP_OBJECT (restore_file_selection, menubar2, "menubar2"); + GLADE_HOOKUP_OBJECT (restore_file_selection, menubar2_uiinfo[0].widget, "file2"); + GLADE_HOOKUP_OBJECT (restore_file_selection, file2_menu_uiinfo[0].widget, "new1"); + GLADE_HOOKUP_OBJECT (restore_file_selection, file2_menu_uiinfo[1].widget, "open1"); + GLADE_HOOKUP_OBJECT (restore_file_selection, file2_menu_uiinfo[2].widget, "save1"); + GLADE_HOOKUP_OBJECT (restore_file_selection, file2_menu_uiinfo[3].widget, "save_as1"); + GLADE_HOOKUP_OBJECT (restore_file_selection, file2_menu_uiinfo[4].widget, "separator4"); + GLADE_HOOKUP_OBJECT (restore_file_selection, file2_menu_uiinfo[5].widget, "quit1"); + GLADE_HOOKUP_OBJECT (restore_file_selection, menubar2_uiinfo[1].widget, "edit2"); + GLADE_HOOKUP_OBJECT (restore_file_selection, edit2_menu_uiinfo[0].widget, "cut2"); + GLADE_HOOKUP_OBJECT (restore_file_selection, edit2_menu_uiinfo[1].widget, "copy2"); + GLADE_HOOKUP_OBJECT (restore_file_selection, edit2_menu_uiinfo[2].widget, "paste2"); + GLADE_HOOKUP_OBJECT (restore_file_selection, edit2_menu_uiinfo[3].widget, "clear2"); + GLADE_HOOKUP_OBJECT (restore_file_selection, edit2_menu_uiinfo[4].widget, "separator5"); + GLADE_HOOKUP_OBJECT (restore_file_selection, edit2_menu_uiinfo[5].widget, "properties1"); + GLADE_HOOKUP_OBJECT (restore_file_selection, edit2_menu_uiinfo[6].widget, "separator6"); + GLADE_HOOKUP_OBJECT (restore_file_selection, edit2_menu_uiinfo[7].widget, "preferences2"); + GLADE_HOOKUP_OBJECT (restore_file_selection, menubar2_uiinfo[2].widget, "view1"); + GLADE_HOOKUP_OBJECT (restore_file_selection, menubar2_uiinfo[3].widget, "help2"); + GLADE_HOOKUP_OBJECT (restore_file_selection, help2_menu_uiinfo[0].widget, "about2"); + GLADE_HOOKUP_OBJECT (restore_file_selection, handlebox3, "handlebox3"); + GLADE_HOOKUP_OBJECT (restore_file_selection, toolbar3, "toolbar3"); + GLADE_HOOKUP_OBJECT (restore_file_selection, restore_up_button, "restore_up_button"); + GLADE_HOOKUP_OBJECT (restore_file_selection, restore_add_button, "restore_add_button"); + GLADE_HOOKUP_OBJECT (restore_file_selection, restore_remove_button, "restore_remove_button"); + GLADE_HOOKUP_OBJECT (restore_file_selection, hbox38, "hbox38"); + GLADE_HOOKUP_OBJECT (restore_file_selection, label88, "label88"); + GLADE_HOOKUP_OBJECT (restore_file_selection, restore_dir, "restore_dir"); + GLADE_HOOKUP_OBJECT (restore_file_selection, scrolled, "scrolled"); + GLADE_HOOKUP_OBJECT (restore_file_selection, hbox44, "hbox44"); + GLADE_HOOKUP_OBJECT (restore_file_selection, label115, "label115"); + GLADE_HOOKUP_OBJECT (restore_file_selection, restore_select_ok, "restore_select_ok"); + GLADE_HOOKUP_OBJECT (restore_file_selection, label116, "label116"); + GLADE_HOOKUP_OBJECT (restore_file_selection, restore_select_cancel, "restore_select_cancel"); + GLADE_HOOKUP_OBJECT (restore_file_selection, label117, "label117"); + + return restore_file_selection; } GtkWidget* @@ -1480,3 +1457,342 @@ create_label_dialog (void) return label_dialog; } +GtkWidget* +create_RestoreDialog (void) +{ + GtkWidget *RestoreDialog; + GtkWidget *dialog_vbox10; + GtkWidget *vbox17; + GtkWidget *vbox18; + GtkWidget *label119; + GtkWidget *alignment3; + GtkWidget *hbox50; + GtkWidget *hbox51; + GtkWidget *label120; + GtkWidget *combo_restore_job; + GList *combo_restore_job_items = NULL; + GtkWidget *restore_job_entry; + GtkWidget *label122; + GtkWidget *hbox52; + GtkWidget *label125; + GtkWidget *combo_restore_client; + GList *combo_restore_client_items = NULL; + GtkWidget *restore_client_entry; + GtkWidget *label127; + GtkWidget *hbox53; + GtkWidget *label128; + GtkWidget *combo_restore_fileset; + GList *combo_restore_fileset_items = NULL; + GtkWidget *restore_fileset_entry; + GtkWidget *label130; + GtkWidget *hbox55; + GtkWidget *label135; + GtkWidget *combo_restore_pool; + GList *combo_restore_pool_items = NULL; + GtkWidget *restore_pool_entry; + GtkWidget *label138; + GtkWidget *hbox56; + GtkWidget *label139; + GtkWidget *combo_restore_storage; + GList *combo_restore_storage_items = NULL; + GtkWidget *restore_storage_entry; + GtkWidget *label142; + GtkWidget *hbox59; + GtkWidget *label148; + GtkWidget *restore_before_entry; + GtkWidget *label149; + GtkWidget *label150; + GtkWidget *dialog_action_area9; + GtkWidget *helpbutton1; + GtkWidget *select_files_button; + GtkWidget *alignment2; + GtkWidget *hbox49; + GtkWidget *image1; + GtkWidget *restore_select_button; + GtkWidget *restore_cancel; + + RestoreDialog = gtk_dialog_new (); + gtk_window_set_title (GTK_WINDOW (RestoreDialog), _("Restore Files Dialog")); + gtk_window_set_default_size (GTK_WINDOW (RestoreDialog), 300, 200); + + dialog_vbox10 = GTK_DIALOG (RestoreDialog)->vbox; + gtk_widget_show (dialog_vbox10); + + vbox17 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox17); + gtk_box_pack_start (GTK_BOX (dialog_vbox10), vbox17, TRUE, TRUE, 0); + + vbox18 = gtk_vbox_new (FALSE, 0); + gtk_widget_show (vbox18); + gtk_box_pack_start (GTK_BOX (vbox17), vbox18, TRUE, TRUE, 0); + + label119 = gtk_label_new (_("Restore Files")); + gtk_widget_show (label119); + gtk_box_pack_start (GTK_BOX (vbox18), label119, FALSE, FALSE, 2); + gtk_misc_set_padding (GTK_MISC (label119), 0, 9); + + alignment3 = gtk_alignment_new (0.5, 0.5, 1, 1); + gtk_widget_show (alignment3); + gtk_box_pack_start (GTK_BOX (vbox18), alignment3, FALSE, FALSE, 2); + + hbox50 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox50); + gtk_container_add (GTK_CONTAINER (alignment3), hbox50); + + hbox51 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox51); + gtk_box_pack_start (GTK_BOX (hbox50), hbox51, TRUE, TRUE, 0); + + label120 = gtk_label_new (_("Job:")); + gtk_widget_show (label120); + gtk_box_pack_start (GTK_BOX (hbox51), label120, FALSE, FALSE, 0); + gtk_widget_set_size_request (label120, 66, 16); + gtk_label_set_justify (GTK_LABEL (label120), GTK_JUSTIFY_RIGHT); + + combo_restore_job = gtk_combo_new (); + g_object_set_data (G_OBJECT (GTK_COMBO (combo_restore_job)->popwin), + "GladeParentKey", combo_restore_job); + gtk_widget_show (combo_restore_job); + gtk_box_pack_start (GTK_BOX (hbox51), combo_restore_job, TRUE, TRUE, 1); + gtk_combo_set_value_in_list (GTK_COMBO (combo_restore_job), TRUE, FALSE); + combo_restore_job_items = g_list_append (combo_restore_job_items, (gpointer) ""); + gtk_combo_set_popdown_strings (GTK_COMBO (combo_restore_job), combo_restore_job_items); + g_list_free (combo_restore_job_items); + + restore_job_entry = GTK_COMBO (combo_restore_job)->entry; + gtk_widget_show (restore_job_entry); + gtk_editable_set_editable (GTK_EDITABLE (restore_job_entry), FALSE); + + label122 = gtk_label_new (""); + gtk_widget_show (label122); + gtk_box_pack_start (GTK_BOX (hbox51), label122, FALSE, FALSE, 27); + + hbox52 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox52); + gtk_box_pack_start (GTK_BOX (vbox18), hbox52, TRUE, TRUE, 0); + + label125 = gtk_label_new (_("Client:")); + gtk_widget_show (label125); + gtk_box_pack_start (GTK_BOX (hbox52), label125, FALSE, FALSE, 0); + gtk_widget_set_size_request (label125, 66, 16); + gtk_label_set_justify (GTK_LABEL (label125), GTK_JUSTIFY_RIGHT); + + combo_restore_client = gtk_combo_new (); + g_object_set_data (G_OBJECT (GTK_COMBO (combo_restore_client)->popwin), + "GladeParentKey", combo_restore_client); + gtk_widget_show (combo_restore_client); + gtk_box_pack_start (GTK_BOX (hbox52), combo_restore_client, TRUE, TRUE, 1); + gtk_combo_set_value_in_list (GTK_COMBO (combo_restore_client), TRUE, FALSE); + combo_restore_client_items = g_list_append (combo_restore_client_items, (gpointer) ""); + gtk_combo_set_popdown_strings (GTK_COMBO (combo_restore_client), combo_restore_client_items); + g_list_free (combo_restore_client_items); + + restore_client_entry = GTK_COMBO (combo_restore_client)->entry; + gtk_widget_show (restore_client_entry); + gtk_editable_set_editable (GTK_EDITABLE (restore_client_entry), FALSE); + + label127 = gtk_label_new (_(" ")); + gtk_widget_show (label127); + gtk_box_pack_start (GTK_BOX (hbox52), label127, FALSE, FALSE, 25); + + hbox53 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox53); + gtk_box_pack_start (GTK_BOX (vbox18), hbox53, TRUE, TRUE, 2); + + label128 = gtk_label_new (_("FileSet: ")); + gtk_widget_show (label128); + gtk_box_pack_start (GTK_BOX (hbox53), label128, FALSE, FALSE, 0); + gtk_widget_set_size_request (label128, 66, 16); + gtk_label_set_justify (GTK_LABEL (label128), GTK_JUSTIFY_RIGHT); + + combo_restore_fileset = gtk_combo_new (); + g_object_set_data (G_OBJECT (GTK_COMBO (combo_restore_fileset)->popwin), + "GladeParentKey", combo_restore_fileset); + gtk_widget_show (combo_restore_fileset); + gtk_box_pack_start (GTK_BOX (hbox53), combo_restore_fileset, TRUE, TRUE, 0); + gtk_combo_set_value_in_list (GTK_COMBO (combo_restore_fileset), TRUE, FALSE); + combo_restore_fileset_items = g_list_append (combo_restore_fileset_items, (gpointer) ""); + gtk_combo_set_popdown_strings (GTK_COMBO (combo_restore_fileset), combo_restore_fileset_items); + g_list_free (combo_restore_fileset_items); + + restore_fileset_entry = GTK_COMBO (combo_restore_fileset)->entry; + gtk_widget_show (restore_fileset_entry); + gtk_editable_set_editable (GTK_EDITABLE (restore_fileset_entry), FALSE); + + label130 = gtk_label_new (_(" ")); + gtk_widget_show (label130); + gtk_box_pack_start (GTK_BOX (hbox53), label130, FALSE, FALSE, 23); + + hbox55 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox55); + gtk_box_pack_start (GTK_BOX (vbox18), hbox55, TRUE, TRUE, 2); + + label135 = gtk_label_new (_("Pool:")); + gtk_widget_show (label135); + gtk_box_pack_start (GTK_BOX (hbox55), label135, FALSE, FALSE, 0); + gtk_widget_set_size_request (label135, 66, 16); + + combo_restore_pool = gtk_combo_new (); + g_object_set_data (G_OBJECT (GTK_COMBO (combo_restore_pool)->popwin), + "GladeParentKey", combo_restore_pool); + gtk_widget_show (combo_restore_pool); + gtk_box_pack_start (GTK_BOX (hbox55), combo_restore_pool, TRUE, TRUE, 0); + gtk_combo_set_value_in_list (GTK_COMBO (combo_restore_pool), TRUE, FALSE); + combo_restore_pool_items = g_list_append (combo_restore_pool_items, (gpointer) ""); + combo_restore_pool_items = g_list_append (combo_restore_pool_items, (gpointer) ""); + gtk_combo_set_popdown_strings (GTK_COMBO (combo_restore_pool), combo_restore_pool_items); + g_list_free (combo_restore_pool_items); + + restore_pool_entry = GTK_COMBO (combo_restore_pool)->entry; + gtk_widget_show (restore_pool_entry); + gtk_editable_set_editable (GTK_EDITABLE (restore_pool_entry), FALSE); + + label138 = gtk_label_new (_(" ")); + gtk_widget_show (label138); + gtk_box_pack_start (GTK_BOX (hbox55), label138, FALSE, FALSE, 21); + + hbox56 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox56); + gtk_box_pack_start (GTK_BOX (vbox18), hbox56, TRUE, TRUE, 0); + + label139 = gtk_label_new (_("Storage:")); + gtk_widget_show (label139); + gtk_box_pack_start (GTK_BOX (hbox56), label139, FALSE, FALSE, 0); + gtk_widget_set_size_request (label139, 66, 16); + + combo_restore_storage = gtk_combo_new (); + g_object_set_data (G_OBJECT (GTK_COMBO (combo_restore_storage)->popwin), + "GladeParentKey", combo_restore_storage); + gtk_widget_show (combo_restore_storage); + gtk_box_pack_start (GTK_BOX (hbox56), combo_restore_storage, TRUE, TRUE, 0); + gtk_combo_set_value_in_list (GTK_COMBO (combo_restore_storage), TRUE, FALSE); + combo_restore_storage_items = g_list_append (combo_restore_storage_items, (gpointer) ""); + combo_restore_storage_items = g_list_append (combo_restore_storage_items, (gpointer) ""); + gtk_combo_set_popdown_strings (GTK_COMBO (combo_restore_storage), combo_restore_storage_items); + g_list_free (combo_restore_storage_items); + + restore_storage_entry = GTK_COMBO (combo_restore_storage)->entry; + gtk_widget_show (restore_storage_entry); + gtk_editable_set_editable (GTK_EDITABLE (restore_storage_entry), FALSE); + + label142 = gtk_label_new (_(" ")); + gtk_widget_show (label142); + gtk_box_pack_start (GTK_BOX (hbox56), label142, FALSE, FALSE, 21); + + hbox59 = gtk_hbox_new (FALSE, 0); + gtk_widget_show (hbox59); + gtk_box_pack_start (GTK_BOX (vbox17), hbox59, TRUE, TRUE, 0); + + label148 = gtk_label_new (_("Before:")); + gtk_widget_show (label148); + gtk_box_pack_start (GTK_BOX (hbox59), label148, FALSE, FALSE, 0); + gtk_widget_set_size_request (label148, 66, 16); + + restore_before_entry = gtk_entry_new (); + gtk_widget_show (restore_before_entry); + gtk_box_pack_start (GTK_BOX (hbox59), restore_before_entry, TRUE, TRUE, 0); + + label149 = gtk_label_new (_(" ")); + gtk_widget_show (label149); + gtk_box_pack_start (GTK_BOX (hbox59), label149, FALSE, FALSE, 53); + + label150 = gtk_label_new (_(" ")); + gtk_widget_show (label150); + gtk_box_pack_start (GTK_BOX (vbox17), label150, FALSE, FALSE, 0); + + dialog_action_area9 = GTK_DIALOG (RestoreDialog)->action_area; + gtk_widget_show (dialog_action_area9); + gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area9), GTK_BUTTONBOX_END); + + helpbutton1 = gtk_button_new_from_stock ("gtk-help"); + gtk_widget_show (helpbutton1); + gtk_dialog_add_action_widget (GTK_DIALOG (RestoreDialog), helpbutton1, GTK_RESPONSE_HELP); + GTK_WIDGET_SET_FLAGS (helpbutton1, GTK_CAN_DEFAULT); + + select_files_button = gtk_button_new (); + gtk_widget_show (select_files_button); + gtk_dialog_add_action_widget (GTK_DIALOG (RestoreDialog), select_files_button, 0); + GTK_WIDGET_SET_FLAGS (select_files_button, GTK_CAN_DEFAULT); + + alignment2 = gtk_alignment_new (0.5, 0.5, 0, 0); + gtk_widget_show (alignment2); + gtk_container_add (GTK_CONTAINER (select_files_button), alignment2); + + hbox49 = gtk_hbox_new (FALSE, 2); + gtk_widget_show (hbox49); + gtk_container_add (GTK_CONTAINER (alignment2), hbox49); + + image1 = gtk_image_new_from_stock ("gtk-apply", GTK_ICON_SIZE_BUTTON); + gtk_widget_show (image1); + gtk_box_pack_start (GTK_BOX (hbox49), image1, FALSE, FALSE, 0); + + restore_select_button = gtk_label_new_with_mnemonic (_("Select Files")); + gtk_widget_show (restore_select_button); + gtk_box_pack_start (GTK_BOX (hbox49), restore_select_button, FALSE, FALSE, 0); + gtk_label_set_justify (GTK_LABEL (restore_select_button), GTK_JUSTIFY_LEFT); + + restore_cancel = gtk_button_new_from_stock ("gtk-cancel"); + gtk_widget_show (restore_cancel); + gtk_dialog_add_action_widget (GTK_DIALOG (RestoreDialog), restore_cancel, GTK_RESPONSE_CANCEL); + GTK_WIDGET_SET_FLAGS (restore_cancel, GTK_CAN_DEFAULT); + + g_signal_connect ((gpointer) restore_job_entry, "changed", + G_CALLBACK (on_restore_job_entry_changed), + NULL); + g_signal_connect ((gpointer) select_files_button, "clicked", + G_CALLBACK (on_select_files_button_clicked), + NULL); + g_signal_connect ((gpointer) restore_cancel, "clicked", + G_CALLBACK (on_restore_cancel_clicked), + NULL); + + /* Store pointers to all widgets, for use by lookup_widget(). */ + GLADE_HOOKUP_OBJECT_NO_REF (RestoreDialog, RestoreDialog, "RestoreDialog"); + GLADE_HOOKUP_OBJECT_NO_REF (RestoreDialog, dialog_vbox10, "dialog_vbox10"); + GLADE_HOOKUP_OBJECT (RestoreDialog, vbox17, "vbox17"); + GLADE_HOOKUP_OBJECT (RestoreDialog, vbox18, "vbox18"); + GLADE_HOOKUP_OBJECT (RestoreDialog, label119, "label119"); + GLADE_HOOKUP_OBJECT (RestoreDialog, alignment3, "alignment3"); + GLADE_HOOKUP_OBJECT (RestoreDialog, hbox50, "hbox50"); + GLADE_HOOKUP_OBJECT (RestoreDialog, hbox51, "hbox51"); + GLADE_HOOKUP_OBJECT (RestoreDialog, label120, "label120"); + GLADE_HOOKUP_OBJECT (RestoreDialog, combo_restore_job, "combo_restore_job"); + GLADE_HOOKUP_OBJECT (RestoreDialog, restore_job_entry, "restore_job_entry"); + GLADE_HOOKUP_OBJECT (RestoreDialog, label122, "label122"); + GLADE_HOOKUP_OBJECT (RestoreDialog, hbox52, "hbox52"); + GLADE_HOOKUP_OBJECT (RestoreDialog, label125, "label125"); + GLADE_HOOKUP_OBJECT (RestoreDialog, combo_restore_client, "combo_restore_client"); + GLADE_HOOKUP_OBJECT (RestoreDialog, restore_client_entry, "restore_client_entry"); + GLADE_HOOKUP_OBJECT (RestoreDialog, label127, "label127"); + GLADE_HOOKUP_OBJECT (RestoreDialog, hbox53, "hbox53"); + GLADE_HOOKUP_OBJECT (RestoreDialog, label128, "label128"); + GLADE_HOOKUP_OBJECT (RestoreDialog, combo_restore_fileset, "combo_restore_fileset"); + GLADE_HOOKUP_OBJECT (RestoreDialog, restore_fileset_entry, "restore_fileset_entry"); + GLADE_HOOKUP_OBJECT (RestoreDialog, label130, "label130"); + GLADE_HOOKUP_OBJECT (RestoreDialog, hbox55, "hbox55"); + GLADE_HOOKUP_OBJECT (RestoreDialog, label135, "label135"); + GLADE_HOOKUP_OBJECT (RestoreDialog, combo_restore_pool, "combo_restore_pool"); + GLADE_HOOKUP_OBJECT (RestoreDialog, restore_pool_entry, "restore_pool_entry"); + GLADE_HOOKUP_OBJECT (RestoreDialog, label138, "label138"); + GLADE_HOOKUP_OBJECT (RestoreDialog, hbox56, "hbox56"); + GLADE_HOOKUP_OBJECT (RestoreDialog, label139, "label139"); + GLADE_HOOKUP_OBJECT (RestoreDialog, combo_restore_storage, "combo_restore_storage"); + GLADE_HOOKUP_OBJECT (RestoreDialog, restore_storage_entry, "restore_storage_entry"); + GLADE_HOOKUP_OBJECT (RestoreDialog, label142, "label142"); + GLADE_HOOKUP_OBJECT (RestoreDialog, hbox59, "hbox59"); + GLADE_HOOKUP_OBJECT (RestoreDialog, label148, "label148"); + GLADE_HOOKUP_OBJECT (RestoreDialog, restore_before_entry, "restore_before_entry"); + GLADE_HOOKUP_OBJECT (RestoreDialog, label149, "label149"); + GLADE_HOOKUP_OBJECT (RestoreDialog, label150, "label150"); + GLADE_HOOKUP_OBJECT_NO_REF (RestoreDialog, dialog_action_area9, "dialog_action_area9"); + GLADE_HOOKUP_OBJECT (RestoreDialog, helpbutton1, "helpbutton1"); + GLADE_HOOKUP_OBJECT (RestoreDialog, select_files_button, "select_files_button"); + GLADE_HOOKUP_OBJECT (RestoreDialog, alignment2, "alignment2"); + GLADE_HOOKUP_OBJECT (RestoreDialog, hbox49, "hbox49"); + GLADE_HOOKUP_OBJECT (RestoreDialog, image1, "image1"); + GLADE_HOOKUP_OBJECT (RestoreDialog, restore_select_button, "restore_select_button"); + GLADE_HOOKUP_OBJECT (RestoreDialog, restore_cancel, "restore_cancel"); + + return RestoreDialog; +} + diff --git a/bacula/src/gnome2-console/interface.h b/bacula/src/gnome2-console/interface.h index f9853e1742..928ec69e48 100644 --- a/bacula/src/gnome2-console/interface.h +++ b/bacula/src/gnome2-console/interface.h @@ -2,10 +2,10 @@ * DO NOT EDIT THIS FILE - it is generated by Glade. */ -GtkWidget* create_app1 (void); +GtkWidget* create_console (void); GtkWidget* create_about1 (void); GtkWidget* create_SelectDirectorDialog (void); GtkWidget* create_RunDialog (void); -GtkWidget* create_restore_files (void); -GtkWidget* create_restore_dialog (void); +GtkWidget* create_restore_file_selection (void); GtkWidget* create_label_dialog (void); +GtkWidget* create_RestoreDialog (void); diff --git a/bacula/src/gnome2-console/restore.c b/bacula/src/gnome2-console/restore.c new file mode 100755 index 0000000000..1d2e211718 --- /dev/null +++ b/bacula/src/gnome2-console/restore.c @@ -0,0 +1,330 @@ +/* + * Handle console GUI selection of files + * Kern Sibbald, March, 2004 + * +*/ + +#include "bacula.h" +#include "console.h" +#include "interface.h" +#include "support.h" +#include "restore.h" + +extern BSOCK *UA_sock; +void write_director(gchar *msg); +void start_director_reader(gpointer data); +void stop_director_reader(gpointer data); + + +/* Forward referenced subroutines */ +void FillDirectory(char *path, Window *window); +Window *new_window(); +static void click_column_cb(GtkCList *item, gint column, Window *restore); +static void select_row_cb(GtkCList *item, gint row, gint column, + GdkEventButton *event, Window *restore); +void row_data_destroy_cb(gpointer data); +void split_path_and_filename(const char *fname, POOLMEM **path, int *pnl, + POOLMEM **file, int *fnl); + +#ifdef needed +static GdkPixmap *check_pixmap = NULL; +static GdkPixmap *check_trans = NULL; +static GdkPixmap *blank_pixmap = NULL; +static GdkPixmap *blank_trans = NULL; +#endif + +static GtkWidget *restore_dir; /* current directory edit box */ +static GtkWidget *scrolled; /* select files scrolled window */ +static Window *restore; + +const int NUM_COLUMNS = 7; +const int CHECK_COLUMN = 0; +const int FILE_COLUMN = 1; +const int MODES_COLUMN = 2; +const int DATE_COLUMN = 6; + + +/* + * Read Director output and discard it until next prompt + */ +static void discard_to_prompt() +{ + while (bnet_recv(UA_sock) > 0) { + } +} + +/* + * Move up one directory + */ +void +on_restore_up_button_clicked(GtkButton *button, gpointer user_data) +{ + split_path_and_filename(restore->fname, &restore->path, &restore->pnl, + &restore->file, &restore->fnl); + FillDirectory(restore->path, restore); +} + +void +on_restore_add_button_clicked(GtkButton *button, gpointer user_data) +{ + +} + + +void +on_restore_remove_button_clicked(GtkButton *button, gpointer user_data) +{ + +} + +/* + * Called once at the beginning of the program for setup + */ +void select_restore_setup() +{ + gchar *title[NUM_COLUMNS] = {"Mark", "File", "Mode", "User", "Group", "Size", "Date"}; + + restore_file_selection = create_restore_file_selection(); + if (!restore_file_selection) { + Dmsg0(000, "Restore_files not setup.\n"); + } + restore_dir = lookup_widget(restore_file_selection, "restore_dir"); + scrolled = lookup_widget(restore_file_selection, "scrolled"); + if (!scrolled) { + Dmsg0(000, "Scrolled not setup.\n"); + } + + restore = new_window(); + +#ifdef needed + check_pixmap = gdk_pixmap_colormap_create_from_xpm(NULL, + gdk_colormap_get_system(), &check_trans, NULL, + "check.xpm"); + blank_pixmap = gdk_pixmap_colormap_create_from_xpm(NULL, + gdk_colormap_get_system(), &blank_trans, NULL, + "blank.xpm"); +#endif + + restore->list = (GtkCList *)gtk_clist_new_with_titles(NUM_COLUMNS, title); + gtk_clist_set_selection_mode(restore->list, GTK_SELECTION_EXTENDED); + gtk_clist_set_sort_column(restore->list, FILE_COLUMN); + gtk_clist_set_auto_sort(restore->list, true); + gtk_signal_connect(GTK_OBJECT(restore->list), "click_column", + G_CALLBACK(click_column_cb), restore); + gtk_signal_connect(GTK_OBJECT(restore->list), "select_row", + G_CALLBACK(select_row_cb), restore); + + gtk_container_add(GTK_CONTAINER(scrolled), GTK_WIDGET(restore->list)); + restore->buf = get_pool_memory(PM_FNAME); + restore->fname = get_pool_memory(PM_FNAME); + restore->path = get_pool_memory(PM_NAME); + restore->file = get_pool_memory(PM_NAME); +} + +/* + * Select files dialog called + */ +void select_restore_files() +{ + discard_to_prompt(); + set_restore_dialog_defaults(); + gtk_widget_show(GTK_WIDGET(restore->list)); + FillDirectory("/", restore); + gtk_main(); +} + + +/* + * Fill the CList box with files at path + */ +void FillDirectory(char *path, Window *restore) +{ + char pathbuf[MAXSTRING]; + char modes[20], user[20], group[20], size[20], date[30]; + char file[1000]; + char marked[10]; + gchar *text[NUM_COLUMNS] = {marked, file, modes, user, group, size, date}; + GtkCList *list = restore->list; + int row = 0; + + stop_director_reader(NULL); + pm_strcpy(&restore->fname, path); + gtk_entry_set_text(GTK_ENTRY(restore_dir), restore->fname); + gtk_clist_freeze(list); + gtk_clist_clear(list); + + bsnprintf(pathbuf, sizeof(pathbuf), "cd %s", path); + Dmsg1(100, "%s\n", pathbuf); + write_director(pathbuf); + discard_to_prompt(); + + write_director("dir"); + while (bnet_recv(UA_sock) > 0) { + char *p = UA_sock->msg; + char *l; + strip_trailing_junk(UA_sock->msg); + if (*p == '$') { + break; + } + Dmsg1(200, "Got: %s\n", p); + if (!*p) { + continue; + } + l = p; + skip_nonspaces(&p); /* permissions */ + *p++ = 0; + bstrncpy(modes, l, sizeof(modes)); + skip_spaces(&p); + skip_nonspaces(&p); /* link count */ + *p++ = 0; + skip_spaces(&p); + l = p; + skip_nonspaces(&p); /* user */ + *p++ = 0; + skip_spaces(&p); + bstrncpy(user, l, sizeof(user)); + l = p; + skip_nonspaces(&p); /* group */ + *p++ = 0; + bstrncpy(group, l, sizeof(group)); + skip_spaces(&p); + l = p; + skip_nonspaces(&p); /* size */ + *p++ = 0; + bstrncpy(size, l, sizeof(size)); + skip_spaces(&p); + l = p; + skip_nonspaces(&p); /* date/time */ + skip_spaces(&p); + skip_nonspaces(&p); + *p++ = 0; + bstrncpy(date, l, sizeof(date)); + skip_spaces(&p); + if (*p == '*') { + bstrncpy(marked, "x", sizeof(marked)); + p++; + } else { + bstrncpy(marked, " ", sizeof(marked)); + } + split_path_and_filename(p, &restore->path, &restore->pnl, + &restore->file, &restore->fnl); + +// Dmsg1(000, "restore->fname=%s\n", restore->fname); + bstrncpy(file, restore->file, sizeof(file)); +// printf("modes=%s user=%s group=%s size=%s date=%s file=%s\n", +// modes, user, group, size, date, file); + + gtk_clist_append(list, text); + +#ifdef xxx + if (marked) { + gtk_clist_set_pixmap(list, row, CHECK_COLUMN, check_pixmap, check_trans); + } else { + gtk_clist_set_pixmap(list, row, CHECK_COLUMN, blank_pixmap, blank_trans); + } +#endif + row++; + } + + /* Fix up length of file column */ + gtk_clist_set_column_width(list, FILE_COLUMN, gtk_clist_optimal_column_width(list, FILE_COLUMN)); + gtk_clist_set_column_width(list, MODES_COLUMN, gtk_clist_optimal_column_width(list, MODES_COLUMN)); + gtk_clist_thaw(list); + start_director_reader(NULL); +} + +Window *new_window() +{ + Window *window = (Window *)malloc(sizeof(Window)); + memset(window, 0, sizeof(window)); + return window; +} + +#ifdef xxx +static void window_delete_cb(GtkWidget *item, GdkEvent *event, Window *restore) +{ + gtk_widget_destroy(restore->window); + gtk_main_quit(); + free_pool_memory(restore->buf); + free_pool_memory(restore->fname); + free_pool_memory(restore->path); + free_pool_memory(restore->file); + free(restore); +} +#endif + +/* + * User clicked a column title + */ +static void click_column_cb(GtkCList *item, gint column, Window *restore) +{ +} + +/* + * User selected a row + */ +static void select_row_cb(GtkCList *item, gint row, gint column, + GdkEventButton *event, Window *restore) +{ +#ifdef xxx + GdkPixmap *pixmap, *trans; +#endif + char *file, *marked = NULL; + int len; + char new_mark[10]; + /* Column non-negative => double click */ + if (column >= 0) { + gtk_clist_unselect_row(item, row, column); + gtk_clist_get_text(item, row, FILE_COLUMN, &file); + /* Double click on column 0 means to mark or unmark */ + if (column == 0) { +#ifdef xxx + utf8_mark = g_locale_to_utf8(new_mark, -1, NULL, NULL, NULL); + gtk_clist_get_pixmap(restore->list, row, CHECK_COLUMN, &pixmap, &trans); + if (pixmap == blank_pixmap) { + bstrncpy(new_mark, "x", sizeof(new_mark)); +// gtk_clist_set_pixmap(item, row, CHECK_COLUMN, check_pixmap, check_trans); +#endif + gtk_clist_get_text(restore->list, row, CHECK_COLUMN, &marked); + Dmsg1(200, "Marked=%s\n", marked); + if (!marked || strcmp(marked, "x") != 0) { + len = Mmsg(&restore->buf, "mark %s", file); + bstrncpy(new_mark, "x", sizeof(new_mark)); + } else { + len = Mmsg(&restore->buf, "unmark %s", file); + bstrncpy(new_mark, " ", sizeof(new_mark)); + } + gtk_clist_set_text(restore->list, row, CHECK_COLUMN, new_mark); + /* strip trailing slash from directory name */ + while (len > 1 && restore->buf[len-1] == '/') { + restore->buf[len-1] = 0; + } + write_director(restore->buf); + discard_to_prompt(); + } else { + /* Double clicking on directory means to move to it */ + int len; + len = strlen(file); + if (len > 0 && file[len-1] == '/') { + /* Change to new directory */ + pm_strcpy(&restore->path, restore->fname); + if (*file == '*') { + Mmsg(&restore->fname, "%s%s", restore->path, file+1); + } else { + Mmsg(&restore->fname, "%s%s", restore->path, file); + } + FillDirectory(restore->fname, restore); + } + } + } +} + +/* + * CList row is being destroyed get rid of our data + */ +void row_data_destroy_cb(gpointer data) +{ + if (data) { + free(data); + } +} diff --git a/bacula/src/gnome2-console/restore.h b/bacula/src/gnome2-console/restore.h new file mode 100644 index 0000000000..5356885286 --- /dev/null +++ b/bacula/src/gnome2-console/restore.h @@ -0,0 +1,10 @@ + +typedef struct { + GtkCList *list; + POOLMEM *buf; /* scratch buffer */ + POOLMEM *fname; /* full path and file name */ + POOLMEM *path; /* path, no file */ + POOLMEM *file; /* file, no path */ + int fnl; /* file length */ + int pnl; /* path length */ +} Window; diff --git a/bacula/src/lib/protos.h b/bacula/src/lib/protos.h index fa2d82b6a4..5d79868fc3 100644 --- a/bacula/src/lib/protos.h +++ b/bacula/src/lib/protos.h @@ -180,9 +180,11 @@ void strip_trailing_slashes (char *dir); bool skip_spaces (char **msg); bool skip_nonspaces (char **msg); int fstrsch (char *a, char *b); +char *next_arg(char **s); int parse_args(POOLMEM *cmd, POOLMEM **args, int *argc, char **argk, char **argv, int max_args); -char *next_arg(char **s); +void split_path_and_filename(const char *fname, POOLMEM **path, + int *pnl, POOLMEM **file, int *fnl); /* util.c */ int is_buf_zero (char *buf, int len); diff --git a/bacula/src/lib/scan.c b/bacula/src/lib/scan.c index 34c31d2d2b..ac1447a721 100644 --- a/bacula/src/lib/scan.c +++ b/bacula/src/lib/scan.c @@ -1,7 +1,7 @@ /* * scan.c -- scanning routines for Bacula * - * Kern Sibbald, MM separated from util.c MMIII + * Kern Sibbald, MM separated from util.c MMIII * * Version $Id$ */ @@ -55,9 +55,9 @@ void strip_trailing_slashes(char *dir) /* * Skip spaces - * Returns: 0 on failure (EOF) - * 1 on success - * new address in passed parameter + * Returns: 0 on failure (EOF) + * 1 on success + * new address in passed parameter */ bool skip_spaces(char **msg) { @@ -74,9 +74,9 @@ bool skip_spaces(char **msg) /* * Skip nonspaces - * Returns: 0 on failure (EOF) - * 1 on success - * new address in passed parameter + * Returns: 0 on failure (EOF) + * 1 on success + * new address in passed parameter */ bool skip_nonspaces(char **msg) { @@ -101,19 +101,19 @@ fstrsch(char *a, char *b) /* folded case search */ s1=a; s2=b; - while (*s1) { /* do it the fast way */ + while (*s1) { /* do it the fast way */ if ((*s1++ | 0x20) != (*s2++ | 0x20)) - return 0; /* failed */ + return 0; /* failed */ } - while (*a) { /* do it over the correct slow way */ + while (*a) { /* do it over the correct slow way */ if (B_ISUPPER(c1 = *a)) { - c1 = tolower((int)c1); + c1 = tolower((int)c1); } if (B_ISUPPER(c2 = *b)) { - c2 = tolower((int)c2); + c2 = tolower((int)c2); } if (c1 != c2) { - return 0; + return 0; } a++; b++; @@ -134,31 +134,31 @@ char *next_arg(char **s) /* skip past spaces to next arg */ for (p=*s; *p && B_ISSPACE(*p); ) { p++; - } + } Dmsg1(400, "Next arg=%s\n", p); for (n = q = p; *p ; ) { if (*p == '\\') { - p++; - if (*p) { - *q++ = *p++; - } else { - *q++ = *p; - } - continue; + p++; + if (*p) { + *q++ = *p++; + } else { + *q++ = *p; + } + continue; } if (*p == '"') { /* start or end of quote */ - if (in_quote) { - p++; /* skip quote */ - in_quote = false; - continue; - } - in_quote = true; - p++; - continue; + if (in_quote) { + p++; /* skip quote */ + in_quote = false; + continue; + } + in_quote = true; + p++; + continue; } if (!in_quote && B_ISSPACE(*p)) { /* end of field */ - p++; - break; + p++; + break; } *q++ = *p++; } @@ -189,7 +189,7 @@ char *next_arg(char **s) */ int parse_args(POOLMEM *cmd, POOLMEM **args, int *argc, - char **argk, char **argv, int max_args) + char **argk, char **argv, int max_args) { char *p, *q, *n; @@ -201,33 +201,33 @@ int parse_args(POOLMEM *cmd, POOLMEM **args, int *argc, while (*argc < max_args) { n = next_arg(&p); if (*n) { - argk[*argc] = n; - argv[(*argc)++] = NULL; + argk[*argc] = n; + argv[(*argc)++] = NULL; } else { - break; + break; } } /* Separate keyword and value */ for (int i=0; i < *argc; i++) { p = strchr(argk[i], '='); if (p) { - *p++ = 0; /* terminate keyword and point to value */ - /* Unquote quoted values */ + *p++ = 0; /* terminate keyword and point to value */ + /* Unquote quoted values */ if (*p == '"') { for (n = q = ++p; *p && *p != '"'; ) { if (*p == '\\') { - p++; - } - *q++ = *p++; - } - *q = 0; /* terminate string */ - p = n; /* point to string */ - } - if (strlen(p) > MAX_NAME_LENGTH-1) { - p[MAX_NAME_LENGTH-1] = 0; /* truncate to max len */ - } + p++; + } + *q++ = *p++; + } + *q = 0; /* terminate string */ + p = n; /* point to string */ + } + if (strlen(p) > MAX_NAME_LENGTH-1) { + p[MAX_NAME_LENGTH-1] = 0; /* truncate to max len */ + } } - argv[i] = p; /* save ptr to value or NULL */ + argv[i] = p; /* save ptr to value or NULL */ } #ifdef xxxx for (int i=0; i < *argc; i++) { @@ -236,3 +236,58 @@ int parse_args(POOLMEM *cmd, POOLMEM **args, int *argc, #endif return 1; } + +/* + * Given a full filename, split it into its path + * and filename parts. They are returned in pool memory + * in the arguments provided. + */ +void split_path_and_filename(const char *fname, POOLMEM **path, int *pnl, + POOLMEM **file, int *fnl) +{ + const char *p, *f; + int slen; + int len = slen = strlen(fname); + + /* + * Find path without the filename. + * I.e. everything after the last / is a "filename". + * OK, maybe it is a directory name, but we treat it like + * a filename. If we don't find a / then the whole name + * must be a path name (e.g. c:). + */ + p = fname; + f = fname + len - 1; + /* "strip" any trailing slashes */ + while (slen > 0 && *f == '/') { + slen--; + f--; + } + /* Walk back to last slash -- begin of filename */ + while (slen > 0 && *f != '/') { + slen--; + f--; + } + if (*f == '/') { /* did we find a slash? */ + f++; /* yes, point to filename */ + } else { /* no, whole thing must be path name */ + f = fname; + } + Dmsg2(200, "after strip len=%d f=%s\n", len, f); + *fnl = fname - f + len; + if (*fnl > 0) { + *file = check_pool_memory_size(*file, *fnl+1); + memcpy(*file, f, *fnl); /* copy filename */ + } + (*file)[*fnl] = 0; + + *pnl = f - fname; + if (*pnl > 0) { + *path = check_pool_memory_size(*path, *pnl+1); + memcpy(*path, fname, *pnl); + } + (*path)[*pnl] = 0; + + Dmsg2(200, "pnl=%d fnl=%d\n", *pnl, *fnl); + Dmsg3(200, "split fname=%s path=%s file=%s\n", fname, *path, *file); +} diff --git a/bacula/src/tools/bsmtp.c b/bacula/src/tools/bsmtp.c index 22d868247d..4df5776f8e 100644 --- a/bacula/src/tools/bsmtp.c +++ b/bacula/src/tools/bsmtp.c @@ -68,7 +68,7 @@ static void get_response(void) Pmsg2(0, "Fatal malformed reply from %s: %s\n", mailhost, buf); exit(1); } - if (buf[4] != '-') { + if (buf[3] != '-') { break; } } diff --git a/bacula/src/version.h b/bacula/src/version.h index 0bdfdbb83d..81a889092d 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -2,8 +2,8 @@ #undef VERSION #define VERSION "1.33.4" #define VSTRING "1" -#define BDATE "13 Mar 2004" -#define LSMDATE "13Mar04" +#define BDATE "18 Mar 2004" +#define LSMDATE "18Mar04" /* Debug flags */ #undef DEBUG