Next Previous Contents

15. Appendix A - cdrecord.sh

This is shell script to do backup on CDROM and is used in the chapter Quick Steps of this document. This script is taken from CD-Writing-HOWTO


#!/bin/sh

# Filename: cdrecord.sh

test `whoami` = 'root' || echo "You must be root to execute the commands."
cdrecord -scanbus > /dev/null
if ! (pidof kerneld || test -f "/proc/sys/kernel/modprobe"); then
        echo "Neither kerneld nor kmod are running to automatically load modules".
fi
report_no_autoload() {
        echo "Ensure the module $1 is loaded automatically next time."
}
if test ! -f "/proc/scsi/scsi"; then
        report_no_autoload scsi_mod  &&  insmod scsi_mod
fi
if ! grep "^........ sg_" /proc/ksyms > /dev/null; then
        report_no_autoload sg  &&  insmod sg
fi
if ! grep "^........ sr_" /proc/ksyms > /dev/null; then
        report_no_autoload sr_mod  &&  insmod sr_mod
fi
if ! grep "^........ loop_" /proc/ksyms > /dev/null; then
        report_no_autoload loop  &&  insmod loop
fi
if ! grep iso9660 /proc/filesystems > /dev/null; then
        report_no_autoload iso9660  &&  insmod iso9660
fi
echo "The following is only needed for IDE/ATAPI CD-writers."
if ! grep ide-scsi /proc/ide/drivers > /dev/null; then
        report_no_autoload ide-scsi  &&  insmod ide-scsi
fi
cdrecord -scanbus


Next Previous Contents