echo
echo You need to run this script as root
echo Usage: sudo $0 distro.iso /dev/sdX
-echo Example: sudo $0 foobar_5.0_i386.iso /dev/sdb
+echo Example: sudo $0 trisquel_11.0-fsf_amd64.iso /dev/sdb
echo
echo WARNING!: this script will delete all data on the whole disk you pass as the second parameter. Make sure it is your USB drive and not your internal hard drive!
echo ANOTHER WARNING!: This script can bite your dog. Use it with care, backup your data.
cp -vr $DEVTMP/isolinux $DEVTMP/syslinux
mv $DEVTMP/syslinux/isolinux.cfg $DEVTMP/syslinux/syslinux.cfg
+# apparently running syslinux command when /syslinux/ and /isolinux/ both exist
+# leads to GRUB not detecting the isolinux directory.
+mv $DEVTMP/isolinux $DEVTMP/isolinux.bak
+
# Create persistency file
# dd if=/dev/zero of=$DEVTMP/casper-rw bs=1M count=$PERSISTENCESIZE oflag=sync status=progress
# mkfs.ext4 -L casper-rw -F $DEVTMP/casper-rw
umount $DEVTMP
umount $ISOTMP
+# Set up bootloader, requires syslinux. version 6.04 has been tested.
+syslinux --directory /syslinux/ --install ${DEV}1
+sudo dd if=/usr/lib/SYSLINUX/mbr.bin of=${DEV}
+parted $DEV set 1 boot on
+
+mount ${DEV}1 $DEVTMP
+mv $DEVTMP/isolinux.bak $DEVTMP/isolinux
+umount $DEVTMP
+
rmdir $DEVTMP
rmdir $ISOTMP
-# Set up bootloader, requires syslinux 4x
-# https://mirror.fsf.org/trisquel/pool/main/s/syslinux/syslinux-common_4.05+dfsg-6+deb8u1_all.deb
-# https://mirror.fsf.org/trisquel/pool/main/s/syslinux/syslinux_4.05+dfsg-6+deb8u1_amd64.deb
-syslinux ${DEV}1
-dd conv=notrunc if=/usr/lib/syslinux/mbr.bin bs=440 count=1 of=$DEV
-parted $DEV set 1 boot on
-
#eject $DEV
sync