83 |
################################################################################ |
################################################################################ |
84 |
# Section edited by S. Georgaras <sng@hellug.gr> |
# Section edited by S. Georgaras <sng@hellug.gr> |
85 |
|
|
86 |
# [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
# [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
87 |
# echo "$ifile size ($size_t MB) is too large! $msg_mkisofs_unable_process_that" |
# echo "$ifile size ($size_t MB) is too large! $msg_mkisofs_unable_process_that" |
88 |
# echo "$msg_unable_to_create_clonezilla_img_iso" |
# [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
89 |
# [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
# echo "$msg_are_u_sure_u_want_to_continue" |
90 |
# exit 1 |
# 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 |
whiptail --backtitle Clonezilla-SysRescCD --title ' Excessive Image Size ' --yesno "The image file \"$(basename ${ifile%/})\" is too large ($size_t MB) and cannot be processed!!! |
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 |
Do you want to create a 8GB DVD instead?" 0 60 |
210 |
;; |
;; |
211 |
-s|--skip-image) |
-s|--skip-image) |
212 |
insert_mode="prog_only" |
insert_mode="prog_only" |
213 |
|
# |
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 |
shift ;; |
shift ;; |
221 |
-t|--ocs-live-batch) |
-t|--ocs-live-batch) |
222 |
ocs_live_batch="yes" |
ocs_live_batch="yes" |
470 |
fi |
fi |
471 |
|
|
472 |
# |
# |
|
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))" |
|
|
|
|
|
# |
|
473 |
# Possible kernel/initrd paths are /casper (created by casper) or /live (created by live-initramfs) |
# 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 |
# 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 |
# Ex: $DEBIAN_ISO_TMP/casper/vmlinuz1, /$DEBIAN_ISO_TMP/casper/initrd1.img |
504 |
exit 1 |
exit 1 |
505 |
fi |
fi |
506 |
|
|
507 |
|
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 |
# |
# |
531 |
BOOT_ITEM_DIR=$ISOSYSLNX_TMP/$sys_files_dir |
BOOT_ITEM_DIR=$ISOSYSLNX_TMP/$sys_files_dir |
532 |
[ ! -d $BOOT_ITEM_DIR ] && mkdir $BOOT_ITEM_DIR |
[ ! -d $BOOT_ITEM_DIR ] && mkdir $BOOT_ITEM_DIR |
700 |
fi |
fi |
701 |
|
|
702 |
# |
# |
703 |
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... " |
704 |
# If it's in Clonezilla live environment, we have those files |
# If it's in Clonezilla live environment, we have those files |
705 |
if [ -e "$LIVE_MEDIA/utils/linux/syslinux" -a \ |
if [ -e "$LIVE_MEDIA/utils/linux/syslinux" -a \ |
706 |
-e "$LIVE_MEDIA/utils/mbr/mbr.bin" -a \ |
-e "$LIVE_MEDIA/utils/mbr/mbr.bin" -a \ |
728 |
|
|
729 |
# If template_mode="from-booting-live-media", then there is /COPYING and /Clonezilla-Live-Version, then we should not assign that. |
# 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="" |
doc_insert_in_root="" |
731 |
if [ ! -e "$DEBIAN_ISO_TMP/COPYING" ]; then |
if [ -e "$DEBIAN_ISO_TMP/COPYING" ]; then |
732 |
|
doc_insert_in_root="/COPYING=$DEBIAN_ISO_TMP/COPYING" |
733 |
|
else |
734 |
doc_insert_in_root="/COPYING=$DRBL_SCRIPT_PATH/doc/COPYING" |
doc_insert_in_root="/COPYING=$DRBL_SCRIPT_PATH/doc/COPYING" |
735 |
fi |
fi |
736 |
if [ ! -e "$DEBIAN_ISO_TMP/Clonezilla-Live-Version" ]; then |
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 |
doc_insert_in_root="$doc_insert_in_root /Clonezilla-Live-Version=$ISOSYSLNX_TMP/Clonezilla-Live-Version" |
doc_insert_in_root="$doc_insert_in_root /Clonezilla-Live-Version=$ISOSYSLNX_TMP/Clonezilla-Live-Version" |
740 |
fi |
fi |
741 |
|
|
756 |
-b isolinux/isolinux.bin -c isolinux/boot.cat \ |
-b isolinux/isolinux.bin -c isolinux/boot.cat \ |
757 |
-no-emul-boot -boot-load-size 4 -boot-info-table \ |
-no-emul-boot -boot-load-size 4 -boot-info-table \ |
758 |
$mkiso_exclude_opt \ |
$mkiso_exclude_opt \ |
759 |
-graft-points $DEBIAN_ISO_TMP \ |
-graft-points \ |
760 |
$sys_files_dir_graft_point \ |
$sys_files_dir_graft_point \ |
761 |
$utils_files_dir_graft_point \ |
$utils_files_dir_graft_point \ |
762 |
$doc_insert_in_root \ |
$doc_insert_in_root \ |
766 |
" |
" |
767 |
|
|
768 |
echo "DEBIAN_ISO_TMP=$DEBIAN_ISO_TMP" |
echo "DEBIAN_ISO_TMP=$DEBIAN_ISO_TMP" |
769 |
echo "sys_files_dir_graft_point=$sys_files_dir_graft_point" |
echo "mkiso_exclude_opt = $mkiso_exclude_opt" |
770 |
echo "utils_files_dir_graft_point=$utils_files_dir_graft_point" |
echo "allow_limited_size_opt = $allow_limited_size_opt" |
771 |
echo "doc_insert_in_root=$doc_insert_in_root" |
echo "sys_files_dir_graft_point = $sys_files_dir_graft_point" |
772 |
echo "ocs_imgs_with_abs_path=$ocs_imgs_with_abs_path" |
echo "utils_files_dir_graft_point = $utils_files_dir_graft_point" |
773 |
echo "custom_ocs_opt=$custom_ocs_opt" |
echo "doc_insert_in_root = $doc_insert_in_root" |
774 |
echo "include_dir_graft_point=$include_dir_graft_point" |
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 |
echo |
echo |
778 |
echo "ocs_image=$ocs_image" |
echo "ocs_image=$ocs_image" |
779 |
echo "image_path=$image_path" |
echo "image_path=$image_path" |
780 |
|
|
781 |
#read |
read |
782 |
|
|
783 |
cust-menu -publisher "DRBL/Clonezilla http://drbl.name http://clonezilla.org" -V "$iso_label_tag" "$going2RAM" |
# 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 |
|
|
801 |
|
cust-menu -publisher "DRBL/Clonezilla http://drbl.name http://clonezilla.org" -V "$iso_label_tag" "$ORIGINAL_INSERT_MODE" "$going2RAM" |
802 |
|
# fi |
803 |
|
|
804 |
|
# 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 |
if [ -n "$going2RAM" ];then |
if [ -n "$going2RAM" ];then |
813 |
ocs_imgs_with_abs_path='' |
ocs_imgs_with_abs_path='' |
828 |
-b isolinux/isolinux.bin -c isolinux/boot.cat \ |
-b isolinux/isolinux.bin -c isolinux/boot.cat \ |
829 |
-no-emul-boot -boot-load-size 4 -boot-info-table \ |
-no-emul-boot -boot-load-size 4 -boot-info-table \ |
830 |
$mkiso_exclude_opt \ |
$mkiso_exclude_opt \ |
831 |
-graft-points $DEBIAN_ISO_TMP \ |
-graft-points \ |
832 |
$sys_files_dir_graft_point \ |
$sys_files_dir_graft_point \ |
833 |
$utils_files_dir_graft_point \ |
$utils_files_dir_graft_point \ |
834 |
$doc_insert_in_root \ |
$doc_insert_in_root \ |