--- trunk/create-clonezilla-sysresccd/files/ocs-iso 2010/05/25 13:31:38 59 +++ trunk/create-clonezilla-sysresccd/files/ocs-iso 2010/08/13 08:30:37 93 @@ -83,11 +83,20 @@ ################################################################################ # Section edited by S. Georgaras -# [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE -# echo "$ifile size ($size_t MB) is too large! $msg_mkisofs_unable_process_that" -# echo "$msg_unable_to_create_clonezilla_img_iso" -# [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL -# exit 1 +# [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING +# echo "$ifile size ($size_t MB) is too large! $msg_mkisofs_unable_process_that" +# [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL +# echo "$msg_are_u_sure_u_want_to_continue" +# echo -n "[y/N] " +# read cont_ans +# case "$cont_ans" in +# y|Y|[yY][eE][sS]) +# echo $msg_ok_let_do_it +# ;; +# *) +# echo "Abort!" +# exit 2 +# esac whiptail --backtitle Clonezilla-SysRescCD --title ' Excessive Image Size ' --yesno "The image file \"$(basename ${ifile%/})\" is too large ($size_t MB) and cannot be processed!!! Do you want to create a 8GB DVD instead?" 0 60 @@ -201,6 +210,13 @@ ;; -s|--skip-image) insert_mode="prog_only" + # + # Section inserted by S. Georgaras + # Variable to know that -s was actually used + # + ORIGINAL_INSERT_MODE='-o' + # + ################################################## shift ;; -t|--ocs-live-batch) ocs_live_batch="yes" @@ -454,32 +470,6 @@ fi # -if [ "$template_mode" = "from-booting-live-media" ]; then - # From boot media, DEBIAN_ISO_TMP is LIVE_MEDIA - # Here we use -Lks to make it more accurate. - template_iso_size="$(LC_ALL=C du -Lks $LIVE_MEDIA | awk -F" " '{print $1}')" - # Exclude those dirs - exclude_dir_size="0" - for i in $mkiso_exclude_list_2; do - [ ! -d "$LIVE_MEDIA/$i" ] && continue - exclude_dir_size="$(($exclude_dir_size + $(LC_ALL=C du -Lks "$LIVE_MEDIA/$i" | awk -F" " '{print $1}')))" - done - template_iso_size="$(LC_ALL=C echo "scale=0; ($template_iso_size - $exclude_dir_size)/1024" | bc -l)" # converted as MB. -else - # From iso file - # Here we use -Lks to make it more accurate. - template_iso_size="$(LC_ALL=C du -Lks $DEBIAN_ISO | awk -F" " '{print $1}')" - # Exclude those dirs - exclude_dir_size="0" - for i in $mkiso_exclude_list_2; do - [ ! -d "$DEBIAN_ISO/$i" ] && continue - exclude_dir_size="$(($exclude_dir_size + $(LC_ALL=C du -Lks "$DEBIAN_ISO/$i" | awk -F" " '{print $1}')))" - done - template_iso_size="$(LC_ALL=C echo "scale=0; ($template_iso_size - $exclude_dir_size)/1024" | bc -l)" # converted as MB. -fi -target_iso_size="$(($template_iso_size + $img_size_sum))" - -# # Possible kernel/initrd paths are /casper (created by casper) or /live (created by live-initramfs) # Find the kernel and initrd in $DEBIAN_ISO_TMP/casper or $DEBIAN_ISO_TMP/live # Ex: $DEBIAN_ISO_TMP/casper/vmlinuz1, /$DEBIAN_ISO_TMP/casper/initrd1.img @@ -514,6 +504,29 @@ exit 1 fi +if [ "$template_mode" = "from-booting-live-media" ]; then + # From boot media (clonezilla live), DEBIAN_ISO_TMP is LIVE_MEDIA + # The dirs/files in Clonezilla live: + # -r--r--r-- 1 root root 117 2010-05-21 21:17 Clonezilla-Live-Version + # -r--r--r-- 1 root root 18K 2010-05-21 21:05 COPYING + # dr-xr-xr-x 2 root root 2.0K 2010-05-21 21:17 isolinux/ + # dr-xr-xr-x 2 root root 2.0K 2010-05-21 21:17 live/ + # dr-xr-xr-x 2 root root 2.0K 2010-05-21 21:17 syslinux/ + # dr-xr-xr-x 5 root root 2.0K 2010-05-21 21:17 utils/ + # We need all of them. + 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}')" +else + # From iso file (debian-live-for-ocs.iso) + # The dirs/files in Debian live for OCS: + # dr-xr-xr-x 3 root root 4.0K 2010-05-28 18:03 doc/ + # dr-xr-xr-x 2 root root 4.0K 2010-05-28 18:03 isolinux/ + # dr-xr-xr-x 2 root root 2.0K 2010-05-28 18:03 live/ + # -r--r--r-- 1 root root 3.7K 2010-05-28 18:03 md5sum.txt + # We only need dirs isolinux and live only + template_iso_size="$(LC_ALL=C du -Lmsc $DEBIAN_ISO_TMP/{isolinux,$sys_files_dir} | tail -n 1 | awk -F" " '{print $1}')" +fi +target_iso_size="$(($template_iso_size + $img_size_sum))" + # BOOT_ITEM_DIR=$ISOSYSLNX_TMP/$sys_files_dir [ ! -d $BOOT_ITEM_DIR ] && mkdir $BOOT_ITEM_DIR @@ -687,7 +700,7 @@ fi # -echo "Preparing syslinux.exe, syslinux, makeboot.bat and makeboot.sh in dir utils... " +echo "Preparing syslinux, syslinux.exe, makeboot.sh, and makeboot.bat in dir utils... " # If it's in Clonezilla live environment, we have those files if [ -e "$LIVE_MEDIA/utils/linux/syslinux" -a \ -e "$LIVE_MEDIA/utils/mbr/mbr.bin" -a \ @@ -715,10 +728,14 @@ # If template_mode="from-booting-live-media", then there is /COPYING and /Clonezilla-Live-Version, then we should not assign that. doc_insert_in_root="" -if [ ! -e "$DEBIAN_ISO_TMP/COPYING" ]; then +if [ -e "$DEBIAN_ISO_TMP/COPYING" ]; then + doc_insert_in_root="/COPYING=$DEBIAN_ISO_TMP/COPYING" +else doc_insert_in_root="/COPYING=$DRBL_SCRIPT_PATH/doc/COPYING" fi -if [ ! -e "$DEBIAN_ISO_TMP/Clonezilla-Live-Version" ]; then +if [ -e "$DEBIAN_ISO_TMP/Clonezilla-Live-Version" ]; then + doc_insert_in_root="$doc_insert_in_root /Clonezilla-Live-Version=$DEBIAN_ISO_TMP/Clonezilla-Live-Version" +else doc_insert_in_root="$doc_insert_in_root /Clonezilla-Live-Version=$ISOSYSLNX_TMP/Clonezilla-Live-Version" fi @@ -739,7 +756,7 @@ -b isolinux/isolinux.bin -c isolinux/boot.cat \ -no-emul-boot -boot-load-size 4 -boot-info-table \ $mkiso_exclude_opt \ - -graft-points $DEBIAN_ISO_TMP \ + -graft-points \ $sys_files_dir_graft_point \ $utils_files_dir_graft_point \ $doc_insert_in_root \ @@ -749,20 +766,48 @@ " echo "DEBIAN_ISO_TMP=$DEBIAN_ISO_TMP" -echo "sys_files_dir_graft_point=$sys_files_dir_graft_point" -echo "utils_files_dir_graft_point=$utils_files_dir_graft_point" -echo "doc_insert_in_root=$doc_insert_in_root" -echo "ocs_imgs_with_abs_path=$ocs_imgs_with_abs_path" -echo "custom_ocs_opt=$custom_ocs_opt" -echo "include_dir_graft_point=$include_dir_graft_point" +echo "mkiso_exclude_opt = $mkiso_exclude_opt" +echo "allow_limited_size_opt = $allow_limited_size_opt" +echo "sys_files_dir_graft_point = $sys_files_dir_graft_point" +echo "utils_files_dir_graft_point = $utils_files_dir_graft_point" +echo "doc_insert_in_root = $doc_insert_in_root" +echo "ocs_imgs_with_abs_path = $ocs_imgs_with_abs_path" +echo "custom_ocs_opt = $custom_ocs_opt" +echo "include_dir_graft_point = $include_dir_graft_point" echo echo "ocs_image=$ocs_image" echo "image_path=$image_path" -#read +read -cust-menu -publisher "DRBL/Clonezilla http://drbl.name http://clonezilla.org" -V "$iso_label_tag" "$going2RAM" +# if [ -z "$ORIGINAL_INSERT_MODE" ];then +# A_LINE=`grep 'append initrd=/live/initrd.img'/tmp/ocs_isos*/isolinux/isolinux.cfg | sed '2,$d'` +# PARAM=`echo "$A_LINE" | sed 's/.*ocs_live_extra_param="\([^"]*\)".*/\1/'` +# KEYMAP=`echo "$A_LINE" | sed 's/.*ocs_live_keymap="\([^"]*\)".*/\1/'` +# LANG=`echo "$A_LINE" | sed 's/.*ocs_lang="\([^"]*\)".*/\1/'` +# if [ -z "$going2RAM" ];then +# #cp /restorecd/isolinux-restore-cd.cfg /tmp/ocs_isos*/isolinux/isolinux.cfg +# cfg_orig=/restorecd/isolinux-restore-cd.cfg +# else +# #cp /restorecd/isolinux-restore-cd-ram.cfg /tmp/ocs_isos*/isolinux/isolinux.cfg +# cfg_orig=/restorecd/isolinux-restore-cd-ram.cfg +# fi +# # replace with current values +# sed "s|ocs_live_extra_param=\"[^\"]*\"|ocs_live_extra_param=\"$PARAM\"| +# s|ocs_live_keymap=\"[^\"]*\"|ocs_live_keymap=\"$KEYMAP\"| +# s|ocs_lang=\"[^\"]*\"|ocs_lang=\"$LANG\"| +# " "$cfg_orig" > /tmp/ocs_isos*/isolinux/isolinux.cfg + cust-menu -publisher "DRBL/Clonezilla http://drbl.name http://clonezilla.org" -V "$iso_label_tag" "$ORIGINAL_INSERT_MODE" "$going2RAM" +# fi + +# Fix missing "boot=live" +for n in /tmp/ocs_isos*/isolinux/isolinux.cfg /tmp/ocs_isos*/syslinux/syslinux.cfg;do +if [ -e "$n" ];then +sed 's/boot=[^ ]* // +s{initrd=/live/initrd.img{initrd=/live/initrd.img boot=live {' "$n" > "$n".tmp && mv "$n".tmp "$n" +fi +done if [ -n "$going2RAM" ];then ocs_imgs_with_abs_path='' @@ -783,7 +828,7 @@ -b isolinux/isolinux.bin -c isolinux/boot.cat \ -no-emul-boot -boot-load-size 4 -boot-info-table \ $mkiso_exclude_opt \ - -graft-points $DEBIAN_ISO_TMP \ + -graft-points \ $sys_files_dir_graft_point \ $utils_files_dir_graft_point \ $doc_insert_in_root \