--- trunk/create-clonezilla-sysresccd/files/ocs-iso 2010/05/20 12:12:53 47 +++ trunk/create-clonezilla-sysresccd/files/ocs-iso 2010/05/25 13:31:38 59 @@ -23,7 +23,7 @@ # We will create it like this: # -x $DEBIAN_ISO_TMP/isolinux -x $DEBIAN_ISO_TMP/md5sum.txt -x $DEBIAN_ISO_TMP/casper/memtest # "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. -mkiso_exclude_list_1="isolinux md5sum.txt doc live etc pkg ocs-live.d utils" +mkiso_exclude_list_1="isolinux syslinux md5sum.txt doc live etc pkg ocs-live.d utils" mkiso_exclude_list_2="home" # This should not be a duplicated count. mkiso_exclude_list="$mkiso_exclude_list_1 $mkiso_exclude_list_2" @@ -77,7 +77,7 @@ check_file_size_in_ocs_image() { local img_path="$1" local size_t - for ifile in $img_path $img_path/*; do + for ifile in $img_path/*; do size_t="$(du -Lms $ifile | awk -F" " '{print $1}')" if [ "$size_t" -gt "$FILE_LIMIT" ]; then ################################################################################ @@ -103,9 +103,9 @@ # clean_tmp_dir() { - [ -d "$ISOLNX_TMP" -a -n "$ISOLNX_TMP" ] && rm -rf $ISOLNX_TMP - [ -d "$WD_TMP" -a -n "$WD_TMP" ] && rm -rf $WD_TMP - [ -d "$DEBIAN_ISO_TMP" ] && umount $DEBIAN_ISO_TMP &>/dev/null && rm -rf $DEBIAN_ISO_TMP + [ -d "$ISOSYSLNX_TMP" -a -n "$(echo $ISOSYSLNX_TMP | grep "ocs_isosyslnx")" ] && rm -rf $ISOSYSLNX_TMP + [ -d "$WD_TMP" -a -n "$(echo $WD_TMP | grep "ocs_iso_wd")" ] && rm -rf $WD_TMP + [ -d "$DEBIAN_ISO_TMP" ] && umount $DEBIAN_ISO_TMP &>/dev/null && rmdir $DEBIAN_ISO_TMP } # End of clean_tmp_dir # @@ -329,14 +329,14 @@ # Some temp dirs # 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. #if [ -w ./ ]; then -# ISOLNX_TMP="$(mktemp -d ./isolnx.XXXXXX)" +# ISOSYSLNX_TMP="$(mktemp -d ./isolnx.XXXXXX)" # WD_TMP="$(mktemp -d ./iso_wd.XXXXXX)" #else -# ISOLNX_TMP="$(mktemp -d /tmp/isolnx.XXXXXX)" +# ISOSYSLNX_TMP="$(mktemp -d /tmp/isolnx.XXXXXX)" # WD_TMP="$(mktemp -d /tmp/iso_wd.XXXXXX)" #fi -ISOLNX_TMP="$(mktemp -d /tmp/isolnx.XXXXXX)" -WD_TMP="$(mktemp -d /tmp/iso_wd.XXXXXX)" +ISOSYSLNX_TMP="$(mktemp -d /tmp/ocs_isosyslnx.XXXXXX)" +WD_TMP="$(mktemp -d /tmp/ocs_iso_wd.XXXXXX)" # trap clean_tmp_dir HUP INT QUIT TERM EXIT @@ -515,10 +515,10 @@ fi # -BOOT_ITEM_DIR=$ISOLNX_TMP/$sys_files_dir +BOOT_ITEM_DIR=$ISOSYSLNX_TMP/$sys_files_dir [ ! -d $BOOT_ITEM_DIR ] && mkdir $BOOT_ITEM_DIR echo -n "Copying the system files to working dir... This might take a few minutes... " -cp -af $DEBIAN_ISO_TMP/$sys_files_dir $ISOLNX_TMP/ +cp -af $DEBIAN_ISO_TMP/$sys_files_dir $ISOSYSLNX_TMP/ RC=$? if [ "$RC" -ne 0 ]; then [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE @@ -588,10 +588,13 @@ # Create the iso image file # isolinux should be rw, so we have to copy it, and exclude the one in iso image. -mkdir -p $ISOLNX_TMP/isolinux/ -# rsync -a --exclude f*.txt --exclude boot.cat --exclude isolinux.txt --exclude isolinux.bin --exclude splash.rle --exclude doc $DRBL_SCRIPT_PATH/pkg/syslinux/* $ISOLNX_TMP/isolinux/ +mkdir -p $ISOSYSLNX_TMP/isolinux/ $ISOSYSLNX_TMP/syslinux/ +# 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/ # we have to overwrite isolinux.bin since vesamenu.c32 should be same version with that. -cp -af $isolinux_file $pxelinux_simple_vesamenu $pxelinux_simple_menu $pxelinux_memdisk_file $pxelinux_bg_img $ocs_logo_img_syslinux $pxelinux_chain_file $ISOLNX_TMP/isolinux/ +# For isolinux +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/ +# For syslinux +cp -af $pxelinux_simple_vesamenu $pxelinux_simple_menu $pxelinux_memdisk_file $pxelinux_bg_img $ocs_logo_img_syslinux $pxelinux_chain_file $ISOSYSLNX_TMP/syslinux/ etherboot_zlilo="$($query_pkglist_cmd drbl-etherboot 2>/dev/null | grep -E "eb-.*-etherboot-pci.zlilo$")" # 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. @@ -672,9 +675,15 @@ # if [ -n "$ocs_image" ]; then - 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 noswap nolocales 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 $ISOLNX_TMP/isolinux/ -else - 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 noswap nolocales 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 $ISOLNX_TMP/isolinux/ + # For isolinux + 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/ + # For syslinux + 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/ +else + # For isolinux + 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/ + # For syslinux + 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/ fi # @@ -683,25 +692,25 @@ if [ -e "$LIVE_MEDIA/utils/linux/syslinux" -a \ -e "$LIVE_MEDIA/utils/mbr/mbr.bin" -a \ -e "$LIVE_MEDIA/utils/win32/syslinux.exe" ]; then - cp -rf $LIVE_MEDIA/utils $ISOLNX_TMP + cp -rf $LIVE_MEDIA/utils $ISOSYSLNX_TMP else - put_syslinux_makeboot_for_usb_flash $ISOLNX_TMP + put_syslinux_makeboot_for_usb_flash $ISOSYSLNX_TMP fi -if [ -d "$ISOLNX_TMP/utils" ]; then - utils_files_dir_graft_point="/utils/=$ISOLNX_TMP/utils/" +if [ -d "$ISOSYSLNX_TMP/utils" ]; then + utils_files_dir_graft_point="/utils/=$ISOSYSLNX_TMP/utils/" fi # put version tag # The content is like clonezilla-live-20070308 -echo "clonezilla-live-${iso_label_tag}" > $ISOLNX_TMP/Clonezilla-Live-Version -echo "This Clonezilla live iso file was created by this command:" >> $ISOLNX_TMP/Clonezilla-Live-Version -echo "$prog $prog_option" >> $ISOLNX_TMP/Clonezilla-Live-Version +echo "clonezilla-live-${iso_label_tag}" > $ISOSYSLNX_TMP/Clonezilla-Live-Version +echo "This Clonezilla live iso file was created by this command:" >> $ISOSYSLNX_TMP/Clonezilla-Live-Version +echo "$prog $prog_option" >> $ISOSYSLNX_TMP/Clonezilla-Live-Version # $sys_files_dir maybe /casper, /live or /isolinux. If it is isolinux, we can not list them twice otherwise mkisofs will go wrong. if [ "$sys_files_dir" != "isolinux" ]; then - sys_files_dir_graft_point="/isolinux/=$ISOLNX_TMP/isolinux/ /$sys_files_dir/=$ISOLNX_TMP/$sys_files_dir/" + sys_files_dir_graft_point="/isolinux/=$ISOSYSLNX_TMP/isolinux/ /syslinux/=$ISOSYSLNX_TMP/syslinux/ /$sys_files_dir/=$ISOSYSLNX_TMP/$sys_files_dir/" else - sys_files_dir_graft_point="/isolinux/=$ISOLNX_TMP/isolinux/" + sys_files_dir_graft_point="/isolinux/=$ISOSYSLNX_TMP/isolinux/ /syslinux/=$ISOSYSLNX_TMP/syslinux/" fi # If template_mode="from-booting-live-media", then there is /COPYING and /Clonezilla-Live-Version, then we should not assign that. @@ -710,7 +719,7 @@ doc_insert_in_root="/COPYING=$DRBL_SCRIPT_PATH/doc/COPYING" fi if [ ! -e "$DEBIAN_ISO_TMP/Clonezilla-Live-Version" ]; then - doc_insert_in_root="$doc_insert_in_root /Clonezilla-Live-Version=$ISOLNX_TMP/Clonezilla-Live-Version" + doc_insert_in_root="$doc_insert_in_root /Clonezilla-Live-Version=$ISOSYSLNX_TMP/Clonezilla-Live-Version" fi # @@ -799,12 +808,7 @@ [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE echo "Something went wrong!" [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL - umount $DEBIAN_ISO_TMP &>/dev/null - if [ ! -z "$DEBIAN_ISO_TMP" -a \ - "$template_mode" = "from-downloaded-live-media" ]; then - # We put some tmp file when template_mode is from-downloaded-live-media - rm -rf $DEBIAN_ISO_TMP - fi + clean_tmp_dir [ -n "$target_iso" -a -f "$target_iso" ] && rm -fv $target_iso [ -n "$ISOLNX_TMP" -a -d "$ISOLNX_TMP" ] && rm -rf $ISOLNX_TMP [ -n "$WD_TMP" -a -d "$WD_TMP" ] && rm -rf $WD_TMP @@ -817,13 +821,7 @@ # Clean the tmp working directory echo "Cleaning tmp dirs..." -if [ ! -z "$DEBIAN_ISO_TMP" -a \ - "$template_mode" = "from-downloaded-live-media" ]; then - # We put some tmp file when template_mode is from-downloaded-live-media - rm -rf $DEBIAN_ISO_TMP -fi -[ -n "$ISOLNX_TMP" -a -d "$ISOLNX_TMP" ] && rm -rf $ISOLNX_TMP -[ -n "$WD_TMP" -a -d "$WD_TMP" ] && rm -rf $WD_TMP +clean_tmp_dir # if [ -e "$target_iso" ]; then