-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathburniso
More file actions
executable file
·91 lines (76 loc) · 2.1 KB
/
Copy pathburniso
File metadata and controls
executable file
·91 lines (76 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
# Burn ISO images from the command line.
# see "man burniso"
# Copyright (C) 2009, Michael Deelwater <michael.deelwater@googlemail.com>
# Copyright (C) 2010, Joaquim Boura <x-un-i@sapo.pt>
# Copyright (C) 2011-2015, Stefan Lippers-Hollmann <s.l-h@gmx.de>
# This program 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; version 2 of the
# License.
#
# This program 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.
# xorriso parameters
SPEED="8"
FS="14M"
OPTIONS="-dao -eject -v"
set -e
shopt -s nullglob
shopt -s nocaseglob
# Print out an error message and exit.
error () {
echo >&2 "Error: ${*}"
exit 1
}
# Look for writeable devices.
devices=$(awk '
/^drive name/ {
sub(/^.*:[[:space:]]*/, "")
num_dev = split($0, devices)
}
/(write CD)|(write DVD)/ {
sub(/^.*:[[:space:]]*/, "")
split($0, entries)
for (i = 1; i <= num_dev; ++i)
if (entries[i] == 1)
printf("/dev/%s\n", devices[i])
}' /proc/sys/dev/cdrom/info | uniq)
case $(echo ${devices} | wc -w) in
0) error "No suitable device found!"
;;
1) device=$devices
;;
*) select device in $devices; do
break
done
;;
esac
# Check write permission for device.
if [ ! -w "${device}" ]; then
error "No write permission for ${device}!".
fi
printf "Using device %s.\n" "${device}"
if [ -z "$(echo *.iso)" ]; then
error "No ISO images in current directory!"
fi
printf "Choose an ISO to burn: \n"
select iso in *.iso; do
break
done
# Check if ISO exists.
if ! [ -f "${iso}" ]; then
error "No ISO in currect directory!"
fi
printf "File %s chosen.\n" "${iso}"
# Look for MD5 checksum and validate if available.
if [ -f "${iso}.md5" ]; then
echo "MD5 checksum found. Verifying ISO..."
if ! md5sum -c "${iso}.md5"; then
error "Invalid MD5 checksum!"
fi
fi
# burn baby, burn
exec xorriso -as cdrecord ${OPTIONS} "dev=${device}" "fs=${FS}" "speed=${SPEED}" "${iso}"