23 |
# We will create it like this: |
# We will create it like this: |
24 |
# -x $DEBIAN_ISO_TMP/isolinux -x $DEBIAN_ISO_TMP/md5sum.txt -x $DEBIAN_ISO_TMP/casper/memtest |
# -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. |
# "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 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" |
27 |
mkiso_exclude_list_2="home" # This should not be a duplicated count. |
mkiso_exclude_list_2="home" # This should not be a duplicated count. |
28 |
mkiso_exclude_list="$mkiso_exclude_list_1 $mkiso_exclude_list_2" |
mkiso_exclude_list="$mkiso_exclude_list_1 $mkiso_exclude_list_2" |
29 |
|
|
77 |
check_file_size_in_ocs_image() { |
check_file_size_in_ocs_image() { |
78 |
local img_path="$1" |
local img_path="$1" |
79 |
local size_t |
local size_t |
80 |
for ifile in $img_path $img_path/*; do |
local size_t_tot=0 |
81 |
|
for ifile in $img_path/*; do |
82 |
size_t="$(du -Lms $ifile | awk -F" " '{print $1}')" |
size_t="$(du -Lms $ifile | awk -F" " '{print $1}')" |
83 |
if [ "$size_t" -gt "$FILE_LIMIT" ]; then |
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> |
# Section edited by S. Georgaras <sng@hellug.gr> |
88 |
|
|
89 |
# [ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
# [ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING |
90 |
# 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" |
91 |
# echo "$msg_unable_to_create_clonezilla_img_iso" |
# [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
92 |
# [ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
# echo "$msg_are_u_sure_u_want_to_continue" |
93 |
# exit 1 |
# echo -n "[y/N] " |
94 |
whiptail --backtitle Clonezilla-SysRescCD --title ' Excessive Image Size ' --yesno "The image file \"$(basename ${ifile%/})\" is too large ($size_t MB) and cannot be processed!!! |
# 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 |
Do you want to create a 8GB DVD instead?" 0 60 |
$msg_are_u_sure_u_want_to_continue" 0 60 |
107 |
if [ $? -eq 1 ];then |
if [ $? -eq 1 ];then |
108 |
exit 1 |
exit 1 |
109 |
fi |
fi |
110 |
going2RAM="prog_only" |
# going2RAM="prog_only" |
111 |
break |
break |
|
################################################################################ |
|
112 |
fi |
fi |
113 |
done |
# done |
114 |
|
################################################################################ |
115 |
} |
} |
116 |
|
|
117 |
# |
# |
118 |
clean_tmp_dir() { |
clean_tmp_dir() { |
119 |
[ -d "$ISOLNX_TMP" -a -n "$ISOLNX_TMP" ] && rm -rf $ISOLNX_TMP |
[ -d "$ISOSYSLNX_TMP" -a -n "$(echo $ISOSYSLNX_TMP | grep "ocs_isosyslnx")" ] && rm -rf $ISOSYSLNX_TMP |
120 |
[ -d "$WD_TMP" -a -n "$WD_TMP" ] && rm -rf $WD_TMP |
[ -d "$WD_TMP" -a -n "$(echo $WD_TMP | grep "ocs_iso_wd")" ] && rm -rf $WD_TMP |
121 |
[ -d "$DEBIAN_ISO_TMP" ] && umount $DEBIAN_ISO_TMP &>/dev/null && rm -rf $DEBIAN_ISO_TMP |
[ -d "$DEBIAN_ISO_TMP" ] && umount $DEBIAN_ISO_TMP &>/dev/null && rmdir $DEBIAN_ISO_TMP |
122 |
} # End of clean_tmp_dir |
} # End of clean_tmp_dir |
123 |
|
|
124 |
# |
# |
214 |
;; |
;; |
215 |
-s|--skip-image) |
-s|--skip-image) |
216 |
insert_mode="prog_only" |
insert_mode="prog_only" |
217 |
|
# |
218 |
|
# Section inserted by S. Georgaras <sng@hellug.gr> |
219 |
|
# Variable to know that -s was actually used |
220 |
|
# |
221 |
|
ORIGINAL_INSERT_MODE='-o' |
222 |
|
# |
223 |
|
################################################## |
224 |
shift ;; |
shift ;; |
225 |
-t|--ocs-live-batch) |
-t|--ocs-live-batch) |
226 |
ocs_live_batch="yes" |
ocs_live_batch="yes" |
349 |
# Some temp dirs |
# Some temp dirs |
350 |
# 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. |
# 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. |
351 |
#if [ -w ./ ]; then |
#if [ -w ./ ]; then |
352 |
# ISOLNX_TMP="$(mktemp -d ./isolnx.XXXXXX)" |
# ISOSYSLNX_TMP="$(mktemp -d ./isolnx.XXXXXX)" |
353 |
# WD_TMP="$(mktemp -d ./iso_wd.XXXXXX)" |
# WD_TMP="$(mktemp -d ./iso_wd.XXXXXX)" |
354 |
#else |
#else |
355 |
# ISOLNX_TMP="$(mktemp -d /tmp/isolnx.XXXXXX)" |
# ISOSYSLNX_TMP="$(mktemp -d /tmp/isolnx.XXXXXX)" |
356 |
# WD_TMP="$(mktemp -d /tmp/iso_wd.XXXXXX)" |
# WD_TMP="$(mktemp -d /tmp/iso_wd.XXXXXX)" |
357 |
#fi |
#fi |
358 |
ISOLNX_TMP="$(mktemp -d /tmp/isolnx.XXXXXX)" |
ISOSYSLNX_TMP="$(mktemp -d /tmp/ocs_isosyslnx.XXXXXX)" |
359 |
WD_TMP="$(mktemp -d /tmp/iso_wd.XXXXXX)" |
WD_TMP="$(mktemp -d /tmp/ocs_iso_wd.XXXXXX)" |
360 |
|
|
361 |
# |
# |
362 |
trap clean_tmp_dir HUP INT QUIT TERM EXIT |
trap clean_tmp_dir HUP INT QUIT TERM EXIT |
474 |
fi |
fi |
475 |
|
|
476 |
# |
# |
|
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))" |
|
|
|
|
|
# |
|
477 |
# 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) |
478 |
# 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 |
479 |
# Ex: $DEBIAN_ISO_TMP/casper/vmlinuz1, /$DEBIAN_ISO_TMP/casper/initrd1.img |
# Ex: $DEBIAN_ISO_TMP/casper/vmlinuz1, /$DEBIAN_ISO_TMP/casper/initrd1.img |
508 |
exit 1 |
exit 1 |
509 |
fi |
fi |
510 |
|
|
511 |
|
if [ "$template_mode" = "from-booting-live-media" ]; then |
512 |
|
# From boot media (clonezilla live), DEBIAN_ISO_TMP is LIVE_MEDIA |
513 |
|
# The dirs/files in Clonezilla live: |
514 |
|
# -r--r--r-- 1 root root 117 2010-05-21 21:17 Clonezilla-Live-Version |
515 |
|
# -r--r--r-- 1 root root 18K 2010-05-21 21:05 COPYING |
516 |
|
# dr-xr-xr-x 2 root root 2.0K 2010-05-21 21:17 isolinux/ |
517 |
|
# dr-xr-xr-x 2 root root 2.0K 2010-05-21 21:17 live/ |
518 |
|
# dr-xr-xr-x 2 root root 2.0K 2010-05-21 21:17 syslinux/ |
519 |
|
# dr-xr-xr-x 5 root root 2.0K 2010-05-21 21:17 utils/ |
520 |
|
# We need all of them. |
521 |
|
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}')" |
522 |
|
else |
523 |
|
# From iso file (debian-live-for-ocs.iso) |
524 |
|
# The dirs/files in Debian live for OCS: |
525 |
|
# dr-xr-xr-x 3 root root 4.0K 2010-05-28 18:03 doc/ |
526 |
|
# dr-xr-xr-x 2 root root 4.0K 2010-05-28 18:03 isolinux/ |
527 |
|
# dr-xr-xr-x 2 root root 2.0K 2010-05-28 18:03 live/ |
528 |
|
# -r--r--r-- 1 root root 3.7K 2010-05-28 18:03 md5sum.txt |
529 |
|
# We only need dirs isolinux and live only |
530 |
|
template_iso_size="$(LC_ALL=C du -Lmsc $DEBIAN_ISO_TMP/{isolinux,$sys_files_dir} | tail -n 1 | awk -F" " '{print $1}')" |
531 |
|
fi |
532 |
|
target_iso_size="$(($template_iso_size + $img_size_sum))" |
533 |
|
|
534 |
# |
# |
535 |
BOOT_ITEM_DIR=$ISOLNX_TMP/$sys_files_dir |
BOOT_ITEM_DIR=$ISOSYSLNX_TMP/$sys_files_dir |
536 |
[ ! -d $BOOT_ITEM_DIR ] && mkdir $BOOT_ITEM_DIR |
[ ! -d $BOOT_ITEM_DIR ] && mkdir $BOOT_ITEM_DIR |
537 |
echo -n "Copying the system files to working dir... This might take a few minutes... " |
echo -n "Copying the system files to working dir... This might take a few minutes... " |
538 |
cp -af $DEBIAN_ISO_TMP/$sys_files_dir $ISOLNX_TMP/ |
cp -af $DEBIAN_ISO_TMP/$sys_files_dir $ISOSYSLNX_TMP/ |
539 |
RC=$? |
RC=$? |
540 |
if [ "$RC" -ne 0 ]; then |
if [ "$RC" -ne 0 ]; then |
541 |
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
605 |
|
|
606 |
# Create the iso image file |
# Create the iso image file |
607 |
# isolinux should be rw, so we have to copy it, and exclude the one in iso image. |
# isolinux should be rw, so we have to copy it, and exclude the one in iso image. |
608 |
mkdir -p $ISOLNX_TMP/isolinux/ |
mkdir -p $ISOSYSLNX_TMP/isolinux/ $ISOSYSLNX_TMP/syslinux/ |
609 |
# 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/ |
# 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/ |
610 |
# we have to overwrite isolinux.bin since vesamenu.c32 should be same version with that. |
# we have to overwrite isolinux.bin since vesamenu.c32 should be same version with that. |
611 |
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 |
612 |
|
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/ |
613 |
|
# For syslinux |
614 |
|
cp -af $pxelinux_simple_vesamenu $pxelinux_simple_menu $pxelinux_memdisk_file $pxelinux_bg_img $ocs_logo_img_syslinux $pxelinux_chain_file $ISOSYSLNX_TMP/syslinux/ |
615 |
|
|
616 |
etherboot_zlilo="$($query_pkglist_cmd drbl-etherboot 2>/dev/null | grep -E "eb-.*-etherboot-pci.zlilo$")" |
etherboot_zlilo="$($query_pkglist_cmd drbl-etherboot 2>/dev/null | grep -E "eb-.*-etherboot-pci.zlilo$")" |
617 |
# 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. |
# 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. |
692 |
|
|
693 |
# |
# |
694 |
if [ -n "$ocs_image" ]; then |
if [ -n "$ocs_image" ]; then |
695 |
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/ |
# For isolinux |
696 |
|
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/ |
697 |
|
# For syslinux |
698 |
|
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/ |
699 |
else |
else |
700 |
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 |
701 |
|
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/ |
702 |
|
# For syslinux |
703 |
|
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/ |
704 |
fi |
fi |
705 |
|
|
706 |
# |
# |
707 |
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... " |
708 |
# If it's in Clonezilla live environment, we have those files |
# If it's in Clonezilla live environment, we have those files |
709 |
if [ -e "$LIVE_MEDIA/utils/linux/syslinux" -a \ |
if [ -e "$LIVE_MEDIA/utils/linux/syslinux" -a \ |
710 |
-e "$LIVE_MEDIA/utils/mbr/mbr.bin" -a \ |
-e "$LIVE_MEDIA/utils/mbr/mbr.bin" -a \ |
711 |
-e "$LIVE_MEDIA/utils/win32/syslinux.exe" ]; then |
-e "$LIVE_MEDIA/utils/win32/syslinux.exe" ]; then |
712 |
cp -rf $LIVE_MEDIA/utils $ISOLNX_TMP |
cp -rf $LIVE_MEDIA/utils $ISOSYSLNX_TMP |
713 |
else |
else |
714 |
put_syslinux_makeboot_for_usb_flash $ISOLNX_TMP |
put_syslinux_makeboot_for_usb_flash $ISOSYSLNX_TMP |
715 |
fi |
fi |
716 |
if [ -d "$ISOLNX_TMP/utils" ]; then |
if [ -d "$ISOSYSLNX_TMP/utils" ]; then |
717 |
utils_files_dir_graft_point="/utils/=$ISOLNX_TMP/utils/" |
utils_files_dir_graft_point="/utils/=$ISOSYSLNX_TMP/utils/" |
718 |
fi |
fi |
719 |
|
|
720 |
# put version tag |
# put version tag |
721 |
# The content is like clonezilla-live-20070308 |
# The content is like clonezilla-live-20070308 |
722 |
echo "clonezilla-live-${iso_label_tag}" > $ISOLNX_TMP/Clonezilla-Live-Version |
echo "clonezilla-live-${iso_label_tag}" > $ISOSYSLNX_TMP/Clonezilla-Live-Version |
723 |
echo "This Clonezilla live iso file was created by this command:" >> $ISOLNX_TMP/Clonezilla-Live-Version |
echo "This Clonezilla live iso file was created by this command:" >> $ISOSYSLNX_TMP/Clonezilla-Live-Version |
724 |
echo "$prog $prog_option" >> $ISOLNX_TMP/Clonezilla-Live-Version |
echo "$prog $prog_option" >> $ISOSYSLNX_TMP/Clonezilla-Live-Version |
725 |
|
|
726 |
# $sys_files_dir maybe /casper, /live or /isolinux. If it is isolinux, we can not list them twice otherwise mkisofs will go wrong. |
# $sys_files_dir maybe /casper, /live or /isolinux. If it is isolinux, we can not list them twice otherwise mkisofs will go wrong. |
727 |
if [ "$sys_files_dir" != "isolinux" ]; then |
if [ "$sys_files_dir" != "isolinux" ]; then |
728 |
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/" |
729 |
else |
else |
730 |
sys_files_dir_graft_point="/isolinux/=$ISOLNX_TMP/isolinux/" |
sys_files_dir_graft_point="/isolinux/=$ISOSYSLNX_TMP/isolinux/ /syslinux/=$ISOSYSLNX_TMP/syslinux/" |
731 |
fi |
fi |
732 |
|
|
733 |
# 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. |
734 |
doc_insert_in_root="" |
doc_insert_in_root="" |
735 |
if [ ! -e "$DEBIAN_ISO_TMP/COPYING" ]; then |
if [ -e "$DEBIAN_ISO_TMP/COPYING" ]; then |
736 |
|
doc_insert_in_root="/COPYING=$DEBIAN_ISO_TMP/COPYING" |
737 |
|
else |
738 |
doc_insert_in_root="/COPYING=$DRBL_SCRIPT_PATH/doc/COPYING" |
doc_insert_in_root="/COPYING=$DRBL_SCRIPT_PATH/doc/COPYING" |
739 |
fi |
fi |
740 |
if [ ! -e "$DEBIAN_ISO_TMP/Clonezilla-Live-Version" ]; then |
if [ -e "$DEBIAN_ISO_TMP/Clonezilla-Live-Version" ]; then |
741 |
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=$DEBIAN_ISO_TMP/Clonezilla-Live-Version" |
742 |
|
else |
743 |
|
doc_insert_in_root="$doc_insert_in_root /Clonezilla-Live-Version=$ISOSYSLNX_TMP/Clonezilla-Live-Version" |
744 |
fi |
fi |
745 |
|
|
746 |
# |
# |
760 |
-b isolinux/isolinux.bin -c isolinux/boot.cat \ |
-b isolinux/isolinux.bin -c isolinux/boot.cat \ |
761 |
-no-emul-boot -boot-load-size 4 -boot-info-table \ |
-no-emul-boot -boot-load-size 4 -boot-info-table \ |
762 |
$mkiso_exclude_opt \ |
$mkiso_exclude_opt \ |
763 |
-graft-points $DEBIAN_ISO_TMP \ |
-graft-points \ |
764 |
$sys_files_dir_graft_point \ |
$sys_files_dir_graft_point \ |
765 |
$utils_files_dir_graft_point \ |
$utils_files_dir_graft_point \ |
766 |
$doc_insert_in_root \ |
$doc_insert_in_root \ |
770 |
" |
" |
771 |
|
|
772 |
echo "DEBIAN_ISO_TMP=$DEBIAN_ISO_TMP" |
echo "DEBIAN_ISO_TMP=$DEBIAN_ISO_TMP" |
773 |
echo "sys_files_dir_graft_point=$sys_files_dir_graft_point" |
echo "mkiso_exclude_opt = $mkiso_exclude_opt" |
774 |
echo "utils_files_dir_graft_point=$utils_files_dir_graft_point" |
echo "allow_limited_size_opt = $allow_limited_size_opt" |
775 |
echo "doc_insert_in_root=$doc_insert_in_root" |
echo "sys_files_dir_graft_point = $sys_files_dir_graft_point" |
776 |
echo "ocs_imgs_with_abs_path=$ocs_imgs_with_abs_path" |
echo "utils_files_dir_graft_point = $utils_files_dir_graft_point" |
777 |
echo "custom_ocs_opt=$custom_ocs_opt" |
echo "doc_insert_in_root = $doc_insert_in_root" |
778 |
echo "include_dir_graft_point=$include_dir_graft_point" |
echo "ocs_imgs_with_abs_path = $ocs_imgs_with_abs_path" |
779 |
|
echo "custom_ocs_opt = $custom_ocs_opt" |
780 |
|
echo "include_dir_graft_point = $include_dir_graft_point" |
781 |
echo |
echo |
782 |
echo "ocs_image=$ocs_image" |
echo "ocs_image=$ocs_image" |
783 |
echo "image_path=$image_path" |
echo "image_path=$image_path" |
784 |
|
|
785 |
#read |
read |
786 |
|
|
787 |
cust-menu -publisher "DRBL/Clonezilla http://drbl.name http://clonezilla.org" -V "$iso_label_tag" "$going2RAM" |
# if [ -z "$ORIGINAL_INSERT_MODE" ];then |
788 |
|
# A_LINE=`grep 'append initrd=/live/initrd.img'/tmp/ocs_isos*/isolinux/isolinux.cfg | sed '2,$d'` |
789 |
|
# PARAM=`echo "$A_LINE" | sed 's/.*ocs_live_extra_param="\([^"]*\)".*/\1/'` |
790 |
|
# KEYMAP=`echo "$A_LINE" | sed 's/.*ocs_live_keymap="\([^"]*\)".*/\1/'` |
791 |
|
# LANG=`echo "$A_LINE" | sed 's/.*ocs_lang="\([^"]*\)".*/\1/'` |
792 |
|
# if [ -z "$going2RAM" ];then |
793 |
|
# #cp /restorecd/isolinux-restore-cd.cfg /tmp/ocs_isos*/isolinux/isolinux.cfg |
794 |
|
# cfg_orig=/restorecd/isolinux-restore-cd.cfg |
795 |
|
# else |
796 |
|
# #cp /restorecd/isolinux-restore-cd-ram.cfg /tmp/ocs_isos*/isolinux/isolinux.cfg |
797 |
|
# cfg_orig=/restorecd/isolinux-restore-cd-ram.cfg |
798 |
|
# fi |
799 |
|
# # replace with current values |
800 |
|
# sed "s|ocs_live_extra_param=\"[^\"]*\"|ocs_live_extra_param=\"$PARAM\"| |
801 |
|
# s|ocs_live_keymap=\"[^\"]*\"|ocs_live_keymap=\"$KEYMAP\"| |
802 |
|
# s|ocs_lang=\"[^\"]*\"|ocs_lang=\"$LANG\"| |
803 |
|
# " "$cfg_orig" > /tmp/ocs_isos*/isolinux/isolinux.cfg |
804 |
|
|
805 |
|
# cust-menu -publisher "DRBL/Clonezilla http://drbl.name http://clonezilla.org" -V "$iso_label_tag" "$ORIGINAL_INSERT_MODE" "$going2RAM" |
806 |
|
cust-menu -publisher "DRBL/Clonezilla http://drbl.name http://clonezilla.org" -V "$iso_label_tag" "$ORIGINAL_INSERT_MODE" |
807 |
|
# fi |
808 |
|
|
809 |
if [ -n "$going2RAM" ];then |
# Fix missing "boot=live" |
810 |
ocs_imgs_with_abs_path='' |
for n in /tmp/ocs_isos*/isolinux/isolinux.cfg /tmp/ocs_isos*/syslinux/syslinux.cfg;do |
811 |
|
if [ -e "$n" ];then |
812 |
|
sed 's/boot=[^ ]* // |
813 |
|
s{initrd=/live/initrd.img{initrd=/live/initrd.img boot=live {' "$n" > "$n".tmp && mv "$n".tmp "$n" |
814 |
fi |
fi |
815 |
|
done |
816 |
|
|
817 |
|
# if [ -n "$going2RAM" ];then |
818 |
|
# ocs_imgs_with_abs_path='' |
819 |
|
# fi |
820 |
|
|
821 |
if [ -e /tmp/isodata ];then |
if [ -e /tmp/isodata ];then |
822 |
iso_label_tag=`sed '2d' /tmp/isodata` |
iso_label_tag=`sed '2d' /tmp/isodata` |
833 |
-b isolinux/isolinux.bin -c isolinux/boot.cat \ |
-b isolinux/isolinux.bin -c isolinux/boot.cat \ |
834 |
-no-emul-boot -boot-load-size 4 -boot-info-table \ |
-no-emul-boot -boot-load-size 4 -boot-info-table \ |
835 |
$mkiso_exclude_opt \ |
$mkiso_exclude_opt \ |
836 |
-graft-points $DEBIAN_ISO_TMP \ |
-graft-points \ |
837 |
$sys_files_dir_graft_point \ |
$sys_files_dir_graft_point \ |
838 |
$utils_files_dir_graft_point \ |
$utils_files_dir_graft_point \ |
839 |
$doc_insert_in_root \ |
$doc_insert_in_root \ |
858 |
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
859 |
echo "Something went wrong!" |
echo "Something went wrong!" |
860 |
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
861 |
umount $DEBIAN_ISO_TMP &>/dev/null |
clean_tmp_dir |
|
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 |
|
862 |
[ -n "$target_iso" -a -f "$target_iso" ] && rm -fv $target_iso |
[ -n "$target_iso" -a -f "$target_iso" ] && rm -fv $target_iso |
863 |
[ -n "$ISOLNX_TMP" -a -d "$ISOLNX_TMP" ] && rm -rf $ISOLNX_TMP |
[ -n "$ISOLNX_TMP" -a -d "$ISOLNX_TMP" ] && rm -rf $ISOLNX_TMP |
864 |
[ -n "$WD_TMP" -a -d "$WD_TMP" ] && rm -rf $WD_TMP |
[ -n "$WD_TMP" -a -d "$WD_TMP" ] && rm -rf $WD_TMP |
871 |
|
|
872 |
# Clean the tmp working directory |
# Clean the tmp working directory |
873 |
echo "Cleaning tmp dirs..." |
echo "Cleaning tmp dirs..." |
874 |
if [ ! -z "$DEBIAN_ISO_TMP" -a \ |
clean_tmp_dir |
|
"$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 |
|
875 |
|
|
876 |
# |
# |
877 |
if [ -e "$target_iso" ]; then |
if [ -e "$target_iso" ]; then |
885 |
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
886 |
fi |
fi |
887 |
|
|
888 |
|
# |
889 |
################################################################################ |
# ################################################################################ |
890 |
# Section edited by S. Georgaras <sng@hellug.gr> |
# # Section edited by S. Georgaras <sng@hellug.gr> |
891 |
ifile1=`dirname "$ifile"` |
# ifile1=`dirname "$ifile"` |
892 |
if [ "$going2RAM" = "prog_only" ];then |
# if [ "$going2RAM" = "prog_only" ];then |
893 |
whiptail --backtitle Clonezilla-SysRescCD --title ' Info ' --msgbox "The ISO file has been saved as $target_iso |
# whiptail --backtitle Clonezilla-SysRescCD --title ' Info ' --msgbox "The ISO file has been saved as $target_iso |
894 |
|
# |
895 |
This ISO file contains the program and settings to restore your image |
# This ISO file contains the program and settings to restore your image |
896 |
($(basename ${ifile%/})), but not the image itself. Now you have to burn |
# ($(basename ${ifile%/})), but not the image itself. Now you have to burn |
897 |
the ISO file to a 8GB DVD and then add the image file to it. |
# the ISO file to a 8GB DVD and then add the image file to it. |
898 |
|
# |
899 |
These are the commands to execute: |
# These are the commands to execute: |
900 |
cd /home/partimag |
# cd /home/partimag |
901 |
growisofs -Z \$(what-cd -dwb)=$target_iso |
# growisofs -Z \$(what-cd -dwb)=$target_iso |
902 |
eject \$(what-cd -dwb) |
# eject \$(what-cd -dwb) |
903 |
growisofs -M \$(what-cd -dwb) -R -J \\ |
# growisofs -M \$(what-cd -dwb) -R -J \\ |
904 |
-V \"$iso_label_tag\" --publisher \"$isoPublisher\" \\ |
# -V \"$iso_label_tag\" --publisher \"$isoPublisher\" \\ |
905 |
-graft-points /$(basename ${ifile%/})/=${ifile%/} |
# -graft-points /$(basename ${ifile%/})/=${ifile%/} |
906 |
|
# |
907 |
Alternatively, you can excute the file /tmp/burnISO |
# Alternatively, you can excute the file /tmp/burnISO |
908 |
|
# |
909 |
NOTE: \$(what-cd -dwb) will use your first DVD-writer. In case you want |
# NOTE: \$(what-cd -dwb) will use your first DVD-writer. In case you want |
910 |
to use another device, you have to replace \$(what-cd -dwb) with |
# to use another device, you have to replace \$(what-cd -dwb) with |
911 |
that device name e.g. /dev/hdd |
# that device name e.g. /dev/hdd |
912 |
" 0 0 |
# " 0 0 |
913 |
fi |
# fi |
914 |
|
# |
915 |
echo "#!/bin/bash" > /tmp/burnISO |
# echo "#!/bin/bash" > /tmp/burnISO |
916 |
echo "eject \$(what-cd -dwb)" >> /tmp/burnISO |
# echo "eject \$(what-cd -dwb)" >> /tmp/burnISO |
917 |
echo "echo -n \"Place an empty DVD in the DVD-writer and press ENTER \"" >> /tmp/burnISO |
# echo "echo -n \"Place an empty DVD in the DVD-writer and press ENTER \"" >> /tmp/burnISO |
918 |
echo "read" >> /tmp/burnISO |
# echo "read" >> /tmp/burnISO |
919 |
echo "cd /home/partimag" >> /tmp/burnISO |
# echo "cd /home/partimag" >> /tmp/burnISO |
920 |
echo "growisofs -Z \$(what-cd -dwb)=$target_iso" >> /tmp/burnISO |
# echo "growisofs -Z \$(what-cd -dwb)=$target_iso" >> /tmp/burnISO |
921 |
echo "eject \$(what-cd -dwb)" >> /tmp/burnISO |
# echo "eject \$(what-cd -dwb)" >> /tmp/burnISO |
922 |
echo "echo \"The medium must now be ejected and reinserted into\"" >> /tmp/burnISO |
# echo "echo \"The medium must now be ejected and reinserted into\"" >> /tmp/burnISO |
923 |
echo "echo \"the DVD-writer for the burning process to continue\"" >> /tmp/burnISO |
# echo "echo \"the DVD-writer for the burning process to continue\"" >> /tmp/burnISO |
924 |
echo "echo -n \"Place reload the DVD in the DVD-writer and press ENTER \"" >> /tmp/burnISO |
# echo "echo -n \"Place reload the DVD in the DVD-writer and press ENTER \"" >> /tmp/burnISO |
925 |
echo "read" >> /tmp/burnISO |
# echo "read" >> /tmp/burnISO |
926 |
echo "growisofs -M \$(what-cd -dwb) -R -J \\" >> /tmp/burnISO |
# echo "growisofs -M \$(what-cd -dwb) -R -J \\" >> /tmp/burnISO |
927 |
echo "-V \"$iso_label_tag\" --publisher \"$isoPublisher\" \\" >> /tmp/burnISO |
# echo "-V \"$iso_label_tag\" --publisher \"$isoPublisher\" \\" >> /tmp/burnISO |
928 |
echo "-graft-points /$(basename ${ifile%/})/=${ifile%/}" >> /tmp/burnISO |
# echo "-graft-points /$(basename ${ifile%/})/=${ifile%/}" >> /tmp/burnISO |
929 |
chmod +x /tmp/burnISO |
# chmod +x /tmp/burnISO |
930 |
|
# |
931 |
################################################################################ |
# ################################################################################ |
932 |
|
# |