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 |
for ifile in $img_path/*; do |
81 |
size_t="$(du -Lms $ifile | awk -F" " '{print $1}')" |
size_t="$(du -Lms $ifile | awk -F" " '{print $1}')" |
82 |
if [ "$size_t" -gt "$FILE_LIMIT" ]; then |
if [ "$size_t" -gt "$FILE_LIMIT" ]; then |
83 |
################################################################################ |
################################################################################ |
103 |
|
|
104 |
# |
# |
105 |
clean_tmp_dir() { |
clean_tmp_dir() { |
106 |
[ -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 |
107 |
[ -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 |
108 |
[ -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 |
109 |
} # End of clean_tmp_dir |
} # End of clean_tmp_dir |
110 |
|
|
111 |
# |
# |
329 |
# Some temp dirs |
# Some temp dirs |
330 |
# 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. |
331 |
#if [ -w ./ ]; then |
#if [ -w ./ ]; then |
332 |
# ISOLNX_TMP="$(mktemp -d ./isolnx.XXXXXX)" |
# ISOSYSLNX_TMP="$(mktemp -d ./isolnx.XXXXXX)" |
333 |
# WD_TMP="$(mktemp -d ./iso_wd.XXXXXX)" |
# WD_TMP="$(mktemp -d ./iso_wd.XXXXXX)" |
334 |
#else |
#else |
335 |
# ISOLNX_TMP="$(mktemp -d /tmp/isolnx.XXXXXX)" |
# ISOSYSLNX_TMP="$(mktemp -d /tmp/isolnx.XXXXXX)" |
336 |
# WD_TMP="$(mktemp -d /tmp/iso_wd.XXXXXX)" |
# WD_TMP="$(mktemp -d /tmp/iso_wd.XXXXXX)" |
337 |
#fi |
#fi |
338 |
ISOLNX_TMP="$(mktemp -d /tmp/isolnx.XXXXXX)" |
ISOSYSLNX_TMP="$(mktemp -d /tmp/ocs_isosyslnx.XXXXXX)" |
339 |
WD_TMP="$(mktemp -d /tmp/iso_wd.XXXXXX)" |
WD_TMP="$(mktemp -d /tmp/ocs_iso_wd.XXXXXX)" |
340 |
|
|
341 |
# |
# |
342 |
trap clean_tmp_dir HUP INT QUIT TERM EXIT |
trap clean_tmp_dir HUP INT QUIT TERM EXIT |
515 |
fi |
fi |
516 |
|
|
517 |
# |
# |
518 |
BOOT_ITEM_DIR=$ISOLNX_TMP/$sys_files_dir |
BOOT_ITEM_DIR=$ISOSYSLNX_TMP/$sys_files_dir |
519 |
[ ! -d $BOOT_ITEM_DIR ] && mkdir $BOOT_ITEM_DIR |
[ ! -d $BOOT_ITEM_DIR ] && mkdir $BOOT_ITEM_DIR |
520 |
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... " |
521 |
cp -af $DEBIAN_ISO_TMP/$sys_files_dir $ISOLNX_TMP/ |
cp -af $DEBIAN_ISO_TMP/$sys_files_dir $ISOSYSLNX_TMP/ |
522 |
RC=$? |
RC=$? |
523 |
if [ "$RC" -ne 0 ]; then |
if [ "$RC" -ne 0 ]; then |
524 |
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
588 |
|
|
589 |
# Create the iso image file |
# Create the iso image file |
590 |
# 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. |
591 |
mkdir -p $ISOLNX_TMP/isolinux/ |
mkdir -p $ISOSYSLNX_TMP/isolinux/ $ISOSYSLNX_TMP/syslinux/ |
592 |
# 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/ |
593 |
# 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. |
594 |
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 |
595 |
|
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/ |
596 |
|
# For syslinux |
597 |
|
cp -af $pxelinux_simple_vesamenu $pxelinux_simple_menu $pxelinux_memdisk_file $pxelinux_bg_img $ocs_logo_img_syslinux $pxelinux_chain_file $ISOSYSLNX_TMP/syslinux/ |
598 |
|
|
599 |
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$")" |
600 |
# 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. |
675 |
|
|
676 |
# |
# |
677 |
if [ -n "$ocs_image" ]; then |
if [ -n "$ocs_image" ]; then |
678 |
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 |
679 |
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 $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/ |
680 |
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 syslinux |
681 |
|
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/ |
682 |
|
else |
683 |
|
# For isolinux |
684 |
|
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/ |
685 |
|
# For syslinux |
686 |
|
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/ |
687 |
fi |
fi |
688 |
|
|
689 |
# |
# |
692 |
if [ -e "$LIVE_MEDIA/utils/linux/syslinux" -a \ |
if [ -e "$LIVE_MEDIA/utils/linux/syslinux" -a \ |
693 |
-e "$LIVE_MEDIA/utils/mbr/mbr.bin" -a \ |
-e "$LIVE_MEDIA/utils/mbr/mbr.bin" -a \ |
694 |
-e "$LIVE_MEDIA/utils/win32/syslinux.exe" ]; then |
-e "$LIVE_MEDIA/utils/win32/syslinux.exe" ]; then |
695 |
cp -rf $LIVE_MEDIA/utils $ISOLNX_TMP |
cp -rf $LIVE_MEDIA/utils $ISOSYSLNX_TMP |
696 |
else |
else |
697 |
put_syslinux_makeboot_for_usb_flash $ISOLNX_TMP |
put_syslinux_makeboot_for_usb_flash $ISOSYSLNX_TMP |
698 |
fi |
fi |
699 |
if [ -d "$ISOLNX_TMP/utils" ]; then |
if [ -d "$ISOSYSLNX_TMP/utils" ]; then |
700 |
utils_files_dir_graft_point="/utils/=$ISOLNX_TMP/utils/" |
utils_files_dir_graft_point="/utils/=$ISOSYSLNX_TMP/utils/" |
701 |
fi |
fi |
702 |
|
|
703 |
# put version tag |
# put version tag |
704 |
# The content is like clonezilla-live-20070308 |
# The content is like clonezilla-live-20070308 |
705 |
echo "clonezilla-live-${iso_label_tag}" > $ISOLNX_TMP/Clonezilla-Live-Version |
echo "clonezilla-live-${iso_label_tag}" > $ISOSYSLNX_TMP/Clonezilla-Live-Version |
706 |
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 |
707 |
echo "$prog $prog_option" >> $ISOLNX_TMP/Clonezilla-Live-Version |
echo "$prog $prog_option" >> $ISOSYSLNX_TMP/Clonezilla-Live-Version |
708 |
|
|
709 |
# $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. |
710 |
if [ "$sys_files_dir" != "isolinux" ]; then |
if [ "$sys_files_dir" != "isolinux" ]; then |
711 |
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/" |
712 |
else |
else |
713 |
sys_files_dir_graft_point="/isolinux/=$ISOLNX_TMP/isolinux/" |
sys_files_dir_graft_point="/isolinux/=$ISOSYSLNX_TMP/isolinux/ /syslinux/=$ISOSYSLNX_TMP/syslinux/" |
714 |
fi |
fi |
715 |
|
|
716 |
# 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. |
719 |
doc_insert_in_root="/COPYING=$DRBL_SCRIPT_PATH/doc/COPYING" |
doc_insert_in_root="/COPYING=$DRBL_SCRIPT_PATH/doc/COPYING" |
720 |
fi |
fi |
721 |
if [ ! -e "$DEBIAN_ISO_TMP/Clonezilla-Live-Version" ]; then |
if [ ! -e "$DEBIAN_ISO_TMP/Clonezilla-Live-Version" ]; then |
722 |
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" |
723 |
fi |
fi |
724 |
|
|
725 |
# |
# |
808 |
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
[ "$BOOTUP" = "color" ] && $SETCOLOR_FAILURE |
809 |
echo "Something went wrong!" |
echo "Something went wrong!" |
810 |
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL |
811 |
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 |
|
812 |
[ -n "$target_iso" -a -f "$target_iso" ] && rm -fv $target_iso |
[ -n "$target_iso" -a -f "$target_iso" ] && rm -fv $target_iso |
813 |
[ -n "$ISOLNX_TMP" -a -d "$ISOLNX_TMP" ] && rm -rf $ISOLNX_TMP |
[ -n "$ISOLNX_TMP" -a -d "$ISOLNX_TMP" ] && rm -rf $ISOLNX_TMP |
814 |
[ -n "$WD_TMP" -a -d "$WD_TMP" ] && rm -rf $WD_TMP |
[ -n "$WD_TMP" -a -d "$WD_TMP" ] && rm -rf $WD_TMP |
821 |
|
|
822 |
# Clean the tmp working directory |
# Clean the tmp working directory |
823 |
echo "Cleaning tmp dirs..." |
echo "Cleaning tmp dirs..." |
824 |
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 |
|
825 |
|
|
826 |
# |
# |
827 |
if [ -e "$target_iso" ]; then |
if [ -e "$target_iso" ]; then |