[Rear-users] SF.net SVN: rear:[528] trunk

Schlomo Schapiro schlomo at schapiro.org
Thu Jun 2 12:42:08 CEST 2011


Hi,

nice feature. Does the RUN+= keep udev busy or waiting while rear runs?

Kind Regards,
Schlomo

On 01/06/11 19:23, dag- at users.sourceforge.net wrote:
> Revision: 528
>           http://rear.svn.sourceforge.net/rear/?rev=528&view=rev
> Author:   dag-
> Date:     2011-06-01 17:23:12 +0000 (Wed, 01 Jun 2011)
> 
> Log Message:
> -----------
> Initial implementation of udev workflow
> Improve cfg2html detection (more intuitive)
> 
> Modified Paths:
> --------------
>     trunk/usr/share/rear/conf/default.conf
>     trunk/usr/share/rear/rescue/GNU/Linux/95_cfg2html.sh
> 
> Added Paths:
> -----------
>     trunk/etc/udev/
>     trunk/etc/udev/rules.d/
>     trunk/etc/udev/rules.d/62-rear-usb.rules
>     trunk/usr/share/rear/lib/udev-workflow.sh
> 
> Added: trunk/etc/udev/rules.d/62-rear-usb.rules
> ===================================================================
> --- trunk/etc/udev/rules.d/62-rear-usb.rules	                        (rev 0)
> +++ trunk/etc/udev/rules.d/62-rear-usb.rules	2011-06-01 17:23:12 UTC (rev 528)
> @@ -0,0 +1 @@
> +ACTION=="add", SUBSYSTEM=="block", ENV{ID_FS_LABEL}=="REAR-000", RUN+="/usr/sbin/rear udev"
> 
> Modified: trunk/usr/share/rear/conf/default.conf
> ===================================================================
> --- trunk/usr/share/rear/conf/default.conf	2011-06-01 17:20:31 UTC (rev 527)
> +++ trunk/usr/share/rear/conf/default.conf	2011-06-01 17:23:12 UTC (rev 528)
> @@ -137,6 +137,15 @@
>  # resulting files that should be copied onto the USB stick
>  USB_FILES=()
>  
> +# Number of rescue environments/backups to retain on USB
> +USB_RETAIN_BACKUP_NR=2
> +
> +# Define the default WORKFLOW for the udev handler (default is disabled)
> +UDEV_WORKFLOW=
> +
> +# Beep when udev handler has finished
> +UDEV_BEEP=y
> +
>  ##
>  # PXE stuff
>  ##
> @@ -387,9 +396,6 @@
>  # Tape block size, default is to leave it up to the tape-device
>  TAPE_BLOCKSIZE=
>  
> -# Number of rescue environments/backups to retain on USB
> -USB_RETAIN_BACKUP_NR=2
> -
>  # disable ping
>  # some environments don't allow to ping the backup host, even though the backup
>  # software is reachable
> @@ -500,8 +506,9 @@
>  
>  ################ ---- disable feature
>  #
> -# Disable the use of cfg2html (set to non-empty to disable). cfg2html must be installed independantly from ReaR.
> -SKIP_CFG2HTML=Y
> +# Automatically enable cfg2html, if it is installed on the system
> +# To disable set to 'n', 'No' or '0'
> +USE_CFG2HTML=y
>  
>  # Simplyfy bonding setups by configuring always the first device of a bond 
>  SIMPLIFY_BONDING=
> 
> Added: trunk/usr/share/rear/lib/udev-workflow.sh
> ===================================================================
> --- trunk/usr/share/rear/lib/udev-workflow.sh	                        (rev 0)
> +++ trunk/usr/share/rear/lib/udev-workflow.sh	2011-06-01 17:23:12 UTC (rev 528)
> @@ -0,0 +1,62 @@
> +# udev-workflow.sh
> +#
> +# udev workflow for Relax & Recover
> +#
> +#    Relax & Recover is free software; you can redistribute it and/or modify
> +#    it under the terms of the GNU General Public License as published by
> +#    the Free Software Foundation; either version 2 of the License, or
> +#    (at your option) any later version.
> +
> +#    Relax & Recover is distributed in the hope that it will be useful,
> +#    but WITHOUT ANY WARRANTY; without even the implied warranty of
> +#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +#    GNU General Public License for more details.
> +
> +#    You should have received a copy of the GNU General Public License
> +#    along with Relax & Recover; if not, write to the Free Software
> +#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> +#
> +#
> +
> +WORKFLOW_udev_DESCRIPTION="Udev handler"
> +WORKFLOWS=( ${WORKFLOWS[@]} udev )
> +WORKFLOW_udev () {
> +    # If no udev workflow has been defined, exit cleanly
> +    if [[ -z "$UDEV_WORKFLOW" ]]; then
> +        return
> +    fi
> +
> +    # If OUTPUT is not USB, exit cleanly
> +    if [[ "$OUTPUT" != "USB" ]]; then
> +        Log "The udev handler only makes sense when using OUTPUT=USB"
> +        return
> +    fi
> +
> +    WORKFLOW="$UDEV_WORKFLOW"
> +
> +    # Set USB_DEVICE based on ID_FS_LABEL or UDEV DEVNAME
> +    if [[ "$ID_FS_LABEL" && -b "/dev/disk/by-label/$ID_FS_LABEL" ]]; then
> +        Log "Using USB device based on udev ID_FS_LABEL '$ID_FS_LABEL'"
> +        USB_DEVICE="/dev/disk/by-label/$ID_FS_LABEL"
> +    elif [[ "$DEVNAME" && -b "$DEVNAME" ]]; then
> +        Log "Using USB device based on udev DEVNAME '$DEVNAME'"
> +        USB_DEVICE="$DEVNAME"
> +    else
> +        Log "We cannot determine USB device from udev, using configuration"
> +    fi
> +
> +    # If udev workflow does not exist, bail out loudly
> +    IsInArray "$UDEV_WORKFLOW" "${WORKFLOWS[@]}"
> +    StopIfError "Udev workflow '$UDEV_WORKFLOW' does not exist"
> +
> +    # Run udev workflow
> +    WORKFLOW_$UDEV_WORKFLOW
> +
> +    # Beep distinctively
> +    if [[ "$UDEV_BEEP" =~ ^[yY1] ]]; then
> +        for i in $(seq 1 10); do
> +            echo -e "\007" >/dev/tty0
> +            sleep 0.05
> +        done
> +    fi
> +}
> 
> Modified: trunk/usr/share/rear/rescue/GNU/Linux/95_cfg2html.sh
> ===================================================================
> --- trunk/usr/share/rear/rescue/GNU/Linux/95_cfg2html.sh	2011-06-01 17:20:31 UTC (rev 527)
> +++ trunk/usr/share/rear/rescue/GNU/Linux/95_cfg2html.sh	2011-06-01 17:23:12 UTC (rev 528)
> @@ -1,19 +1,32 @@
> -# we support using cfg2html to collect general system information. For this cfg2html has to
> -# be installed and it can be disable with SKIP_CFG2HTML
> -#
> +# We support using cfg2html to collect general system information.
> +# For this cfg2html has to be installed and it has not been disabled.
>  
> -if test -z "$SKIP_CFG2HTML" && type -p cfg2html >/dev/null ; then
> +# If USE_CFG2HTML is disabled, skip this script
> +if [[ ! "$USE_CFG2HTML" =~ ^[yY1] ]] then
> +    return
> +fi
>  
> -	ProgressStart "Collecting general system information (cfg2html)"
> +# If SKIP_CFG2HTML is enabled, skip this script (backward compatibility)
> +if [[ -z "$USE_CFG2HTML" && -z "$SKIP2CFGHTML" ]]; then
> +    return
> +fi
>  
> -	# cfg2html recommend to keep the result private
> -	mkdir -v -p -m 0750 $VAR_DIR/recovery/cfg2html 1>&8
> -	ProgressStopIfError $? "Could not create '$VAR_DIR/recovery/cfg2html' directory"
> -	# use an installed cfg2html if available:
> -	cfg2html -o $VAR_DIR/recovery/cfg2html -p | ProgressStepSingleChar
> -	
> -	ProgressStop
> -	
> -	# add HTML part of cfg2html to result files
> -	RESULT_FILES=( "${RESULT_FILES[@]}" $(find $VAR_DIR/recovery/cfg2html -type f -name \*.html) )
> +# No cfg2html binary, skip this script
> +if type -p cfg2html &>/dev/null; then
> +    Log "cfg2html has not been found on the system, skipping cfg2html."
> +    return
>  fi
> +
> +ProgressStart "Collecting general system information (cfg2html)"
> +
> +# cfg2html recommend to keep the result private
> +mkdir -v -p -m0750 $VAR_DIR/recovery/cfg2html 1>&8
> +ProgressStopIfError $? "Could not create '$VAR_DIR/recovery/cfg2html' directory"
> +
> +cfg2html -o $VAR_DIR/recovery/cfg2html -p | ProgressStepSingleChar
> +ProgressStopIfError $? "An error occured when running cfg2html"
> +
> +ProgressStop
> +
> +# Add HTML part of cfg2html to result files
> +RESULT_FILES=( "${RESULT_FILES[@]}" $(find $VAR_DIR/recovery/cfg2html -type f -name \*.html) )
> 
> 
> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
> 
> ------------------------------------------------------------------------------
> Simplify data backup and recovery for your virtual environment with vRanger. 
> Installation's a snap, and flexible recovery options mean your data is safe,
> secure and there when you need it. Data protection magic?
> Nope - It's vRanger. Get your free trial download today. 
> http://p.sf.net/sfu/quest-sfdev2dev
> _______________________________________________
> Rear-users mailing list
> Rear-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rear-users




More information about the rear-users mailing list