/[clonezilla-sysresccd]/trunk/create-clonezilla-sysresccd/files/ocs-iso
ViewVC logotype

Annotation of /trunk/create-clonezilla-sysresccd/files/ocs-iso

Parent Directory Parent Directory | Revision Log Revision Log


Revision 93 - (hide annotations)
Fri Aug 13 08:30:37 2010 UTC (13 years, 7 months ago) by sng
File size: 39133 byte(s)
updating stuff for latest Clonezilla release

1 sng 47 #!/bin/bash
2     # Author: Steven Shiau <steven _at_ nchc org tw>
3     # License: GPL
4     # Description: This program will put Debian Live minimal + DRBL/Clonezilla program into a bootable iso file.
5    
6     #
7     DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/opt/drbl/}"
8    
9     . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
10     . $DRBL_SCRIPT_PATH/conf/drbl-ocs.conf
11     . $DRBL_SCRIPT_PATH/sbin/ocs-functions
12    
13     # other default settings
14     # If insert_mode=prog_only, only copy DRBL/Clonezilla programs only, no ocs images.
15     insert_mode="prog_and_img"
16     img_size_sum=0
17     # Default to output the result to iso file, another vaule is cdwriter.
18     output_mode="file"
19     # If there is any file larger then 2GB, we need to turn on -allow-limited-size option for genisoimage. Actually it can be 4GB. Anyway, here we use 2GB. (man genisoimage for more details)
20     iso9660_file_size_limit="2000M" # For command "find" to find the file size (unit: Bytes)
21    
22     # Excluding list for mkisofs
23     # We will create it like this:
24     # -x $DEBIAN_ISO_TMP/isolinux -x $DEBIAN_ISO_TMP/md5sum.txt -x $DEBIAN_ISO_TMP/casper/memtest
25     # "home" should also be excluded since if it exists, it will conflict with the real home later we will merge. Ref: https://sourceforge.net/forum/message.php?msg_id=7599463 Thanks to Andrew Bloxom for this idea.
26 sng 59 mkiso_exclude_list_1="isolinux syslinux md5sum.txt doc live etc pkg ocs-live.d utils"
27 sng 47 mkiso_exclude_list_2="home" # This should not be a duplicated count.
28     mkiso_exclude_list="$mkiso_exclude_list_1 $mkiso_exclude_list_2"
29    
30     #
31     prog="$(basename $0)"
32     prog_option="$*"
33    
34     # functions
35     USAGE() {
36     echo "Usage:"
37     echo "To put clonezilla image into live CD:"
38     echo "$prog [OPTION] CLONEZILLA_IMAGE_NAME"
39     echo "OPTION:"
40     language_help_prompt_by_idx_no
41     echo "-a, --file-name-prefix NAME Assign the output file name as NAME.iso. $0 will auto append '.iso' in the end of filename."
42     echo "-b, --bg-mode [text|graphic] Assign the background of boot menu. Default is graphic"
43     echo "-m, --custom-ocs PATH/custom-ocs Use the customized ocs program 'custom-ocs' instead of the default one. Note! PATH should be assigned so that it can be found. This is advanced mode."
44     echo "-e, --extra-param PARAM Assign extra parameter PARAM for clonezilla live to run, PARAM will be appended when run in ocs-live-restore or ocs."
45     echo "-g, --ocs-live-language LANGUAGE Assign the language when using clonezilla live, available languages are en_US.UTF-8, zh_TW.UTF-8 "
46     echo "-k, --ocs-live-keymap KEYMAP Assign the keyboard when using clonezilla live. Use full path for KEYMAP, for example: /usr/share/keymaps/i386/azerty/fr.kmap.gz. If 'NONE' is used, the default one (US keyboard) will be use."
47     echo "-t, --ocs-live-batch Set clonezilla live to run in batch mode, usually it's for restoring. If this mode is set, some dialog question will be ignored."
48     echo "-i, --assign-version-no NO Assign the version no as NO instead of date. This only works when using with option -s."
49     echo "-j, --debian-iso ISO_FILE Assign Debian live template iso file name as ISO_FILE to be used to create Clonezilla live."
50     echo "-n, --debian-iso-etc-url-path ISO_ETC_FILE_URL Assign the url (Ex. http://localhost/clonezilla-live/template-iso) for Debian live template iso file as ISO_FILE_URL to be used to create Clonezilla live."
51     echo "-p, --image-path Assign the clonezilla image path where CLONEZILLA_IMAGE_NAME exists. Default = $ocsroot"
52     echo "-s, --skip-image Do not include any clonezilla image. The is used to created a live CD with DRBL/Clonezilla programs only."
53     echo "-f, --on-the-fly DEV Write the output to CD/DVD writer DEV (such as /dev/hdc) instead of creating an ISO file."
54     echo "-o, --normal-menu When a clonezilla image is inserted, by default only restore menu will be shown in the created ISO file. If you want to show normal menu, i.e. with save and restore menu, use this one."
55     echo "-x, --extra-boot-param EXTRA_PARAM Assign extra boot parameter EXTRA_PARAM for clonezilla live kernel to read. These parameters are the same with that from live-initramfs. Ex. \"noprompt\" can be use to not prompt to eject the CD on reboot."
56     echo "-u, --include-dir DIR Include a dir in the target iso file."
57     echo "--ocs-live-boot-menu-option EXTRA_OPTION Assign an extra option for ocs-live-boot-menu. //NOTE// Do not put '-' in this EXTRA_OPTION, $0 will add that automatically. e.g. if you want to add -s1 for ocs-live-boot-menu to run, use 's1' only."
58     echo "$prog will download a template Debian live CD for clonezilla iso file if ncecessary. You can also download it by yourself, and put it in the working directory when you run $prog. If you want to create that template iso file in Debian Etch, run create-debian-live."
59     echo "NOTE! Due to the limitation in mkisofs, this program does not work in clonezilla image file larger than $FILE_LIMIT MB."
60     echo "Ex:"
61     echo "To put clonezilla image sarge-ocs (located in /home/partimag in clonezilla server) to Live CD, you can run:"
62     echo " $prog sarge-ocs"
63     echo "To put more images, just append them, such as:"
64     echo " $prog sarge-ocs etch-ocs"
65     echo "To create a Live CD with DRBL/Clonezilla programs:"
66     echo " $prog -s"
67     echo "To specify the Debian live template iso, run like this:"
68     echo " $prog -j debian-live-for-ocs-1.0.1-3.iso -n http://localhost/clonezilla-live/template-iso/testing -s"
69     echo "To put clonezilla image sarge-ocs, etch-ocs to to Live CD, and write it to cd writer /dev/hdc, you can run:"
70     echo " $prog -f /dev/hdc sarge-ocs etch-ocs"
71     echo "To create an iso file for restoring with clonezilla image sarge-r5 builtin, and make it boot then restore the image sarge-r5 to hda in unattended mode (Only confirmation in the beginning), you can run:"
72     echo " $prog -g en_US.UTF-8 -t -k NONE -e \"-b -c restoredisk sarge-r5 hda\" sarge-r5"
73     echo "To create an iso file to run your own custom-ocs program:"
74     echo " $prog -g en_US.UTF-8 -k NONE -s -m ./custom-ocs"
75     }
76     #
77     check_file_size_in_ocs_image() {
78     local img_path="$1"
79     local size_t
80 sng 59 for ifile in $img_path/*; do
81 sng 47 size_t="$(du -Lms $ifile | awk -F" " '{print $1}')"
82     if [ "$size_t" -gt "$FILE_LIMIT" ]; then
83     ################################################################################
84     # Section edited by S. Georgaras <sng@hellug.gr>
85    
86 sng 93 # [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
87     # echo "$ifile size ($size_t MB) is too large! $msg_mkisofs_unable_process_that"
88     # [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
89     # echo "$msg_are_u_sure_u_want_to_continue"
90     # echo -n "[y/N] "
91     # read cont_ans
92     # case "$cont_ans" in
93     # y|Y|[yY][eE][sS])
94     # echo $msg_ok_let_do_it
95     # ;;
96     # *)
97     # echo "Abort!"
98     # exit 2
99     # esac
100 sng 47 whiptail --backtitle Clonezilla-SysRescCD --title ' Excessive Image Size ' --yesno "The image file \"$(basename ${ifile%/})\" is too large ($size_t MB) and cannot be processed!!!
101    
102     Do you want to create a 8GB DVD instead?" 0 60
103     if [ $? -eq 1 ];then
104     exit 1
105     fi
106     going2RAM="prog_only"
107     break
108     ################################################################################
109     fi
110     done
111     }
112    
113     #
114     clean_tmp_dir() {
115 sng 59 [ -d "$ISOSYSLNX_TMP" -a -n "$(echo $ISOSYSLNX_TMP | grep "ocs_isosyslnx")" ] && rm -rf $ISOSYSLNX_TMP
116     [ -d "$WD_TMP" -a -n "$(echo $WD_TMP | grep "ocs_iso_wd")" ] && rm -rf $WD_TMP
117     [ -d "$DEBIAN_ISO_TMP" ] && umount $DEBIAN_ISO_TMP &>/dev/null && rmdir $DEBIAN_ISO_TMP
118 sng 47 } # End of clean_tmp_dir
119    
120     #
121     check_if_root
122    
123     # default settings:
124     ocs_live_batch="no"
125     custom_ocs=""
126     normal_menu_with_insert_image="no"
127     template_mode=""
128    
129     # Parse command-line options
130     while [ $# -gt 0 ]; do
131     case "$1" in
132     -a|--file-name-prefix)
133     shift
134     if [ -z "$(echo $1 |grep ^-.)" ]; then
135     # skip the -xx option, in case
136     target_iso_prefix="$1"
137     shift
138     fi
139     [ -z "$target_iso_prefix" ] && USAGE && exit 1
140     ;;
141     -l|--language)
142     shift
143     if [ -z "$(echo $1 |grep ^-.)" ]; then
144     # skip the -xx option, in case
145     specified_lang="$1"
146     shift
147     fi
148     [ -z "$specified_lang" ] && USAGE && exit 1
149     ;;
150     -b|--bg-mode)
151     shift
152     if [ -z "$(echo $1 |grep ^-.)" ]; then
153     # skip the -xx option, in case
154     bg_mode="$1"
155     shift
156     fi
157     [ -z "$bg_mode" ] && USAGE && exit 1
158     ;;
159     -m|--custom-ocs)
160     shift
161     if [ -z "$(echo $1 |grep ^-.)" ]; then
162     # skip the -xx option, in case
163     custom_ocs="$1"
164     shift
165     fi
166     [ -z "$custom_ocs" ] && USAGE && exit 1
167     ;;
168     -e|--extra-param)
169     shift
170     # extra param might begin with -, i.e. Ex. -b -p true. Therefore we should not skip this.
171     ocs_live_extra_param="$1"
172     shift
173     [ -z "$ocs_live_extra_param" ] && USAGE && exit 1
174     ;;
175     -i|--assign-version-no)
176     shift
177     if [ -z "$(echo $1 |grep ^-.)" ]; then
178     # skip the -xx option, in case
179     version_no="$1"
180     shift
181     fi
182     [ -z "$version_no" ] && USAGE && exit 1
183     ;;
184     -g|--ocs-live-language)
185     shift
186     if [ -z "$(echo $1 |grep ^-.)" ]; then
187     # skip the -xx option, in case
188     ocs_lang="$1"
189     shift
190     fi
191     [ -z "$ocs_lang" ] && USAGE && exit 1
192     ;;
193     -k|--ocs-live-keymap)
194     shift
195     if [ -z "$(echo $1 |grep ^-.)" ]; then
196     # skip the -xx option, in case
197     ocs_live_keymap="$1"
198     shift
199     fi
200     [ -z "$ocs_live_keymap" ] && USAGE && exit 1
201     ;;
202     -p|--image-path)
203     shift
204     if [ -z "$(echo $1 |grep ^-.)" ]; then
205     # skip the -xx option, in case
206     image_path="$1"
207     shift
208     fi
209     [ -z "$image_path" ] && USAGE && exit 1
210     ;;
211     -s|--skip-image)
212     insert_mode="prog_only"
213 sng 93 #
214     # Section inserted by S. Georgaras <sng@hellug.gr>
215     # Variable to know that -s was actually used
216     #
217     ORIGINAL_INSERT_MODE='-o'
218     #
219     ##################################################
220 sng 47 shift ;;
221     -t|--ocs-live-batch)
222     ocs_live_batch="yes"
223     shift ;;
224     -o|--normal-menu)
225     normal_menu_with_insert_image="yes"
226     shift ;;
227     -f|--on-the-fly)
228     shift
229     output_mode="cdwriter"
230     if [ -z "$(echo $1 |grep ^-.)" ]; then
231     # skip the -xx option, in case
232     output_dev="$1"
233     shift
234     fi
235     [ -z "$output_dev" ] && USAGE && exit 1
236     ;;
237     -j|--debian-iso)
238     shift
239     if [ -z "$(echo $1 |grep ^-.)" ]; then
240     # skip the -xx option, in case
241     DEBIAN_ISO="$1"
242     template_mode="from-download-live-media"
243     shift
244     fi
245     [ -z "$DEBIAN_ISO" ] && USAGE && exit 1
246     ;;
247     -n|--debian-iso-etc-url-path)
248     shift
249     if [ -z "$(echo $1 |grep ^-.)" ]; then
250     # skip the -xx option, in case
251     DEBIAN_ISO_ETC_PATH="$1"
252     shift
253     fi
254     [ -z "$DEBIAN_ISO_ETC_PATH" ] && USAGE && exit 1
255     ;;
256     -x|--extra-boot-param)
257     shift
258     if [ -z "$(echo $1 |grep ^-.)" ]; then
259     # skip the -xx option, in case
260     live_extra_boot_param="$1"
261     shift
262     fi
263     [ -z "$live_extra_boot_param" ] && USAGE && exit 1
264     ;;
265     --ocs-live-boot-menu-option)
266     shift
267     if [ -z "$(echo $1 |grep ^-.)" ]; then
268     # skip the -xx option, in case
269     ocs_live_boot_menu_option="$1"
270     shift
271     fi
272     [ -z "$ocs_live_boot_menu_option" ] && USAGE && exit 1
273     ;;
274     -u|--include-dir)
275     shift
276     if [ -z "$(echo $1 |grep ^-.)" ]; then
277     # skip the -xx option, in case
278     include_dir="$1"
279     include_dir_graft_point="$include_dir=$include_dir"
280     shift
281     fi
282     [ -z "$include_dir" ] && USAGE && exit 1
283     ;;
284     -*) echo "${0}: ${1}: invalid option" >&2
285     USAGE >& 2
286     exit 2 ;;
287     *) break ;;
288     esac
289     done
290     ocs_image="$*"
291     # strip the / to avoid problem
292     ocs_image="$(echo $ocs_image | sed -e "s|/||g")"
293    
294     [ -z "$ocs_image" -a "$insert_mode" = "prog_and_img" ] && USAGE && exit 1
295     [ -z "$image_path" ] && image_path=$ocsroot
296     [ -z "$bg_mode" ] && bg_mode="$BG_MODE_DEF"
297     [ -z "$DEBIAN_ISO_ETC_PATH" ] && DEBIAN_ISO_ETC_PATH="$DEBIAN_ISO_ETC_PATH_DEF"
298     [ -z "$DEBIAN_ISO" ] && DEBIAN_ISO="$DEBIAN_ISO_DEF"
299     [ -n "$ocs_live_boot_menu_option" ] && ocs_live_boot_menu_option="-$ocs_live_boot_menu_option"
300     DEBIAN_ISO_URL="$DEBIAN_ISO_ETC_PATH/$DEBIAN_ISO"
301     md5_file_url="$DEBIAN_ISO_ETC_PATH/$md5_file"
302    
303     #
304     ask_and_load_lang_set $specified_lang
305    
306     #
307     if ! type genisoimage &>/dev/null; then
308     [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
309     echo "Program genisoimage not found!"
310     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
311     echo "$msg_program_stop"
312     exit 1
313     fi
314    
315     if [ "$output_mode" = "cdwriter" -a type wodim &>/dev/null ]; then
316     [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
317     echo "Program wodim is not aviailable! You have to install it."
318     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
319     echo "$msg_program_stop"
320     exit 1
321     fi
322    
323     if [ -n "$custom_ocs" -a ! -e "$custom_ocs" ]; then
324     [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
325     echo "File $custom_ocs not found!"
326     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
327     echo "$msg_program_stop"
328     exit 1
329     fi
330    
331     # Format the lang variable. This is for clonezilla live running, not for ocs-iso.
332     case "$ocs_lang" in
333     zh_TW.BIG5|zh_TW.big5|tw.BIG5)
334     [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
335     echo "For Traditional Chinese locale, Clonezilla live only supports unicode (zh_TW.UTF-8), not Big5 encoding (zh_TW.BIG5). Force to use UTF-8 for Traditional Chinese in Clonezilla live."
336     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
337     ocs_lang="zh_TW.UTF-8" ;;
338     zh_TW.UTF-8|zh_TW.utf8|tw.UTF-8|tw.utf8)
339     ocs_lang="zh_TW.UTF-8" ;;
340     esac
341    
342     # Decide where is the $LIVE_MEDIA
343     get_live_media_mnt_point &>/dev/null
344    
345     # Some temp dirs
346     # Thanks to Orgad Shaneh. Since the temp files from Clonezilla live won't take too much space, we just use /tmp/ to store these temp files.
347     #if [ -w ./ ]; then
348 sng 59 # ISOSYSLNX_TMP="$(mktemp -d ./isolnx.XXXXXX)"
349 sng 47 # WD_TMP="$(mktemp -d ./iso_wd.XXXXXX)"
350     #else
351 sng 59 # ISOSYSLNX_TMP="$(mktemp -d /tmp/isolnx.XXXXXX)"
352 sng 47 # WD_TMP="$(mktemp -d /tmp/iso_wd.XXXXXX)"
353     #fi
354 sng 59 ISOSYSLNX_TMP="$(mktemp -d /tmp/ocs_isosyslnx.XXXXXX)"
355     WD_TMP="$(mktemp -d /tmp/ocs_iso_wd.XXXXXX)"
356 sng 47
357     #
358     trap clean_tmp_dir HUP INT QUIT TERM EXIT
359    
360     # Try to find if it is running on live cd/usb already
361     if [ -z "$template_mode" ]; then
362     if [ -n "$LIVE_MEDIA" ]; then
363     # It's running from Clonezilla live media, use the existing resource
364     template_mode="from-booting-live-media"
365     [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
366     echo "Found a Clonezilla live media... Will use that as a template..."
367     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
368     else
369     template_mode="from-downloaded-live-media"
370     [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
371     echo "No Clonezilla live media was found... Will use the downloaded template from Clonezilla repository..."
372     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
373     fi
374     fi
375    
376     if [ "$template_mode" = "from-downloaded-live-media" ]; then
377     if [ ! -f "$DEBIAN_ISO" ]; then
378     echo "We need Debian live CD for Clonnezilla to create clonezilla cd."
379     echo "Downloadling the iso file from $DEBIAN_ISO_URL..."
380     wget $DEBIAN_ISO_URL
381     get_iso_rc=$?
382     # validate it
383     if [ "$get_iso_rc" -eq 0 ]; then
384     echo -n "Validating $DEBIAN_ISO... "
385     md5_tmp="$(mktemp -d /tmp/isomd5.XXXXX)"
386     # wget http://opensource.nchc.org.tw/drbl-core/iso/MD5SUMS
387     echo -n "Downloading $md5_file_url... "
388     wget $wget_opt -P "$md5_tmp" $md5_file_url
389     if ! grep -w "$DEBIAN_ISO" $md5_tmp/MD5SUMS | md5sum -c; then
390     [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
391     echo "$DEBIAN_ISO is broken! Something went wrong! Try to remove $DEBIAN_ISO and run this program again."
392     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
393     echo "$msg_program_stop"
394     exit 1
395     fi
396     else
397     [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
398     echo "Unable to download $DEBIAN_ISO_URL!"
399     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
400     echo "$msg_program_stop"
401     exit 1
402     fi
403     else
404     echo "A template iso ($DEBIAN_ISO) was found!"
405     fi
406     fi
407    
408     allow_limited_size_flag=""
409     if [ "$insert_mode" = "prog_and_img" ]; then
410     # 2 cases:
411     # (1) normal_menu_with_insert_image=no, i.e. only restore menu. ocs-live-restore is the main program.
412     # If it's not batch mode for clonezilla live (especially for restoring), by default we have to append "-x --restore-only", and especially before any other parameters, so that ocs-sr will run like:
413     # ocs-sr -l $ocs_lang -p true -x --restore-only -b restoredisk sarge_image
414     # (2) normal_menu_with_insert_image=yes, i.e. normal menu. ocs-live-general is the main program. Threfore no extra param.
415     if [ "$ocs_live_batch" = "no" ]; then
416     case "$normal_menu_with_insert_image" in
417     no) ocs_live_extra_param="-x --restore-only $ocs_live_extra_param" ;;
418     yes) ocs_live_extra_param="" ;;
419     esac
420     fi
421    
422     echo "Creating clonezilla ISO with image(s) $ocs_image from $image_path..."
423     # here we put ocs-live-restore as ocs-live inside live cd, and it will be shown as /$LIVE_MEDIA/ocs-live when using in running live CD.
424     # use the 1st image name as iso filename
425     iso_label_tag="$(echo $ocs_image | awk -F" " '{print $1}')"
426     # mkisofs only allow 32 characters for volume ID
427     iso_label_tag="${iso_label_tag:0:31}"
428     ocs_imgs_with_abs_path=""
429     for im in $ocs_image; do
430     if [ ! -d "$image_path/$im" ]; then
431     [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
432     echo "$image_path/$im $msg_NOT_found!"
433     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
434     echo "$msg_program_stop"
435     exit 1
436     fi
437     if [ -z "$allow_limited_size_flag" ]; then
438     if [ -n "$(find $image_path/$im -size +${iso9660_file_size_limit} -print)" ]; then
439     allow_limited_size_flag="yes"
440     fi
441     fi
442     # we will put all the images in $ocsroot/ inside ISO file.
443     # Since we will always use /home/partimag as the image root in Clonezilla live, here the path in the created iso is /home/partimag/
444     ocs_imgs_with_abs_path="$ocs_imgs_with_abs_path /home/partimag/$im/=$image_path/$im/"
445     convert_ocs_format_from_1.5_to_2.0_or_newer $image_path/$im/
446     check_file_size_in_ocs_image $image_path/$im/
447     img_size="$(du -ms $image_path/$im/ | awk -F" " '{print $1}')" # unit: MB
448     img_size_sum="$((img_size_sum+img_size))"
449     done
450     else
451     echo "Creating clonezilla Live CD ISO file..."
452     # if version_no is not set, use date (Ex. 20070409)
453     [ -z "$version_no" ] && version_no="$(date +%Y%m%d)"
454     iso_label_tag="${version_no}"
455     fi
456     boot_menu_opt="--version-no $iso_label_tag"
457    
458     if [ -n "$target_iso_prefix" ]; then
459     target_iso="${target_iso_prefix}.iso"
460     else
461     target_iso="clonezilla-live-${iso_label_tag}.iso"
462     fi
463     echo "The output file name is: $target_iso."
464    
465     if [ "$template_mode" = "from-booting-live-media" ]; then
466     DEBIAN_ISO_TMP="$LIVE_MEDIA"
467     else
468     DEBIAN_ISO_TMP="$(mktemp -d /tmp/ocs-iso.XXXXXX)"
469     mount -o loop,ro $DEBIAN_ISO $DEBIAN_ISO_TMP
470     fi
471    
472     #
473     # Possible kernel/initrd paths are /casper (created by casper) or /live (created by live-initramfs)
474     # Find the kernel and initrd in $DEBIAN_ISO_TMP/casper or $DEBIAN_ISO_TMP/live
475     # Ex: $DEBIAN_ISO_TMP/casper/vmlinuz1, /$DEBIAN_ISO_TMP/casper/initrd1.img
476     # $live_sys_files_dir_list is from drbl-ocs.conf.
477     # Possible kernel/initrd paths are /casper (created by casper) or /live (created by live-initramfs)
478     sys_files_dir=""
479     for i in $live_sys_files_dir_list; do
480     krnfile_full_path="$(find $DEBIAN_ISO_TMP/$i/ -maxdepth 1 -name "vmlinuz*" -print 2>/dev/null)"
481     if [ -n "$krnfile_full_path" ]; then
482     krnfile="$(basename $krnfile_full_path)"
483     sys_files_dir="$i"
484     irdfile_full_path="$(find $DEBIAN_ISO_TMP/$i/ -maxdepth 1 -name "initrd*" -print)"
485     irdfile="$(basename $irdfile_full_path)"
486     break
487     fi
488     done
489    
490     #
491     if [ -z "$sys_files_dir" ]; then
492     [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
493     echo "No system files from template live iso are found! Something went wrong!"
494     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
495     echo "$msg_program_stop"
496     exit 1
497     fi
498    
499     if [ -z "$krnfile" -o -z "$irdfile" ]; then
500     [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
501     echo "Kernel and initrd files NOT found in path $DEBIAN_ISO_TMP/$sys_files_dir/!"
502     echo "$msg_program_stop"
503     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
504     exit 1
505     fi
506    
507 sng 93 if [ "$template_mode" = "from-booting-live-media" ]; then
508     # From boot media (clonezilla live), DEBIAN_ISO_TMP is LIVE_MEDIA
509     # The dirs/files in Clonezilla live:
510     # -r--r--r-- 1 root root 117 2010-05-21 21:17 Clonezilla-Live-Version
511     # -r--r--r-- 1 root root 18K 2010-05-21 21:05 COPYING
512     # dr-xr-xr-x 2 root root 2.0K 2010-05-21 21:17 isolinux/
513     # dr-xr-xr-x 2 root root 2.0K 2010-05-21 21:17 live/
514     # dr-xr-xr-x 2 root root 2.0K 2010-05-21 21:17 syslinux/
515     # dr-xr-xr-x 5 root root 2.0K 2010-05-21 21:17 utils/
516     # We need all of them.
517     template_iso_size="$(LC_ALL=C du -Lmsc $LIVE_MEDIA/{Clonezilla-Live-Version,COPYING,isolinux,$sys_files_dir,syslinux,utils} | tail -n 1 | awk -F" " '{print $1}')"
518     else
519     # From iso file (debian-live-for-ocs.iso)
520     # The dirs/files in Debian live for OCS:
521     # dr-xr-xr-x 3 root root 4.0K 2010-05-28 18:03 doc/
522     # dr-xr-xr-x 2 root root 4.0K 2010-05-28 18:03 isolinux/
523     # dr-xr-xr-x 2 root root 2.0K 2010-05-28 18:03 live/
524     # -r--r--r-- 1 root root 3.7K 2010-05-28 18:03 md5sum.txt
525     # We only need dirs isolinux and live only
526     template_iso_size="$(LC_ALL=C du -Lmsc $DEBIAN_ISO_TMP/{isolinux,$sys_files_dir} | tail -n 1 | awk -F" " '{print $1}')"
527     fi
528     target_iso_size="$(($template_iso_size + $img_size_sum))"
529    
530 sng 47 #
531 sng 59 BOOT_ITEM_DIR=$ISOSYSLNX_TMP/$sys_files_dir
532 sng 47 [ ! -d $BOOT_ITEM_DIR ] && mkdir $BOOT_ITEM_DIR
533     echo -n "Copying the system files to working dir... This might take a few minutes... "
534 sng 59 cp -af $DEBIAN_ISO_TMP/$sys_files_dir $ISOSYSLNX_TMP/
535 sng 47 RC=$?
536     if [ "$RC" -ne 0 ]; then
537     [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
538     echo "Failed to copy system files to working dir..."
539     echo "$msg_program_stop"
540     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
541     exit 1
542     fi
543     echo "done!"
544    
545     ################################################################################
546     # Section edited by S. Georgaras <sng@hellug.gr>
547     #
548     # echo "Estimated target ISO file \"$target_iso\" size: $target_iso_size MB"
549     # if [ "$target_iso_size" -gt "$FILE_LIMIT" ]; then
550     # [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
551     # echo "$msg_ocs_iso_too_big_for_DVD"
552     # [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
553     # echo "$msg_are_u_sure_u_want_to_continue"
554     # echo -n "[y/N] "
555     # read cont_ans
556     # case "$cont_ans" in
557     # y|Y|[yY][eE][sS])
558     # echo $msg_ok_let_do_it
559     # ;;
560     # *)
561     # echo "Abort!"
562     # exit 2
563     # esac
564     # elif [ "$target_iso_size" -gt "$CD_FILE_LIMIT" ]; then
565     # [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
566     # echo "$msg_ocs_iso_too_big_for_CD"
567     # [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
568     # echo "$msg_are_u_sure_u_want_to_continue"
569     # echo -n "[y/N] "
570     # read cont_ans
571     # case "$cont_ans" in
572     # y|Y|[yY][eE][sS])
573     # echo $msg_ok_let_do_it
574     # ;;
575     # *)
576     # echo "Abort!"
577     # exit 2
578     # esac
579     # fi
580    
581     ################################################################################
582    
583     # output setting for clonezilla live
584     mkdir -p $WD_TMP/etc/ocs
585    
586     # Decide ocs_live_run
587     # $DRBL_SCRIPT_PATH/sbin/custom-ocs is copied from $LIVE_MEDIA/pkg/custom-ocs by /etc/ocs/ocs-live.d/S03prep-drbl-clonezilla when booting
588     if [ -n "$custom_ocs" ]; then
589     custom_ocs_opt="/pkg/custom-ocs=$custom_ocs"
590     ocs_live_run="custom-ocs"
591     else
592     if [ "$insert_mode" = "prog_and_img" ]; then
593     case "$normal_menu_with_insert_image" in
594     no) ocs_live_run="ocs-live-restore" ;;
595     yes) ocs_live_run="ocs-live-general" ;;
596     esac
597     else # prog_only mode
598     ocs_live_run="ocs-live-general"
599     fi
600     fi
601    
602     # Create the iso image file
603     # isolinux should be rw, so we have to copy it, and exclude the one in iso image.
604 sng 59 mkdir -p $ISOSYSLNX_TMP/isolinux/ $ISOSYSLNX_TMP/syslinux/
605     # rsync -a --exclude f*.txt --exclude boot.cat --exclude isolinux.txt --exclude isolinux.bin --exclude splash.rle --exclude doc $DRBL_SCRIPT_PATH/pkg/syslinux/* $ISOSYSLNX_TMP/isolinux/
606 sng 47 # we have to overwrite isolinux.bin since vesamenu.c32 should be same version with that.
607 sng 59 # For isolinux
608     cp -af $isolinux_file $pxelinux_simple_vesamenu $pxelinux_simple_menu $pxelinux_memdisk_file $pxelinux_bg_img $ocs_logo_img_syslinux $pxelinux_chain_file $ISOSYSLNX_TMP/isolinux/
609     # For syslinux
610     cp -af $pxelinux_simple_vesamenu $pxelinux_simple_menu $pxelinux_memdisk_file $pxelinux_bg_img $ocs_logo_img_syslinux $pxelinux_chain_file $ISOSYSLNX_TMP/syslinux/
611 sng 47
612     etherboot_zlilo="$($query_pkglist_cmd drbl-etherboot 2>/dev/null | grep -E "eb-.*-etherboot-pci.zlilo$")"
613     # we have to force it name as etherboot.zdsk, since isolinux only uses the "plain" ISO 9660 filenames, i.e. it does not support Rock Ridge or Joliet filenames.
614     # ref: http://syslinux.zytor.com/archives/2006-October/007440.html
615     # "-" will be regards as "_" if you want to use "-" for isolinux.
616     # In syslinux on vfat, etherboot.zlilo is too long, make it ever shorter as eb.zli
617     if [ -n "$etherboot_zlilo" ]; then
618     # This is run in DRBL server
619     cp -af $etherboot_zlilo $BOOT_ITEM_DIR/eb.zli
620     else
621     # This is run in Clonezilla live with casper or live mechanism
622     for i in $live_sys_files_dir_list; do
623     if [ -e "$LIVE_MEDIA/$i/eb.zli" ]; then
624     cp -af $LIVE_MEDIA/$i/eb.zli $BOOT_ITEM_DIR/eb.zli
625     break
626     fi
627     done
628     fi
629     # same reason, we have to use different name in isolinux
630     gpxe_lkn="$($query_pkglist_cmd gpxe 2>/dev/null | grep -E "gpxe.lkrn$")"
631     if [ -n "$gpxe_lkn" ]; then
632     # This is run in DRBL server
633     cp -af $gpxe_lkn $BOOT_ITEM_DIR/gpxe.lkn
634     else
635     # This is run in Clonezilla live with casper or live mechanism
636     for i in $live_sys_files_dir_list; do
637     if [ -e "$LIVE_MEDIA/$i/gpxe.lkn" ]; then
638     cp -af $LIVE_MEDIA/$i/gpxe.lkn $BOOT_ITEM_DIR/gpxe.lkn
639     break
640     fi
641     done
642     fi
643     # same reason, we have to use different name in isolinux
644     if [ -e "$fdos_img_src" ] ; then
645     cp -af $fdos_img_src $BOOT_ITEM_DIR/freedos.img
646     else
647     # This is run in Clonezilla live with casper or live mechanism
648     for i in $live_sys_files_dir_list; do
649     if [ -e "$LIVE_MEDIA/$i/freedos.img" ]; then
650     cp -af $LIVE_MEDIA/$i/freedos.img $BOOT_ITEM_DIR/freedos.img
651     break
652     fi
653     done
654     fi
655     # $memtest86_file (memtest86) is 9 characters, will go wrong when it's FAT (usb flash drive). We use memtest to overwrite the one comes from Debian live.
656     # Since live helper will put memtest in casper, we can choose to copy it or not.
657     # If we really want to use the memtest from drbl, we have to remove $DEBIAN_ISO_TMP/casper/memtest before doing mkisofs, otherwise it will complain like:
658     # Using MEMTEST000.;1 for /tmp/ocs-iso.E15902/casper/memtest (memtest)
659     # genisoimage: Error: '/tmp/isolnx.V15903/casper/memtest' and '/tmp/ocs-iso.E15902/casper/memtest' have the same Rock Ridge name 'memtest'.
660     # Unable to sort directory /tmp/ocs-iso.E15902/casper
661     # since $DEBIAN_ISO_TMP/casper/memtest is read-only, we can not remove it. Later we will exclude that later by mkisofs.
662     if [ -e "$memtest86_file" ]; then
663     cp -af $memtest86_file $BOOT_ITEM_DIR/memtest
664     else
665     # This is run in Clonezilla live with casper or live mechanism
666     for i in $live_sys_files_dir_list; do
667     if [ -e "$LIVE_MEDIA/$i/memtest" ]; then
668     cp -af $LIVE_MEDIA/$i/memtest $BOOT_ITEM_DIR/memtest
669     break
670     fi
671     done
672     fi
673    
674     # Excluding list for mkisofs
675     for i in $live_sys_files_dir_list; do
676     if [ -e "$DEBIAN_ISO_TMP/$i/memtest" ]; then
677     mkiso_exclude_list="$mkiso_exclude_list $i/memtest"
678     break
679     fi
680     done
681     mkiso_exclude_opt=""
682     for i in $mkiso_exclude_list; do
683     mkiso_exclude_opt="$mkiso_exclude_opt -x $DEBIAN_ISO_TMP/$i"
684     done
685    
686     # Find the boot param $boot_param
687     get_live_boot_param $DEBIAN_ISO_TMP/isolinux
688    
689     #
690     if [ -n "$ocs_image" ]; then
691 sng 59 # For isolinux
692     ocs-live-boot-menu $ocs_live_boot_menu_option -l $lang_answer -f $VGA_MODE_DEF -b $bg_mode -k /$sys_files_dir/$krnfile -i /$sys_files_dir/$irdfile -m $ocs_logo_img_syslinux $boot_menu_opt --boot-param "$boot_param $live_extra_boot_param $supp_boot_param_ocs_live_iso ocs_live_run=\"$ocs_live_run\" ocs_live_extra_param=\"$ocs_live_extra_param\" ocs_live_keymap=\"$ocs_live_keymap\" ocs_live_batch=\"$ocs_live_batch\" ocs_lang=\"$ocs_lang\"" --title "clonezilla live with img $ocs_image" isolinux $ISOSYSLNX_TMP/isolinux/
693     # For syslinux
694     ocs-live-boot-menu $ocs_live_boot_menu_option -l $lang_answer -f $VGA_MODE_DEF -b $bg_mode -k /$sys_files_dir/$krnfile -i /$sys_files_dir/$irdfile -m $ocs_logo_img_syslinux $boot_menu_opt --boot-param "$boot_param $live_extra_boot_param $supp_boot_param_ocs_live_dev ocs_live_run=\"$ocs_live_run\" ocs_live_extra_param=\"$ocs_live_extra_param\" ocs_live_keymap=\"$ocs_live_keymap\" ocs_live_batch=\"$ocs_live_batch\" ocs_lang=\"$ocs_lang\"" --title "clonezilla live with img $ocs_image" syslinux $ISOSYSLNX_TMP/syslinux/
695 sng 47 else
696 sng 59 # For isolinux
697     ocs-live-boot-menu $ocs_live_boot_menu_option -l $lang_answer -f $VGA_MODE_DEF -b $bg_mode -k /$sys_files_dir/$krnfile -i /$sys_files_dir/$irdfile -m $ocs_logo_img_syslinux $boot_menu_opt --boot-param "$boot_param $live_extra_boot_param $supp_boot_param_ocs_live_iso ocs_live_run=\"$ocs_live_run\" ocs_live_extra_param=\"$ocs_live_extra_param\" ocs_live_keymap=\"$ocs_live_keymap\" ocs_live_batch=\"$ocs_live_batch\" ocs_lang=\"$ocs_lang\"" isolinux $ISOSYSLNX_TMP/isolinux/
698     # For syslinux
699     ocs-live-boot-menu $ocs_live_boot_menu_option -l $lang_answer -f $VGA_MODE_DEF -b $bg_mode -k /$sys_files_dir/$krnfile -i /$sys_files_dir/$irdfile -m $ocs_logo_img_syslinux $boot_menu_opt --boot-param "$boot_param $live_extra_boot_param $supp_boot_param_ocs_live_dev ocs_live_run=\"$ocs_live_run\" ocs_live_extra_param=\"$ocs_live_extra_param\" ocs_live_keymap=\"$ocs_live_keymap\" ocs_live_batch=\"$ocs_live_batch\" ocs_lang=\"$ocs_lang\"" syslinux $ISOSYSLNX_TMP/syslinux/
700 sng 47 fi
701    
702     #
703 sng 93 echo "Preparing syslinux, syslinux.exe, makeboot.sh, and makeboot.bat in dir utils... "
704 sng 47 # If it's in Clonezilla live environment, we have those files
705     if [ -e "$LIVE_MEDIA/utils/linux/syslinux" -a \
706     -e "$LIVE_MEDIA/utils/mbr/mbr.bin" -a \
707     -e "$LIVE_MEDIA/utils/win32/syslinux.exe" ]; then
708 sng 59 cp -rf $LIVE_MEDIA/utils $ISOSYSLNX_TMP
709 sng 47 else
710 sng 59 put_syslinux_makeboot_for_usb_flash $ISOSYSLNX_TMP
711 sng 47 fi
712 sng 59 if [ -d "$ISOSYSLNX_TMP/utils" ]; then
713     utils_files_dir_graft_point="/utils/=$ISOSYSLNX_TMP/utils/"
714 sng 47 fi
715    
716     # put version tag
717     # The content is like clonezilla-live-20070308
718 sng 59 echo "clonezilla-live-${iso_label_tag}" > $ISOSYSLNX_TMP/Clonezilla-Live-Version
719     echo "This Clonezilla live iso file was created by this command:" >> $ISOSYSLNX_TMP/Clonezilla-Live-Version
720     echo "$prog $prog_option" >> $ISOSYSLNX_TMP/Clonezilla-Live-Version
721 sng 47
722     # $sys_files_dir maybe /casper, /live or /isolinux. If it is isolinux, we can not list them twice otherwise mkisofs will go wrong.
723     if [ "$sys_files_dir" != "isolinux" ]; then
724 sng 59 sys_files_dir_graft_point="/isolinux/=$ISOSYSLNX_TMP/isolinux/ /syslinux/=$ISOSYSLNX_TMP/syslinux/ /$sys_files_dir/=$ISOSYSLNX_TMP/$sys_files_dir/"
725 sng 47 else
726 sng 59 sys_files_dir_graft_point="/isolinux/=$ISOSYSLNX_TMP/isolinux/ /syslinux/=$ISOSYSLNX_TMP/syslinux/"
727 sng 47 fi
728    
729     # If template_mode="from-booting-live-media", then there is /COPYING and /Clonezilla-Live-Version, then we should not assign that.
730     doc_insert_in_root=""
731 sng 93 if [ -e "$DEBIAN_ISO_TMP/COPYING" ]; then
732     doc_insert_in_root="/COPYING=$DEBIAN_ISO_TMP/COPYING"
733     else
734 sng 47 doc_insert_in_root="/COPYING=$DRBL_SCRIPT_PATH/doc/COPYING"
735     fi
736 sng 93 if [ -e "$DEBIAN_ISO_TMP/Clonezilla-Live-Version" ]; then
737     doc_insert_in_root="$doc_insert_in_root /Clonezilla-Live-Version=$DEBIAN_ISO_TMP/Clonezilla-Live-Version"
738     else
739 sng 59 doc_insert_in_root="$doc_insert_in_root /Clonezilla-Live-Version=$ISOSYSLNX_TMP/Clonezilla-Live-Version"
740 sng 47 fi
741    
742     #
743     allow_limited_size_opt=""
744     if [ "$allow_limited_size_flag" = "yes" ]; then
745     [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
746     echo "Since there is at least one file larger than ${iso9660_file_size_limit}B in the image file, we turn on the option -allow-limited-size for genisoimage. This also implies enabling UDF format instead of iso9660."
747     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
748     allow_limited_size_opt="-allow-limited-size"
749     fi
750    
751     echo "genisoimage \
752     -A "Clonezilla live CD" \
753     -V "$iso_label_tag" \
754     -publisher "DRBL/Clonezilla http://drbl.name http://clonezilla.org" \
755     -f -r -J -l $allow_limited_size_opt \
756     -b isolinux/isolinux.bin -c isolinux/boot.cat \
757     -no-emul-boot -boot-load-size 4 -boot-info-table \
758     $mkiso_exclude_opt \
759 sng 93 -graft-points \
760 sng 47 $sys_files_dir_graft_point \
761     $utils_files_dir_graft_point \
762     $doc_insert_in_root \
763     $ocs_imgs_with_abs_path \
764     $custom_ocs_opt \
765     $include_dir_graft_point
766     "
767    
768     echo "DEBIAN_ISO_TMP=$DEBIAN_ISO_TMP"
769 sng 93 echo "mkiso_exclude_opt = $mkiso_exclude_opt"
770     echo "allow_limited_size_opt = $allow_limited_size_opt"
771     echo "sys_files_dir_graft_point = $sys_files_dir_graft_point"
772     echo "utils_files_dir_graft_point = $utils_files_dir_graft_point"
773     echo "doc_insert_in_root = $doc_insert_in_root"
774     echo "ocs_imgs_with_abs_path = $ocs_imgs_with_abs_path"
775     echo "custom_ocs_opt = $custom_ocs_opt"
776     echo "include_dir_graft_point = $include_dir_graft_point"
777 sng 47 echo
778     echo "ocs_image=$ocs_image"
779     echo "image_path=$image_path"
780    
781 sng 93 read
782 sng 47
783 sng 93 # if [ -z "$ORIGINAL_INSERT_MODE" ];then
784     # A_LINE=`grep 'append initrd=/live/initrd.img'/tmp/ocs_isos*/isolinux/isolinux.cfg | sed '2,$d'`
785     # PARAM=`echo "$A_LINE" | sed 's/.*ocs_live_extra_param="\([^"]*\)".*/\1/'`
786     # KEYMAP=`echo "$A_LINE" | sed 's/.*ocs_live_keymap="\([^"]*\)".*/\1/'`
787     # LANG=`echo "$A_LINE" | sed 's/.*ocs_lang="\([^"]*\)".*/\1/'`
788     # if [ -z "$going2RAM" ];then
789     # #cp /restorecd/isolinux-restore-cd.cfg /tmp/ocs_isos*/isolinux/isolinux.cfg
790     # cfg_orig=/restorecd/isolinux-restore-cd.cfg
791     # else
792     # #cp /restorecd/isolinux-restore-cd-ram.cfg /tmp/ocs_isos*/isolinux/isolinux.cfg
793     # cfg_orig=/restorecd/isolinux-restore-cd-ram.cfg
794     # fi
795     # # replace with current values
796     # sed "s|ocs_live_extra_param=\"[^\"]*\"|ocs_live_extra_param=\"$PARAM\"|
797     # s|ocs_live_keymap=\"[^\"]*\"|ocs_live_keymap=\"$KEYMAP\"|
798     # s|ocs_lang=\"[^\"]*\"|ocs_lang=\"$LANG\"|
799     # " "$cfg_orig" > /tmp/ocs_isos*/isolinux/isolinux.cfg
800 sng 47
801 sng 93 cust-menu -publisher "DRBL/Clonezilla http://drbl.name http://clonezilla.org" -V "$iso_label_tag" "$ORIGINAL_INSERT_MODE" "$going2RAM"
802     # fi
803 sng 47
804 sng 93 # Fix missing "boot=live"
805     for n in /tmp/ocs_isos*/isolinux/isolinux.cfg /tmp/ocs_isos*/syslinux/syslinux.cfg;do
806     if [ -e "$n" ];then
807     sed 's/boot=[^ ]* //
808     s{initrd=/live/initrd.img{initrd=/live/initrd.img boot=live {' "$n" > "$n".tmp && mv "$n".tmp "$n"
809     fi
810     done
811    
812 sng 47 if [ -n "$going2RAM" ];then
813     ocs_imgs_with_abs_path=''
814     fi
815    
816     if [ -e /tmp/isodata ];then
817     iso_label_tag=`sed '2d' /tmp/isodata`
818     isoPublisher=`sed '1d' /tmp/isodata`
819     rm /tmp/isodata 2>/dev/null
820     fi
821    
822     # make iso file
823     genisoimage \
824     -A "Clonezilla live CD" \
825     -V "$iso_label_tag" \
826     -publisher "$isoPublisher" \
827     -f -r -J -l $allow_limited_size_opt \
828     -b isolinux/isolinux.bin -c isolinux/boot.cat \
829     -no-emul-boot -boot-load-size 4 -boot-info-table \
830     $mkiso_exclude_opt \
831 sng 93 -graft-points \
832 sng 47 $sys_files_dir_graft_point \
833     $utils_files_dir_graft_point \
834     $doc_insert_in_root \
835     $ocs_imgs_with_abs_path \
836     $custom_ocs_opt \
837     $include_dir_graft_point \
838     | \
839     (
840     case "$output_mode" in
841     "cdwriter")
842     wodim dev=$output_dev -data -eject -v -
843     ;;
844     *)
845     # use /dev/stdout as the bridge
846     cat - > $target_iso
847     ;;
848     esac
849     )
850    
851     rc=$?
852     if [ "$rc" -gt 0 ]; then
853     [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE
854     echo "Something went wrong!"
855     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
856 sng 59 clean_tmp_dir
857 sng 47 [ -n "$target_iso" -a -f "$target_iso" ] && rm -fv $target_iso
858     [ -n "$ISOLNX_TMP" -a -d "$ISOLNX_TMP" ] && rm -rf $ISOLNX_TMP
859     [ -n "$WD_TMP" -a -d "$WD_TMP" ] && rm -rf $WD_TMP
860     echo "$msg_program_stop"
861     exit 1
862     fi
863    
864     # unmount all iso file
865     umount $DEBIAN_ISO_TMP &>/dev/null
866    
867     # Clean the tmp working directory
868     echo "Cleaning tmp dirs..."
869 sng 59 clean_tmp_dir
870 sng 47
871     #
872     if [ -e "$target_iso" ]; then
873     if type isohybrid &>/dev/null; then
874     echo -n "Isohybriding $target_iso... "
875     isohybrid $target_iso
876     echo "done!"
877     fi
878     [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
879     echo "$msg_burn_clonezilla_img_iso: $target_iso"
880     [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
881     fi
882    
883    
884     ################################################################################
885     # Section edited by S. Georgaras <sng@hellug.gr>
886     ifile1=`dirname "$ifile"`
887     if [ "$going2RAM" = "prog_only" ];then
888     whiptail --backtitle Clonezilla-SysRescCD --title ' Info ' --msgbox "The ISO file has been saved as $target_iso
889    
890     This ISO file contains the program and settings to restore your image
891     ($(basename ${ifile%/})), but not the image itself. Now you have to burn
892     the ISO file to a 8GB DVD and then add the image file to it.
893    
894     These are the commands to execute:
895     cd /home/partimag
896     growisofs -Z \$(what-cd -dwb)=$target_iso
897     eject \$(what-cd -dwb)
898     growisofs -M \$(what-cd -dwb) -R -J \\
899     -V \"$iso_label_tag\" --publisher \"$isoPublisher\" \\
900     -graft-points /$(basename ${ifile%/})/=${ifile%/}
901    
902     Alternatively, you can excute the file /tmp/burnISO
903    
904     NOTE: \$(what-cd -dwb) will use your first DVD-writer. In case you want
905     to use another device, you have to replace \$(what-cd -dwb) with
906     that device name e.g. /dev/hdd
907     " 0 0
908     fi
909    
910     echo "#!/bin/bash" > /tmp/burnISO
911     echo "eject \$(what-cd -dwb)" >> /tmp/burnISO
912     echo "echo -n \"Place an empty DVD in the DVD-writer and press ENTER \"" >> /tmp/burnISO
913     echo "read" >> /tmp/burnISO
914     echo "cd /home/partimag" >> /tmp/burnISO
915     echo "growisofs -Z \$(what-cd -dwb)=$target_iso" >> /tmp/burnISO
916     echo "eject \$(what-cd -dwb)" >> /tmp/burnISO
917     echo "echo \"The medium must now be ejected and reinserted into\"" >> /tmp/burnISO
918     echo "echo \"the DVD-writer for the burning process to continue\"" >> /tmp/burnISO
919     echo "echo -n \"Place reload the DVD in the DVD-writer and press ENTER \"" >> /tmp/burnISO
920     echo "read" >> /tmp/burnISO
921     echo "growisofs -M \$(what-cd -dwb) -R -J \\" >> /tmp/burnISO
922     echo "-V \"$iso_label_tag\" --publisher \"$isoPublisher\" \\" >> /tmp/burnISO
923     echo "-graft-points /$(basename ${ifile%/})/=${ifile%/}" >> /tmp/burnISO
924     chmod +x /tmp/burnISO
925    
926     ################################################################################

Properties

Name Value
svn:executable *

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26