From: Kern Sibbald Date: Tue, 29 Aug 2006 16:55:37 +0000 (+0000) Subject: Integrate mkcdrec with Bacula X-Git-Tag: Release-2.0.0~532 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ef9ffa9396d1b6e427177be493c0ff2c04e5d0b8;p=bacula%2Frescue Integrate mkcdrec with Bacula --- diff --git a/rescue/.cvsignore b/rescue/.cvsignore index b4c6fc2..a0cf0fb 100644 --- a/rescue/.cvsignore +++ b/rescue/.cvsignore @@ -6,3 +6,5 @@ config.out autoconf/config.log kernsconfig diff +mkcdrec +mkCDrec_* diff --git a/rescue/External-depkgs b/rescue/External-depkgs new file mode 100644 index 0000000..6ff8786 --- /dev/null +++ b/rescue/External-depkgs @@ -0,0 +1,22 @@ +# This file provides information about the External dependencies required by +# Bacula. +# +# There are four fields delimited by |. Only the first two fields are +# required. The other two are used when the top level directory of the +# archive is not the same as the file name with any suffixes removed. +# +# Field 1 is the name of the dependency. It is used to define the +# name of the three variables which are assigned the values of fields 2 to 4. +# +# Field 2 is the URL of the archive. It is assigned to the variable +# URL_[field1]. +# +# Field 3 is the top directory of the archive or the name of a directory that +# must be created and the archive extracted into it. It is assigned to the +# variable DIR_[field1]. +# +# Field 4 indicates if the directory specified in field 3 must be created +# first and the archive extracted into it. It is assigned to the variable +# MKD_[field1] +# +MKCDREC|http://switch.dl.sourceforge.net/sourceforge/mkcdrec/mkCDrec_v0.9.4.tar.gz|mkcdrec diff --git a/rescue/Makefile.in b/rescue/Makefile.in index fff0520..5448d36 100755 --- a/rescue/Makefile.in +++ b/rescue/Makefile.in @@ -49,19 +49,23 @@ Makefiles: clean: @$(RMF) *~ 1 2 3 diff - @$(RMF) config.log config.out config.status + @$(RMF) config.log config.out config.status *.log @rm -rf autom4te.cache @rm -rf bacula-rescue-$(VERSION).tar.gz @for subdir in freebsd linux solaris; do \ if [ -f $${subdir}/Makefile ]; then \ - (cd $${subdir}; $(MAKE) clean) \ + (cd $${subdir}; $(MAKE) clean) \ fi; \ done + @if [ -d mkcdrec ]; then \ + (cd mkcdrec; $(MAKE) clean) \ + fi # clean for distribution distclean: clean @$(RMF) -r CVS - + @rm -rf mkcdrec mkCDrec_* + devclean: clean @for subdir in freebsd linux solaris; do \ if [ -f $${subdir}/Makefile ]; then \ diff --git a/rescue/autoconf/configure.in b/rescue/autoconf/configure.in index 8045980..25de322 100644 --- a/rescue/autoconf/configure.in +++ b/rescue/autoconf/configure.in @@ -70,21 +70,37 @@ if test x${exec_prefix} = xNONE ; then exec_prefix=${prefix} fi +# ------------------------------------------ +# What device to use +# ------------------------------------------ +DEV= +AC_ARG_WITH(dev, + [ --with-dev=DEVICE specify device (e.g. /dev/hdc)], + [ + if test "x$withval" != "xno" ; then + DEV=$withval + fi + ] +) + # ------------------------------------------- -# check for cdrecord writer location +# if no --with-dev given check for cdrecord writer location # get scsibus,target,lun # ------------------------------------------- -CDSTL="3,0,0" -if test ! x$CDRECORD = x ; then - CDSTL=`${CDRECORD} -scanbus 2>/dev/null | grep CD-RW | ${AWK} '{print $1}'` - if test x${CDSTL} = x ; then - CDSTL=`${CDRECORD} -scanbus 2>/dev/null | grep CD+RW | ${AWK} '{print $1}'` - fi - if test x${CDSTL} = x ; then - CDSTL="3,0,0" +if test x$DEV = x ; then + CDSTL="3,0,0" + if test ! x$CDRECORD = x ; then + CDSTL=`${CDRECORD} -scanbus 2>/dev/null | grep CD-RW | ${AWK} '{print $1}'` + if test x${CDSTL} = x ; then + CDSTL=`${CDRECORD} -scanbus 2>/dev/null | grep CD+RW | ${AWK} '{print $1}'` + fi + if test x${CDSTL} = x ; then + CDSTL="3,0,0" + fi fi + DEV="ATA:${CDSTL}" fi -AC_SUBST(CDSTL) +AC_SUBST(DEV) dnl# -------------------------------------------------------------------------- dnl# CHECKING COMMAND LINE OPTIONS @@ -164,6 +180,36 @@ AC_ARG_WITH(static-fd, ) AC_SUBST(STATIC_FD) +BACULA_BIN= +# ------------------------------------------ +# Where to get Bacula binaries +# ------------------------------------------ +AC_ARG_WITH(bacula-bin, + [ --with-bacula-bin=PATH specify path to bacula binaries (NOT IMPLEMENTED)], + [ + if test "x$withval" != "xno" ; then + BACULA_BIN=$withval + fi + ] +) +AC_SUBST(BACULA_BIN) + +BACULA_SCRIPTS= +# ------------------------------------------ +# Where to get Bacula scripts +# ------------------------------------------ +AC_ARG_WITH(bacula-scripts, + [ --with-bacula-scripts=PATH specify path to bacula scripts], + [ + if test "x$withval" != "xno" ; then + BACULA_SCRIPTS=$withval + fi + ] +) +AC_SUBST(BACULA_SCRIPTS) + + + if test x${bacula} = x -a x${STATIC_FD} = x ; then AC_MSG_ERROR(You must specify either --with-bacula=PATH or --with-static-fd=PATH) fi @@ -266,6 +312,7 @@ dnl# common parts of the Makefile MCOMMON=./autoconf/Make.common AC_SUBST_FILE(MCOMMON) +./build-depkgs AC_OUTPUT([ \ autoconf/Make.common \ @@ -282,15 +329,18 @@ AC_OUTPUT([ \ [ ] ) + echo " Configuration on `date`: Host: $host -- ${DISTNAME} ${DISTVER} Rescue version: ${VERSION} (${DATE}) + Bacula scripts location: ${BACULA_SCRIPTS} Source code location: ${bacula} Static FD location: ${STATIC_FD} Specific kernel version: ${KERNEL} + CDROM device: ${DEV} " > config.out diff --git a/rescue/build-depkgs b/rescue/build-depkgs new file mode 100755 index 0000000..18a71e5 --- /dev/null +++ b/rescue/build-depkgs @@ -0,0 +1,105 @@ +#!/bin/sh + +usage() +{ + echo "usage: $0 [-h] [-C] [] [] ..." + echo " -h Displays this usage" + echo " -C Clobbers (overwrites) the source code by " + echo " reextracting the archive and reapplying any" + echo " patches." + echo "" + echo " Optional dependency, If none are given then all" + echo " of them will be built." + echo "" + echo "Valid dependencies are:" + grep -v '^#' < External-depkgs | cut -d'|' -f1 | cut -d'_' -f1 | tr A-Z a-z | sort -u | awk '{ print " " $1 }' +} + +CLOBBER_SOURCE= + +while getopts "hHC" opt; do + case ${opt} in + H|h|\?) usage;exit 1;; + C) CLOBBER_SOURCE=true;; + esac +done + +[ ${OPTIND} -gt 1 ] && shift `expr ${OPTIND} - 1` + +cwd=`pwd` +cd `dirname $0` +SCRIPT_DIR=`pwd` +TOP_DIR=`pwd` +DEPPKG_DIR=`pwd` + +export PATH=${BIN_DIR}:${PATH} + +OLD_IFS=${IFS};IFS="|"; +while read package url dir mkd; do + case ${package} in + \#*) ;; + *) eval "URL_${package}=${url};DIR_${package}=${dir};MKD_${package}=${mkd}";; + esac +done < ${SCRIPT_DIR}/External-depkgs +IFS=${OLD_IFS};unset OLD_IFS + +get_source() +{ + URL=$1 + SRC_DIR=$2 + MAKE_DIR=$3 + ARCHIVE=`basename ${URL}` + + case ${ARCHIVE} in + *.tar.gz) ARCHIVER="tar xzf"; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.tar\.gz'`;; + *.tar.bz2) ARCHIVER="tar xjf"; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.tar\.bz2'`;; + *.zip) ARCHIVER="unzip -q"; [ -z "${SRC_DIR}" ] && SRC_DIR=`expr "${ARCHIVE}" : '\(.*\)\.zip'`;; + *) echo Unsupported archive type - $ARCHIVE; exit 1;; + esac + + if [ ! -e "${ARCHIVE}" ] + then + echo Downloading "${URL}" + if wget --passive-ftp "${URL}" + then + : + else + echo Unable to download ${ARCHIVE} + exit 1 + fi + fi + + if [ ! -e "${SRC_DIR}" -o "${CLOBBER_SOURCE}" = "true" ] + then + rm -rf ${SRC_DIR} + [ "${MAKE_DIR}" = "true" ] && mkdir ${SRC_DIR} && cd ${SRC_DIR} + echo Extracting ${ARCHIVE} + ${ARCHIVER} ${ARCHIVE} &> ${ARCHIVE}.log + cd ${SRC_DIR} + return 0 + fi + + cd ${SRC_DIR} + return 1 +} + + +process_mkcdrec() +{ + if get_source "${URL_MKCDREC}" "${DIR_MKCDREC}" "${MKD_MKCDREC}" + then + echo "Have mkcdrec source" + fi +} + + +if [ "$#" -eq 0 ] +then + process_mkcdrec +else + for dependency in "$@" + do + eval "process_${dependency}" + done + +fi diff --git a/rescue/configure b/rescue/configure index 8e2da6b..0fdd8ed 100755 --- a/rescue/configure +++ b/rescue/configure @@ -272,7 +272,7 @@ PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="version.h" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BUILD_DIR TRUEPRG FALSEPRG AWK VERSION DATE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA MV RM CP ECHO AR CDRECORD build build_cpu build_vendor build_os host host_cpu host_vendor host_os HAVE_SUN_OS_TRUE HAVE_SUN_OS_FALSE HAVE_OSF1_OS_TRUE HAVE_OSF1_OS_FALSE HAVE_AIX_OS_TRUE HAVE_AIX_OS_FALSE HAVE_HPUX_OS_TRUE HAVE_HPUX_OS_FALSE HAVE_LINUX_OS_TRUE HAVE_LINUX_OS_FALSE HAVE_FREEBSD_OS_TRUE HAVE_FREEBSD_OS_FALSE HAVE_NETBSD_OS_TRUE HAVE_NETBSD_OS_FALSE HAVE_OPENBSD_OS_TRUE HAVE_OPENBSD_OS_FALSE HAVE_BSDI_OS_TRUE HAVE_BSDI_OS_FALSE HAVE_SGI_OS_TRUE HAVE_SGI_OS_FALSE HAVE_IRIX_OS_TRUE HAVE_IRIX_OS_FALSE HAVE_DARWIN_OS_TRUE HAVE_DARWIN_OS_FALSE CDSTL iso where type KERNEL bacula STATIC_FD hostname DISTNAME DISTVER LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS BUILD_DIR TRUEPRG FALSEPRG AWK VERSION DATE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA MV RM CP ECHO AR CDRECORD build build_cpu build_vendor build_os host host_cpu host_vendor host_os HAVE_SUN_OS_TRUE HAVE_SUN_OS_FALSE HAVE_OSF1_OS_TRUE HAVE_OSF1_OS_FALSE HAVE_AIX_OS_TRUE HAVE_AIX_OS_FALSE HAVE_HPUX_OS_TRUE HAVE_HPUX_OS_FALSE HAVE_LINUX_OS_TRUE HAVE_LINUX_OS_FALSE HAVE_FREEBSD_OS_TRUE HAVE_FREEBSD_OS_FALSE HAVE_NETBSD_OS_TRUE HAVE_NETBSD_OS_FALSE HAVE_OPENBSD_OS_TRUE HAVE_OPENBSD_OS_FALSE HAVE_BSDI_OS_TRUE HAVE_BSDI_OS_FALSE HAVE_SGI_OS_TRUE HAVE_SGI_OS_FALSE HAVE_IRIX_OS_TRUE HAVE_IRIX_OS_FALSE HAVE_DARWIN_OS_TRUE HAVE_DARWIN_OS_FALSE DEV iso where type KERNEL bacula STATIC_FD BACULA_BIN BACULA_SCRIPTS hostname DISTNAME DISTVER LIBOBJS LTLIBOBJS' ac_subst_files='MCOMMON' # Initialize some variables set by options. @@ -787,11 +787,14 @@ if test -n "$ac_init_help"; then Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-dev=DEVICE specify device (e.g. /dev/hdc) --with-iso=PATH specify path to iso (not implemented) --with-cdrom=PATH specify path to cdrom --with-kernel=version specify complete kernel version (e.g. 2.6.14-2) --with-bacula=PATH specify path to Bacula source --with-static-fd=PATH specify path to static FD + --with-bacula-bin=PATH specify path to bacula binaries (NOT IMPLEMENTED) + --with-bacula-scripts=PATH specify path to bacula scripts _ACEOF fi @@ -2247,19 +2250,38 @@ if test x${exec_prefix} = xNONE ; then exec_prefix=${prefix} fi +# ------------------------------------------ +# What device to use +# ------------------------------------------ +DEV= + +# Check whether --with-dev or --without-dev was given. +if test "${with_dev+set}" = set; then + withval="$with_dev" + + if test "x$withval" != "xno" ; then + DEV=$withval + fi + + +fi; + # ------------------------------------------- -# check for cdrecord writer location +# if no --with-dev given check for cdrecord writer location # get scsibus,target,lun # ------------------------------------------- -CDSTL="3,0,0" -if test ! x$CDRECORD = x ; then - CDSTL=`${CDRECORD} -scanbus 2>/dev/null | grep CD-RW | ${AWK} '{print $1}'` - if test x${CDSTL} = x ; then - CDSTL=`${CDRECORD} -scanbus 2>/dev/null | grep CD+RW | ${AWK} '{print $1}'` - fi - if test x${CDSTL} = x ; then - CDSTL="3,0,0" +if test x$DEV = x ; then + CDSTL="3,0,0" + if test ! x$CDRECORD = x ; then + CDSTL=`${CDRECORD} -scanbus 2>/dev/null | grep CD-RW | ${AWK} '{print $1}'` + if test x${CDSTL} = x ; then + CDSTL=`${CDRECORD} -scanbus 2>/dev/null | grep CD+RW | ${AWK} '{print $1}'` + fi + if test x${CDSTL} = x ; then + CDSTL="3,0,0" + fi fi + DEV="ATA:${CDSTL}" fi @@ -2353,6 +2375,42 @@ if test "${with_static_fd+set}" = set; then fi; +BACULA_BIN= +# ------------------------------------------ +# Where to get Bacula binaries +# ------------------------------------------ + +# Check whether --with-bacula-bin or --without-bacula-bin was given. +if test "${with_bacula_bin+set}" = set; then + withval="$with_bacula_bin" + + if test "x$withval" != "xno" ; then + BACULA_BIN=$withval + fi + + +fi; + + +BACULA_SCRIPTS= +# ------------------------------------------ +# Where to get Bacula scripts +# ------------------------------------------ + +# Check whether --with-bacula-scripts or --without-bacula-scripts was given. +if test "${with_bacula_scripts+set}" = set; then + withval="$with_bacula_scripts" + + if test "x$withval" != "xno" ; then + BACULA_SCRIPTS=$withval + fi + + +fi; + + + + if test x${bacula} = x -a x${STATIC_FD} = x ; then { { echo "$as_me:$LINENO: error: You must specify either --with-bacula=PATH or --with-static-fd=PATH" >&5 echo "$as_me: error: You must specify either --with-bacula=PATH or --with-static-fd=PATH" >&2;} @@ -2456,6 +2514,7 @@ esac MCOMMON=./autoconf/Make.common +./build-depkgs ac_config_files="$ac_config_files autoconf/Make.common Makefile linux/Makefile linux/cdrom/Makefile linux/cdrom/bacula/Makefile linux/cdrom/cdtree/boot/isolinux/boot.msg knoppix/cdrom/Makefile knoppix/cdrom/bacula/Makefile freebsd/Makefile solaris/Makefile $PFILES" ac_config_commands="$ac_config_commands default" @@ -3156,13 +3215,15 @@ s,@HAVE_IRIX_OS_TRUE@,$HAVE_IRIX_OS_TRUE,;t t s,@HAVE_IRIX_OS_FALSE@,$HAVE_IRIX_OS_FALSE,;t t s,@HAVE_DARWIN_OS_TRUE@,$HAVE_DARWIN_OS_TRUE,;t t s,@HAVE_DARWIN_OS_FALSE@,$HAVE_DARWIN_OS_FALSE,;t t -s,@CDSTL@,$CDSTL,;t t +s,@DEV@,$DEV,;t t s,@iso@,$iso,;t t s,@where@,$where,;t t s,@type@,$type,;t t s,@KERNEL@,$KERNEL,;t t s,@bacula@,$bacula,;t t s,@STATIC_FD@,$STATIC_FD,;t t +s,@BACULA_BIN@,$BACULA_BIN,;t t +s,@BACULA_SCRIPTS@,$BACULA_SCRIPTS,;t t s,@hostname@,$hostname,;t t s,@DISTNAME@,$DISTNAME,;t t s,@DISTVER@,$DISTVER,;t t @@ -3559,14 +3620,17 @@ fi + echo " Configuration on `date`: Host: $host -- ${DISTNAME} ${DISTVER} Rescue version: ${VERSION} (${DATE}) + Bacula scripts location: ${BACULA_SCRIPTS} Source code location: ${bacula} Static FD location: ${STATIC_FD} Specific kernel version: ${KERNEL} + CDROM device: ${DEV} " > config.out diff --git a/rescue/diffmkcdrec b/rescue/diffmkcdrec new file mode 100755 index 0000000..c0973fd --- /dev/null +++ b/rescue/diffmkcdrec @@ -0,0 +1,2 @@ +#!/bin/sh +diff -ur mkcdrec ../mkcdrec >diff diff --git a/rescue/linux/cdrom/Makefile.in b/rescue/linux/cdrom/Makefile.in index d9608aa..721d9c9 100644 --- a/rescue/linux/cdrom/Makefile.in +++ b/rescue/linux/cdrom/Makefile.in @@ -5,6 +5,8 @@ .PATH: . +MKCDREC=@BUILD_DIR@/mkcdrec +CWD=@BUILD_DIR@/linux/cdrom first_rule: all dummy: @@ -52,19 +54,52 @@ bacula: dummy copy-bacula: cp -a bacula/ cdimage/ +pre-mkcdrec: + @echo "Patching mkcdrec Config.sh for Bacula" + @mkdir -p tmp + @rm -f tmp/1 tmp/2 tmp/1 + @cp ${MKCDREC}/Config.sh tmp/2 + @echo "s%^BACULA_DIR.*$$%BACULA_DIR=${CWD}/bacula%g" >tmp/1 + @sed -f tmp/1 tmp/2 >tmp/3 + @echo "s%^BACULA_RESTORE.*$$%BACULA_RESTORE=\"y\"%g" >tmp/1 + @sed -f tmp/1 tmp/3 >tmp/4 + @echo "s%^DVD_Drive.*$$%DVD_Drive=0%g" >tmp/1 + @sed -f tmp/1 tmp/4 >tmp/5 + @echo "s%^USECOLOR.*$$%USECOLOR=n%g" >tmp/1 + @sed -f tmp/1 tmp/5 >${MKCDREC}/Config.sh + @rm -rf tmp + @cp -f @BACULA_BIN@/bacula-fd bacula/bin + @cp -f @BACULA_SCRIPTS@/bacula-fd.conf bacula/bin + +main-mkcdrec: dummy + @echo "Doing make in mkcdrec directory" + (cd ${MKCDREC}; make rescue) + +post-mkcdrec: + @echo "Cleaning up" + cp /tmp/CDrec.iso bootcd.iso + chmod 644 bootcd.iso + rm -f /tmp/CDrec.iso + + +# This will build the old Bacula rescue all: kernel binaries bacula initrd iso +mkcdrec: bacula pre-mkcdrec main-mkcdrec post-mkcdrec + copy-static-fd: kernel binaries static-bacula initrd iso # This needs to be customized for your burner. +# Use either dev=ATA:x,y,z (as reported by cdrecord -scanbus) +# or dev=/dev/ (e.g. hdc) burn: - cdrecord dev=ATA:@CDSTL@ gracetime=2 fs=4096k driveropts=burnfree -v \ + cdrecord dev=@DEV@ gracetime=2 fs=4096k driveropts=burnfree -v \ -useinfo speed=48 -dao -eject -pad -data "bootcd.iso" # Blank the CDROM assuming it is +rw blank: - cdrecord dev=ATA:@CDSTL@ gracetime=2 -v blank=fast -useinfo speed=48 + cdrecord dev=@DEV@ gracetime=2 -v blank=fast -useinfo speed=48 scan: cdrecord -scanbus @@ -100,3 +135,5 @@ clean: @rm -f cdtree/boot/isolinux/vmlinuz @rm -f cdtree/boot/isolinux/map @(cd bacula; make distclean) + @(cd ${MKCDREC}; make clean) + @(cd ${MKCDREC}/busybox; make distclean) diff --git a/rescue/version.h b/rescue/version.h index 72f2ab6..29ea4d6 100644 --- a/rescue/version.h +++ b/rescue/version.h @@ -1,5 +1,5 @@ /* */ #undef VERSION -#define VERSION "1.8.6" -#define BDATE "01 July 2006" -#define LSMDATE "01Jul06" +#define VERSION "2.0.0" +#define BDATE "29 August 2006" +#define LSMDATE "29Aug06"