/[clonezilla-sysresccd]/trunk/create-clonezilla-sysresccd/continue-multi-cd.sh
ViewVC logotype

Annotation of /trunk/create-clonezilla-sysresccd/continue-multi-cd.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 164 - (hide annotations)
Sat Apr 9 21:34:35 2011 UTC (12 years, 11 months ago) by sng
File MIME type: application/x-sh
File size: 5146 byte(s)
- updating profiles.conf for current original CDs
- updating cfg files for Clonezilla Live
- updating trunk site

1 sng 64 ##############################################################################
2     # #
3 sng 164 # continue-multi-cd, (C) 2007-2011 S. Georgaras <sng@hellug.gr> #
4 sng 64 # #
5     # This file is part of Clonezilla-SysRescCD. #
6     # #
7     # Clonezilla-SysRescCD is free software: you can redistribute it and/or #
8     # modify it under the terms of the GNU General Public License as published #
9     # by the Free Software Foundation, either version 2 of the License, or #
10     # (at your option) any later version. #
11     # #
12     # Clonezilla-SysRescCD is distributed in the hope that it will be useful, #
13     # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14     # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15     # GNU General Public License for more details. #
16     # #
17     # You should have received a copy of the GNU General Public License along #
18     # with Clonezilla-SysRescCD. If not, see <http://www.gnu.org/licenses/>. #
19     # #
20     ##############################################################################
21    
22     function printVersion(){
23 sng 105 echo "$(basename "$0") - v $version - S. Georgaras <sng@hellug.gr>"
24 sng 64 }
25    
26     function usage(){
27     printVersion
28     echo
29     echo "Usage: $(basename "$0") [options] <path to be added to CD>"
30     echo
31     echo "Available options are:
32     d Specify write device (in case auto detection does not work)
33     c Close the CD. No more burning will be possible
34     Default is to leave it open
35     l Don't burn the CD after image creation
36     o <image name> Save the image file as <image name>
37     r Remove the image file after burning
38     f On the fly burning of the CD. No image file will be created
39     v Print version info and exit
40     h Print this screen and exit
41     "
42    
43     }
44    
45     function findCDRECORD(){
46     [ -z $(which cdrecord 2>/dev/null) ] && {
47     echo "Error: cdrecord not found!!!"
48     exit 1
49     }
50     }
51    
52     function findMKISOFS(){
53     [ -z $(which mkisofs 2>/dev/null) ] && {
54     echo "Error: mkisofs not found!!!"
55     exit 1
56     }
57     }
58    
59     function longHelp(){
60     echo longHelp
61     }
62    
63    
64     # while [ ! -z "$1" ];do
65     # case "$1" in
66     # --long-help) longHelp
67     # shift
68     # exit;;
69     # esac
70     # done
71    
72     BURN_CD=1
73     REMOVE_IMAGE=0
74     SAVE_MULTI='-multi'
75    
76     while getopts fcrd:lo:hv name
77     do
78     case "$name" in
79     f) output_mode=cdwriter;;
80     d) dev="$OPTARG";;
81     r) REMOVE_IMAGE=1;;
82     c) SAVE_MULTI='';;
83     l) BURN_CD=0;;
84     o) img="$OPTARG"
85     ;;
86     h) usage
87     exit;;
88     v) printVersion
89     exit;;
90     *) exit;;
91     esac
92     done
93     shift $(($OPTIND - 1))
94    
95    
96    
97     [ -z "$1" ] && {
98     usage
99     echo "Error: <path to be added to CD> not specified!!!"
100     exit 1
101     }
102     [ ! -d "$1" ]&& {
103     usage
104     echo "Error: <path to be added to CD> is not a directory!!!"
105     exit 1
106     }
107    
108     pathToAdd="$1"
109    
110     [ -d "$img" ] && {
111     usage
112     echo "Error: <image name> is a directory!!!"
113     exit 1
114     }
115     [ -e "$img" ] && {
116     usage
117     echo "Error: <image name> already exists!!!"
118     exit 1
119     }
120    
121     [ ! -w $(dirname "$img") ] && {
122     usage
123     echo "Error: No write permission for <image name>!!!"
124     exit 1
125     }
126    
127     [ -z $(echo "$img" | grep "$pathToAdd") ] || {
128     usage
129     echo "Error: <image name> cannot be under <path to be added to CD>!!!"
130     exit 1
131     }
132    
133     findMKISOFS
134     if [ $BURN_CD -eq 1 ];then findCDRECORD;fi
135    
136    
137     if [ -z "$dev" ];then
138     theCD=$(what-cd -wb 2>/dev/null)
139     # theCD=/dev/hda
140     else
141     theCD="$dev"
142     fi
143    
144    
145     [ -z "$theCD" ] && {
146     echo " Error: Cannot determine your CD writer!!!"
147     exit 1
148     }
149    
150    
151     [ -z "$(mount |grep "$theCD")" ] || {
152     umount "$theCD" || {
153     echo
154     echo
155     echo " Error: Your CD writer cannot be unmounted!!!"
156     exit 1
157     }
158     }
159    
160     cont=$(cdrecord -msinfo dev="$theCD" 2>/dev/null)
161     [ -z "$cont" ] && {
162     echo " Error: The media in $theCD is not a CD/RW!!!"
163     exit 1
164     }
165    
166     [ -z "$img" ] && img="/tmp/multi-session-cd-$$.iso"
167    
168     mkisofs -r -J -l -f -M "$theCD" -C "$cont" "$pathToAdd" | \
169     {
170     case "$output_mode" in
171     "cdwriter")
172     cdrecord -v "$SAVE_MULTI" driveropts=burnfree -data -eject dev="$theCD" -
173     exit
174     ;;
175     *)
176     # use /dev/stdout as the bridge
177     cat - > "$img" && {
178     # set -x
179     if [ "$BURN_CD" -eq 1 ];then
180     cdrecord -v "$SAVE_MULTI" driveropts=burnfree -data -eject dev="$theCD" "$img" && {
181     if [ "$REMOVE_IMAGE" -eq 0 ];then
182     echo
183     echo
184     echo " The image file has been saved as: $img"
185     else
186     rm -r "$img"
187     fi
188     }
189     else
190     echo
191     echo
192     echo " The image file has been saved as: $img"
193     fi
194     } || {
195     printVersion
196     echo
197     echo " Error: Image file creation failed!!!"
198     exit 1
199     }
200     ;;
201     esac
202     }
203    
204    
205    
206    
207    
208    
209    
210    
211    
212    
213    
214    
215    
216    
217     # echo "Data to continue: $cont"
218     # echo "img=$img"

Properties

Name Value
svn:executable *

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26