Debian Codegraph @

copy-cd.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # copy-cd.sh: copying a data CD
3
4 CDROM=/dev/cdromscip-shell filesystem . . `/dev/cdrom`. # CD ROM device
5 OF=/home/bozo/projects/cdimage.isoscip-shell filesystem . . `/home/bozo/projects/cdimage.iso`. # output file
6 # /xxxx/xxxxxxxx/ Change to suit your system.
7 BLOCKSIZE=2048
8 # SPEED=10 # If unspecified, uses max spd.
9 # DEVICE=/dev/cdrom older version.
10 DEVICE="1,0,0"
11
12 echoscip-shell system . . echo.; echoscip-shell system . . echo. "Insert source CD, but do *not* mount it."
13 echoscip-shell system . . echo. "Press ENTER when ready. "
14 read ready # Wait for input, $ready not used.
15
16 echoscip-shell system . . echo.; echoscip-shell system . . echo. "Copying the source CD to $OF."
17 echoscip-shell system . . echo. "This may take a while. Please be patient."
18
19 ddscip-shell system . . dd. if=$CDROM of=$OF bs=$BLOCKSIZE # Raw device copy.
20
21
22 echoscip-shell system . . echo.; echoscip-shell system . . echo. "Remove data CD."
23 echoscip-shell system . . echo. "Insert blank CDR."
24 echoscip-shell system . . echo. "Press ENTER when ready. "
25 read ready # Wait for input, $ready not used.
26
27 echoscip-shell system . . echo. "Copying $OF to CDR."
28
29 # cdrecord -v -isosize speed=$SPEED dev=$DEVICE $OF # Old version.
30 wodim -v -isosize dev=$DEVICE $OF
31 # Uses Joerg Schilling's "cdrecord" package (see its docs).
32 # http://www.fokus.gmd.de/nthp/employees/schilling/cdrecord.html
33 # Newer Linux distros may use "wodim" rather than "cdrecord" ...
34
35
36 echoscip-shell system . . echo.; echoscip-shell system . . echo. "Done copying $OF to CDR on device $CDROM."
37
38 echoscip-shell system . . echo. "Do you want to erase the image file (y/n)? " # Probably a huge file.
39 read answer
40
41 case "$answer" in
42 [yY]) rmscip-shell system . . rm. -f $OF
43 echoscip-shell system . . echo. "$OF erased."
44 ;;
45 *) echoscip-shell system . . echo. "$OF not erased.";;
46 esac
47
48 echoscip-shell system . . echo.
49
50 # Exercise:
51 # Change the above "case" statement to also accept "yes" and "Yes" as input.
52
53 exit 0