1999668f287383b4d88cc8e7eba7389874a4b168
[catalyst.git] / targets / support / create-iso.sh
1 #!/bin/bash
2
3 . ${clst_sharedir}/targets/support/functions.sh
4 . ${clst_sharedir}/targets/support/filesystem-functions.sh
5
6 ## START RUNSCRIPT
7
8 # Check for our CD ISO creation tools
9 case ${clst_hostarch} in
10         mips)
11                 cdmaker="sgibootcd"
12                 cdmakerpkg="sys-boot/sgibootcd"
13                 ;;
14         *)
15                 cdmaker="mkisofs"
16                 cdmakerpkg="app-cdr/cdrtools"
17                 ;;
18 esac
19
20 [ ! -f /usr/bin/${cdmaker} ] \
21    && echo && echo && die \
22    "!!! /usr/bin/${cdmaker} is not found.  Have you merged ${cdmakerpkg}?" \
23    && echo && echo
24
25 # If not volume ID is set, make up a sensible default
26 if [ -z "${clst_iso_volume_id}" ]
27 then
28         case ${clst_livecd_type} in
29                 gentoo-*)
30                         case ${clst_hostarch} in
31                                 alpha)
32                                         clst_iso_volume_id="Gentoo Linux - Alpha"
33                                 ;;
34                                 amd64)
35                                         clst_iso_volume_id="Gentoo Linux - AMD64"
36                                 ;;
37                                 arm)
38                                         clst_iso_volume_id="Gentoo Linux - ARM"
39                                 ;;
40                                 hppa)
41                                         clst_iso_volume_id="Gentoo Linux - HPPA"
42                                 ;;
43                                 ia64)
44                                         clst_iso_volume_id="Gentoo Linux - IA64"
45                                 ;;
46                                 m68k)
47                                         clst_iso_volume_id="Gentoo Linux - M68K"
48                                 ;;
49                                 mips)
50                                         clst_iso_volume_id="Gentoo Linux - MIPS"
51                                 ;;
52                                 ppc)
53                                         clst_iso_volume_id="Gentoo Linux - PPC"
54                                 ;;
55                                 ppc64)
56                                         clst_iso_volume_id="Gentoo Linux - PPC64"
57                                 ;;
58                                 s390)
59                                         clst_iso_volume_id="Gentoo Linux - S390"
60                                 ;;
61                                 sh)
62                                         clst_iso_volume_id="Gentoo Linux - SH"
63                                 ;;
64                                 sparc*)
65                                         clst_iso_volume_id="Gentoo Linux - SPARC"
66                                 ;;
67                                 x86)
68                                         clst_iso_volume_id="Gentoo Linux - X86"
69                                 ;;
70                                 *)
71                                         clst_iso_volume_id="Catalyst LiveCD"
72                                 ;;
73                                 esac
74         esac
75 fi
76
77 # Here we actually create the ISO images for each architecture
78 case ${clst_hostarch} in
79         alpha)
80                 case ${clst_fstype} in
81                         zisofs)
82                                 echo "Running mkisofs to create iso image...."
83                                 echo "mkisofs -J -R -l -z -V \"${clst_iso_volume_id}\" -o \
84                                         ${1} ${clst_target_path}"
85                                 mkisofs -J -R -l -z -V "${clst_iso_volume_id}" -o ${1} \
86                                         ${clst_target_path}  || die "Cannot make ISO image"
87                         ;;
88                         *)
89                                 echo "Running mkisofs to create iso image...."
90                                 echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} \
91                                         ${clst_target_path}"
92                                 mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} \
93                                         ${clst_target_path} || die "Cannot make ISO image"
94                         ;;
95                 esac
96                 isomarkboot ${1} /boot/bootlx
97         ;;
98         arm)
99         ;;
100         hppa)
101                 case ${clst_fstype} in
102                         zisofs)
103                                 echo "Running mkisofs to create iso image...."
104                                 echo "mkisofs -J -R -l -z -V \"${clst_iso_volume_id}\" -o \
105                                         ${1} ${clst_target_path}"
106                                 mkisofs -J -R -l -z -V "${clst_iso_volume_id}" -o ${1} \
107                                         ${clst_target_path}  || die "Cannot make ISO image"
108                         ;;
109                         *)
110                                 echo "Running mkisofs to create iso image...."
111                                 echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} \
112                                         ${clst_target_path}"
113                                 mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} \
114                                         ${clst_target_path}  || die "Cannot make ISO image"
115                         ;;
116                 esac
117                 palo -f boot/palo.conf -C ${1}
118         ;;
119         ia64)
120                 if [ ! -e ${clst_target_path}/gentoo.efimg ]
121                 then
122                         iaSizeTemp=$(du -sk ${clst_target_path}/boot 2>/dev/null)
123                         iaSizeB=$(echo ${iaSizeTemp} | cut '-d ' -f1)
124                         iaSize=$((${iaSizeB}+32)) # Add slack
125
126                         dd if=/dev/zero of=${clst_target_path}/gentoo.efimg bs=1k \
127                                 count=${iaSize}
128                         mkdosfs -F 16 -n GENTOO ${clst_target_path}/gentoo.efimg
129
130                         mkdir ${clst_target_path}/gentoo.efimg.mountPoint
131                         mount -t vfat -o loop ${clst_target_path}/gentoo.efimg \
132                                 ${clst_target_path}/gentoo.efimg.mountPoint
133
134                         echo '>> Populating EFI image...'
135                         cp -pPRv ${clst_target_path}/boot/* \
136                                 ${clst_target_path}/gentoo.efimg.mountPoint
137
138                         umount ${clst_target_path}/gentoo.efimg.mountPoint
139                         rmdir ${clst_target_path}/gentoo.efimg.mountPoint
140                 else
141                         echo ">> Found populated EFI image at \
142                                 ${clst_target_path}/gentoo.efimg"
143                 fi
144                 echo '>> Removing /boot...'
145                 rm -rf ${clst_target_path}/boot
146
147                 echo '>> Generating ISO...'
148                 echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} -b \
149                         gentoo.efimg -c boot.cat -no-emul-boot ${clst_target_path}" 
150                 mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b gentoo.efimg -c \
151                         boot.cat -no-emul-boot \
152                         ${clst_target_path} || die "Cannot make ISO image" 
153         ;;
154         mips)
155                 case ${clst_fstype} in
156                         squashfs)
157                                 # $clst_target_path/[kernels|arcload] already exists, create loopback and sgibootcd
158                                 [ ! -d "${clst_target_path}/loopback" ] && mkdir ${clst_target_path}/loopback
159                                 [ ! -d "${clst_target_path}/sgibootcd" ] && mkdir ${clst_target_path}/sgibootcd
160
161                                 # Setup variables
162                                 [ -f "${clst_target_path}/livecd" ] && rm -f ${clst_target_path}/livecd
163                                 img="${clst_target_path}/loopback/image.squashfs"
164                                 knl="${clst_target_path}/kernels"
165                                 arc="${clst_target_path}/arcload"
166                                 cfg="${clst_target_path}/sgibootcd/sgibootcd.cfg"
167                                 echo "" > ${cfg}
168
169                                 # If the image file exists in $clst_target_path, move it to the loopback dir
170                                 [ -e "${clst_target_path}/image.squashfs" ] \
171                                         && mv -f ${clst_target_path}/image.squashfs ${clst_target_path}/loopback
172
173                                 # An sgibootcd config is essentially a collection of commandline params
174                                 # stored in a text file.  We could pass these on the command line, but it's
175                                 # far easier to generate a config file and pass it to sgibootcd versus using a
176                                 # ton of commandline params.
177                                 #
178                                 # f=    indicates files to go into DVH (disk volume header) in an SGI disklabel
179                                 #           format: f=</path/to/file>@<DVH name>
180                                 # p0=   the first partition holds the LiveCD rootfs image
181                                 #           format: p0=</path/to/image>
182                                 # p8=   the eighth partition is the DVH partition
183                                 # p10=  the tenth partition is the disk volume partition
184                                 #           format: p8= is always "#dvh" and p10= is always "#volume"
185
186                                 # Add the kernels to the sgibootcd config
187                                 for x in ${clst_boot_kernel}; do
188                                         echo -e "f=${knl}/${x}@${x}" >> ${cfg}
189                                 done
190
191                                 # Next, the bootloader binaries and config
192                                 echo -e "f=${arc}/sash64@sash64" >> ${cfg}
193                                 echo -e "f=${arc}/sashARCS@sashARCS" >> ${cfg}
194                                 echo -e "f=${arc}/arc.cf@arc.cf" >> ${cfg}
195
196                                 # Next, the Loopback Image
197                                 echo -e "p0=${img}" >> ${cfg}
198
199                                 # Finally, the required SGI Partitions (dvh, volume)
200                                 echo -e "p8=#dvh" >> ${cfg}
201                                 echo -e "p10=#volume" >> ${cfg}
202
203                                 # All done; feed the config to sgibootcd and end up with an image
204                                 # c=    the config file
205                                 # o=    output image (burnable to CD; readable by fdisk)
206                                 /usr/bin/sgibootcd c=${cfg} o=${clst_iso}
207                         ;;
208                         *) die "SGI LiveCDs only support the 'normal' fstype!"  ;;
209                 esac
210         ;;
211         ppc)
212                 case ${clst_fstype} in
213                         zisofs)
214                                 echo "Running mkisofs to create iso image...."
215                                 echo "mkisofs -J -r -l -z -chrp-boot -netatalk -hfs -probe \
216                                         -map ${clst_target_path}boot/map.hfs -part -no-desktop \
217                                         -hfs-volid \"${clst_iso_volume_id}\" -hfs-bless \
218                                         ${clst_target_path}boot -V \"${clst_iso_volume_id}\" -o \
219                                         ${1} ${clst_target_path}"
220                                 mkisofs -J -r -l -z -chrp-boot -netatalk -hfs -probe -map \
221                                         ${clst_target_path}boot/map.hfs -part -no-desktop \
222                                         -hfs-volid "${clst_iso_volume_id}" -hfs-bless \
223                                         ${clst_target_path}boot -V "${clst_iso_volume_id}" -o \
224                                         ${1} ${clst_target_path} || die "Cannot make ISO image"
225                         ;;
226                         *)
227                                 echo "Running mkisofs to create iso image...."
228                                 echo "mkisofs -J -r -l -chrp-boot -netatalk -hfs -probe -map \
229                                         ${clst_target_path}boot/map.hfs -part -no-desktop \
230                                         -hfs-volid \"${clst_iso_volume_id}\" -hfs-bless \
231                                         ${clst_target_path}boot -V \"${clst_iso_volume_id}\" -o \
232                                         ${1} ${clst_target_path}"
233                                 mkisofs -J -r -l -chrp-boot -netatalk -hfs -probe -map \
234                                         ${clst_target_path}boot/map.hfs -part -no-desktop \
235                                         -hfs-volid "${clst_iso_volume_id}" -hfs-bless \
236                                         ${clst_target_path}boot -V "${clst_iso_volume_id}" -o \
237                                         ${1} ${clst_target_path} || die "Cannot make ISO image"
238                         ;;
239                 esac
240         ;;
241         ppc64)
242                 if [ -f ${clst_target_path}/ppc/bootinfo.txt ]
243                 then
244                         echo "bootinfo.txt found .. updating it"
245                         sed -i -e \
246                         's#^<description>.*</description>$#<description>'"${clst_iso_volume_id}"'</description>#' \
247                         ${clst_target_path}/ppc/bootinfo.txt
248                         sed -i -e \
249                         's#^<os-name>.*</os-name>$#<os-name>'"${clst_iso_volume_id}"'</os-name>#' \
250                         ${clst_target_path}/ppc/bootinfo.txt
251                 fi
252
253                 case ${clst_fstype} in
254                         zisofs)
255                                 echo "Running mkisofs to create iso image...."
256                                 echo "mkisofs -J -r -U -z -chrp-boot -netatalk -hfs -probe -map ${clst_target_path}boot/map.hfs -part -no-desktop -hfs-volid \"${clst_iso_volume_id}\" -hfs-bless ${clst_target_path}boot -hide-hfs \"zisofs\" -hide-hfs \"stages\" -hide-hfs \"distfiles\" -hide-hfs \"snapshots\" -V \"${clst_iso_volume_id}\" -o  ${1} ${clst_target_path}"
257                                 mkisofs -J -r -U -z -chrp-boot -netatalk -hfs -probe -map \
258                                         ${clst_target_path}boot/map.hfs -part -no-desktop \
259                                         -hfs-volid "${clst_iso_volume_id}" -hfs-bless \
260                                         ${clst_target_path}boot -hide-hfs "zisofs" -hide-hfs "stages" \
261                                         -hide-hfs "distfiles" -hide-hfs "snapshots" \
262                                         -V "${clst_iso_volume_id}" -o \
263                                         ${1} ${clst_target_path} || die "Cannot make ISO image"
264                         ;;
265                         *)
266                                 echo "Running mkisofs to create iso image...."
267                                 echo "mkisofs -J -r -U -chrp-boot -netatalk -hfs -probe -map \
268                                         ${clst_target_path}boot/map.hfs -part -no-desktop \
269                                         -hfs-volid \"${clst_iso_volume_id}\" -hfs-bless \
270                                         ${clst_target_path}boot -V \"${clst_iso_volume_id}\" \
271                                         -hide-hfs \"stages\" -hide-hfs \"distfiles\" -hide-hfs \"snapshots\" \
272                                         -hide-hfs \"image.loop\" -hide-hfs \"image.squashfs\" -hide-hfs \"image.jffs\" \
273                                         -hide-hfs \"image.cramfs\" \
274                                         -o ${1} ${clst_target_path}"
275                                 mkisofs -J -r -U -chrp-boot -netatalk -hfs -probe -map \
276                                         ${clst_target_path}boot/map.hfs -part -no-desktop \
277                                         -hfs-volid "${clst_iso_volume_id}" -hfs-bless \
278                                         ${clst_target_path}boot -V "${clst_iso_volume_id}" \
279                                         -hide-hfs "stages" -hide-hfs "distfiles" -hide-hfs "snapshots" \
280                                         -hide-hfs "image.loop" -hide-hfs "image.squashfs" -hide-hfs "image.jffs" \
281                                         -hide-hfs "image.cramfs" \
282                                         -o ${1} ${clst_target_path} || die "Cannot make ISO image"
283                         ;;
284                 esac
285         ;;
286         sparc*)
287                 # Old silo (<=1.2.6) requires a specially built mkisofs
288                 # We try to autodetect this in a simple way, said mkisofs
289                 # should be in the cdtar, otherwise use the new style.
290                 if [ -x ${clst_target_path}/boot/mkisofs.sparc.fu ]
291                 then
292                         mv ${clst_target_path}/boot/mkisofs.sparc.fu /tmp 
293                         case ${clst_fstype} in
294                                 zisofs)
295                                 echo "Running mkisofs.sparc.fu to create iso image...."
296                                 echo "/tmp/mkisofs.sparc.fu -z -o ${1} -D -r -pad -quiet -S \
297                                         'boot/cd.b' -B '/boot/second.b' -s '/boot/silo.conf'"
298                                 echo "-V \"${clst_iso_volume_id}\" ${clst_target_path}"
299                                 /tmp/mkisofs.sparc.fu -z -o ${1} -D -r -pad -quiet -S 'boot/cd.b' \
300                                         -B '/boot/second.b' -s '/boot/silo.conf'\
301                                         -V "${clst_iso_volume_id}" ${clst_target_path} \
302                                         || die "Cannot make ISO image"
303                                 ;;
304                                 *)
305                                 echo "Running mkisofs.sparc.fu to create iso image...."
306                                 echo "/tmp/mkisofs.sparc.fu -o ${1} -D -r -pad -quiet -S \
307                                         'boot/cd.b' -B '/boot/second.b' -s '/boot/silo.conf'"
308                                 echo "-V \"${clst_iso_volume_id}\" ${clst_target_path}"
309                                 /tmp/mkisofs.sparc.fu -o ${1} -D -r -pad -quiet -S 'boot/cd.b' \
310                                         -B '/boot/second.b' -s '/boot/silo.conf'\
311                                         -V "${clst_iso_volume_id}" ${clst_target_path} \
312                                         || die "Cannot make ISO image"
313                                 ;;
314                         esac
315                         rm /tmp/mkisofs.sparc.fu
316                 else
317                         case ${clst_fstype} in
318                                 zisofs)
319                                 echo "Running mkisofs to create iso image...."
320                                 echo "mkisofs -J -R -l -z -V \"${clst_iso_volume_id}\" -o ${1} \
321                                         -G \"${clst_target_path}/boot/isofs.b\" -B ... \
322                                         ${clst_target_path}"
323                                 mkisofs -J -R -l -z -V "${clst_iso_volume_id}" -o ${1} \
324                                         -G "${clst_target_path}/boot/isofs.b" -B ... \
325                                         ${clst_target_path} || die "CAnnot make ISO image"
326                                 ;;
327                                 *)
328                                 echo "Running mkisofs to create iso image...."
329                                 echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} \
330                                         -G \"${clst_target_path}/boot/isofs.b\" -B ... \
331                                         ${clst_target_path}"
332                                 mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} \
333                                         -G "${clst_target_path}/boot/isofs.b" -B ... \
334                                         ${clst_target_path} || die "CAnnot make ISO image"
335                                 ;;
336                         esac
337                 fi
338
339         ;;
340         x86|amd64)
341                 if [ -e ${clst_target_path}/boot/elilo.efi ]
342                 then
343                         if [ ! -e ${clst_target_path}/gentoo.efimg ]
344                         then
345                                 iaSizeTemp=$(du -sk ${clst_target_path}/boot 2>/dev/null)
346                                 iaSizeB=$(echo ${iaSizeTemp} | cut '-d ' -f1)
347                                 iaSize=$((${iaSizeB}+32)) # Add slack
348
349                                 dd if=/dev/zero of=${clst_target_path}/gentoo.efimg bs=1k \
350                                         count=${iaSize}
351                                 mkdosfs -F 16 -n GENTOO ${clst_target_path}/gentoo.efimg
352
353                                 mkdir ${clst_target_path}/gentoo.efimg.mountPoint
354                                 mount -t vfat -o loop ${clst_target_path}/gentoo.efimg \
355                                         ${clst_target_path}/gentoo.efimg.mountPoint
356
357                                 echo "Populating EFI image"
358                                 cp -pPRv ${clst_target_path}/boot/* \
359                                         ${clst_target_path}/gentoo.efimg.mountPoint
360
361                                 umount ${clst_target_path}/gentoo.efimg.mountPoint
362                                 rmdir ${clst_target_path}/gentoo.efimg.mountPoint
363                         else
364                                 echo "Found populated EFI image at \
365                                         ${clst_target_path}/gentoo.efimg"
366                         fi
367                         if [ ! -e ${clst_target_path}/boot/grub/stage2_eltorito ]
368                         then
369                                 echo "Removing /boot"
370                                 rm -rf ${clst_target_path}/boot
371                         fi
372                 fi
373
374                 if [ -e ${clst_target_path}/isolinux/isolinux.bin ]
375                 then
376                         if [ -d ${clst_target_path}/boot ]
377                         then
378                                 if [ -n "$(ls ${clst_target_path}/boot)" ]
379                                 then
380                                         mv ${clst_target_path}/boot/* ${clst_target_path}/isolinux
381                                         rm -r ${clst_target_path}/boot
382                                         echo "Creating ISO using ISOLINUX bootloader"
383                                         case ${clst_fstype} in
384                                                 zisofs)
385                                                         echo "mkisofs -J -R -l -V \
386                                                                 \"${clst_iso_volume_id}\" -o ${1} -b \
387                                                                 isolinux/isolinux.bin -c isolinux/boot.cat \
388                                                                 -no-emul-boot -boot-load-size 4 \
389                                                                 -boot-info-table -z ${clst_target_path}"
390                                                         mkisofs -J -R -l -V "${clst_iso_volume_id}" -o \
391                                                                 ${1} -b isolinux/isolinux.bin -c \
392                                                                 isolinux/boot.cat -no-emul-boot \
393                                                                 -boot-load-size 4 -boot-info-table -z \
394                                                                 ${clst_target_path} \
395                                                                 || die "Cannot make ISO image"
396                                                 ;;
397                                                 *)
398                                                         echo "mkisofs -J -R -l -V \
399                                                                 \"${clst_iso_volume_id}\" -o ${1} -b \
400                                                                 isolinux/isolinux.bin -c isolinux/boot.cat \
401                                                                 -no-emul-boot -boot-load-size 4 \
402                                                                 -boot-info-table ${clst_target_path}"
403                                                         mkisofs -J -R -l -V "${clst_iso_volume_id}" -o \
404                                                                 ${1} -b isolinux/isolinux.bin -c \
405                                                                 isolinux/boot.cat -no-emul-boot \
406                                                                 -boot-load-size 4 -boot-info-table \
407                                                                 ${clst_target_path} \
408                                                                 || die "Cannot make ISO image"
409                                                 ;;
410                                         esac
411                                 elif [ -e ${clst_target_path}/gentoo.efimg ]
412                                 then
413                                         echo "Creating ISO using both ISOLINUX and EFI bootloader"
414                                         case ${clst_fstype} in
415                                                 zisofs)
416                                                         echo "mkisofs -J -R -l -V \
417                                                                 \"${clst_iso_volume_id}\" -o ${1} -b \
418                                                                 isolinux/isolinux.bin -c isolinux/boot.cat \
419                                                                 -no-emul-boot -boot-load-size 4 \
420                                                                 -boot-info-table -eltorito-alt-boot -b \
421                                                                 gentoo.efimg -c boot.cat \
422                                                                 -no-emul-boot -z ${clst_target_path}"
423                                                         mkisofs -J -R -l -V "${clst_iso_volume_id}" -o \
424                                                                 ${1} -b isolinux/isolinux.bin -c \
425                                                                 isolinux/boot.cat -no-emul-boot \
426                                                                 -boot-load-size 4 -boot-info-table \
427                                                                 -eltorito-alt-boot -b gentoo.efimg -c \
428                                                                 boot.cat -no-emul-boot -z ${clst_target_path} \
429                                                                 || die "Cannot make ISO image"
430                                                 ;;
431                                                 *)
432                                                         echo "mkisofs -J -R -l -V \
433                                                                 \"${clst_iso_volume_id}\" -o ${1} -b \
434                                                                 isolinux/isolinux.bin -c isolinux/boot.cat \
435                                                                 -no-emul-boot -boot-load-size 4 \
436                                                                 -boot-info-table -eltorito-alt-boot -b \
437                                                                 gentoo.efimg -c boot.cat \
438                                                                 -no-emul-boot ${clst_target_path}"
439                                                         mkisofs -J -R -l -V "${clst_iso_volume_id}" -o \
440                                                                 ${1} -b isolinux/isolinux.bin -c \
441                                                                 isolinux/boot.cat -no-emul-boot \
442                                                                 -boot-load-size 4 -boot-info-table \
443                                                                 -eltorito-alt-boot -b gentoo.efimg -c boot.cat \
444                                                                 -no-emul-boot ${clst_target_path} \
445                                                                 || die "Cannot make ISO image"
446                                                 ;;
447                                         esac
448                                 fi
449                         else
450                                 echo "Creating ISO using ISOLINUX bootloader"
451                                 case ${clst_fstype} in
452                                         zisofs)
453                                                 echo "mkisofs -J -R -l -V \
454                                                         \"${clst_iso_volume_id}\" -o ${1} -b \
455                                                         isolinux/isolinux.bin -c isolinux/boot.cat \
456                                                         -no-emul-boot -boot-load-size 4 \
457                                                         -boot-info-table -z ${clst_target_path}"
458                                                 mkisofs -J -R -l -V "${clst_iso_volume_id}" -o \
459                                                         ${1} -b isolinux/isolinux.bin -c \
460                                                         isolinux/boot.cat -no-emul-boot \
461                                                         -boot-load-size 4 -boot-info-table -z \
462                                                         ${clst_target_path} \
463                                                         || die "Cannot make ISO image"
464                                         ;;
465                                         *)
466                                                 echo "mkisofs -J -R -l -V \
467                                                         \"${clst_iso_volume_id}\" -o ${1} -b \
468                                                         isolinux/isolinux.bin -c isolinux/boot.cat \
469                                                         -no-emul-boot -boot-load-size 4 \
470                                                         -boot-info-table ${clst_target_path}"
471                                                 mkisofs -J -R -l -V "${clst_iso_volume_id}" -o \
472                                                         ${1} -b isolinux/isolinux.bin -c \
473                                                         isolinux/boot.cat -no-emul-boot \
474                                                         -boot-load-size 4 -boot-info-table \
475                                                         ${clst_target_path} \
476                                                         || die "Cannot make ISO image"
477                                         ;;
478                                 esac
479                         fi
480                 elif [ -e ${clst_target_path}/boot/grub/stage2_eltorito ]
481                 then
482                         echo "Creating ISO using GRUB bootloader"
483                         case ${clst_fstype} in
484                                 zisofs)
485                                         echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o \
486                                                 ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat \
487                                                 -no-emul-boot -boot-load-size 4 -boot-info-table -z \
488                                                 ${clst_target_path}"
489                                         mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b \
490                                                 boot/grub/stage2_eltorito -c boot/boot.cat \
491                                                 -no-emul-boot -boot-load-size 4 -boot-info-table -z \
492                                                 ${clst_target_path} || die "Cannot make ISO image"
493                                 ;;
494                                 *)
495                                         echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o \
496                                                 ${1} -b boot/grub/stage2_eltorito -c boot/boot.cat \
497                                                 -no-emul-boot -boot-load-size 4 -boot-info-table \
498                                                 ${clst_target_path}"
499                                         mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b \
500                                                 boot/grub/stage2_eltorito -c boot/boot.cat \
501                                                 -no-emul-boot -boot-load-size 4 -boot-info-table \
502                                                 ${clst_target_path} || die "Cannot make ISO image"
503                                 ;;
504                         esac
505                 elif [ -e ${clst_target_path}/gentoo.efimg ]
506                 then
507                         echo 'Creating ISO using EFI bootloader'
508                         echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o ${1} -b \
509                                 gentoo.efimg -c boot.cat -no-emul-boot ${clst_target_path}" 
510                         mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} -b \
511                                 gentoo.efimg -c boot.cat -no-emul-boot ${clst_target_path} \
512                                 || die "Cannot make ISO image" 
513                 else    
514                         case ${clst_fstype} in
515                                 zisofs)
516                                         echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o \
517                                                 ${1} -z ${clst_target_path}"
518                                         mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} \
519                                                 -z ${clst_target_path} || die "Cannot make ISO image"
520                                 ;;
521                                 *)
522                                         echo "mkisofs -J -R -l -V \"${clst_iso_volume_id}\" -o \
523                                                 ${1} ${clst_target_path}"
524                                         mkisofs -J -R -l -V "${clst_iso_volume_id}" -o ${1} \
525                                                 ${clst_target_path} || die "Cannot make ISO image"
526                                 ;;
527                         esac
528                 fi
529         ;;
530 esac
531 exit  $?