#!/bin/sh # Copyright (c) 1999 Tim Barbour. All Rights Reserved. # This script may be used and distributed under the terms # of the GNU GPL, as published by the Free Software Foundation. # this is the cdpio CD-image dumping script, used by cdpio to dump out # the image of $target_filesystem onto a writable cdrom and verify it usage() { # -v is for verbose echo "usage: $0 [ -v ]" >&2 } set -e # source rc file (this script is part of the cdpio tool) . /etc/cdpio.rc # source functions (find_fs_image) . `dirname $0`/backup_functions while getopts v c do case $c in v) verbose="-v" shift `expr $OPTIND - 1`;; \?) usage exit 2;; esac done image=`find_fs_image $target_filesystem` make_unmounted $target_filesystem if [ -n "$verbose" ]; then echo "writing $target_filesystem image on $image to cdrom..." fi $cdrecord $verbose $cdrecord_options speed=$write_speed fs=$buffer_space \ dev=$write_device tsize=${target_filesystem_size_blocks}k $image if [ -n "$separate_verify_device" ]; then ask_user_action "move CD to verify device" \ "Please move volume $volume_number to $verify_device, reply to this message when done" fi if [ -n "$verbose" ]; then echo "checking the filesystem on the new cdrom..." fi /sbin/e2fsck -n -f $verify_device if [ -n "$verbose" ]; then echo "verifying against disk..." fi # with some devices, we need the size to avoid running off the end of the device cmp -n ${target_filesystem_size_blocks}kiB $image $verify_device