#!/bin/sh
ISO=$(mktemp -d)
STORE=$(mktemp -d)
PATHTOISO=$STORE/fake_slackware64-14.2.iso
mount /storage/images_iso/slackware64-14.2-install-dvd.iso /mnt
printf %b "Copying the genuine ISO in a temp directory...\n"
cp -a /mnt/* $ISO
umount /mnt
printf %b "Rebuilding the new ISO...\n"
( cd $ISO
EFIOPTIONS="-eltorito-alt-boot -e isolinux/efiboot.img -isohybrid-gpt-basdat -no-emul-boot"
xorriso -as mkisofs \
    -isohybrid-mbr /usr/share/syslinux/isohdpfx.bin \
    -hide-rr-moved \
    -U \
    -V "FAKESLACK" \
    -J \
    -joliet-long \
    -r \
    -v \
    -x source \
    -o $PATHTOISO \
    -b isolinux/isolinux.bin \
    -c isolinux/boot.cat \
    -no-emul-boot \
    -boot-info-table $EFIOPTIONS . \
)  2>${PATHTOISO%iso}log.txt
printf %b "Hopefully, $PATHTOISO has been built\n"
printf %b "Check the log file ${PATHTOISO%iso}log.txt\n"
printf %b "Don't forget to remove $STORE and $ISO when you are done\n" 
