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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 176 - (show annotations)
Tue May 31 19:45:21 2011 UTC (10 years, 6 months ago) by sng
File size: 42224 byte(s)
- updating prerun scripts. Making them run once
- updating ocs-iso to 1.2.8-46
- minor create-clonezilla-sysresccd update

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

Properties

Name Value
svn:executable *

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26