Use system syslinux instead of downloaded one

This commit is contained in:
Yorick Barbanneau 2016-10-10 17:32:40 +02:00
parent 838ea9ce7f
commit 8be47ee171

40
init.sh
View file

@ -10,9 +10,9 @@ DEBIAN_VERSION="8.6.0"
DEBIAN_ARCH="amd64" DEBIAN_ARCH="amd64"
BOOT_TYPE="efi64" BOOT_TYPE="efi64"
SYSLINUX_VERSION="6.03" SYSLINUX_VERSION="6.03"
SYSLINUX_FILES="com32/menu/menu.c32 com32/menu/vesamenu.c32 com32/libutil/libutil.c32 com32/lib/libcom32.c32" SYSLINUX_FILES="menu.c32 vesamenu.c32 libutil.c32 libcom32.c32"
SYSLINUX_BIOS_FILES="" SYSLINUX_BIOS_FILES=""
SYSLINUX_EFI_FILES="com32/elflink/ldlinux/ldlinux.e64" SYSLINUX_EFI_FILES="ldlinux.e64"
TMP_DIR="tmp" TMP_DIR="tmp"
MOUNT_DIR="/mnt/usbstick" MOUNT_DIR="/mnt/usbstick"
@ -89,8 +89,7 @@ fi
bootfiles_Debian="http://ftp.debian.org/debian/dists/jessie/main/installer-${DEBIAN_ARCH}/current/images/hd-media" bootfiles_Debian="http://ftp.debian.org/debian/dists/jessie/main/installer-${DEBIAN_ARCH}/current/images/hd-media"
iso_url="http://cdimage.debian.org/debian-cd/${DEBIAN_VERSION}/${DEBIAN_ARCH}/iso-cd/" iso_url="http://cdimage.debian.org/debian-cd/${DEBIAN_VERSION}/${DEBIAN_ARCH}/iso-cd/"
iso_file="debian-${DEBIAN_VERSION}-${DEBIAN_ARCH}-netinst.iso " iso_file="debian-${DEBIAN_VERSION}-${DEBIAN_ARCH}-netinst.iso "
syslinux_url="https://www.kernel.org/pub/linux/utils/boot/syslinux/" syslinux_mod="/usr/lib/syslinux/"
syslinux_archive="syslinux-${SYSLINUX_VERSION}.tar.gz"
current_dir=`pwd` current_dir=`pwd`
# Download Debian files (kernel, initrd and iso) # Download Debian files (kernel, initrd and iso)
@ -101,37 +100,28 @@ do
done done
download $iso_file $iso_url 1 download $iso_file $iso_url 1
# Get Syslinux archive
echo -e "\nPrepare syslinux files\n---"
if [ ! -d "/tmp/syslinux-${SYSLINUX_VERSION}" ]
then
cd $TMP_DIR
if [ ! -f $syslinux_archive ]; then download $syslinux_archive $syslinux_url 1; fi
tar -xf $syslinux_archive
cd $current_dir
fi
# Copy wanted syslinux file from archive # Copy wanted syslinux file from archive
for file in $SYSLINUX_FILES for file in $SYSLINUX_FILES
do do
echo "copie de $file" echo "copie de $file"
cp ${TMP_DIR}/syslinux-${SYSLINUX_VERSION}/${BOOT_TYPE}/${file} ./syslinux/ cp ${syslinux_mod}/${BOOT_TYPE}/${file} ./syslinux/
done done
case $BOOT_TYPE in case $BOOT_TYPE in
efi64) efi64)
for file in $SYSLINUX_EFI_FILES for file in $SYSLINUX_EFI_FILES
do do
echo "copying $file ..." echo "copying $file ..."
cp ${TMP_DIR}/syslinux-${SYSLINUX_VERSION}/${BOOT_TYPE}/${file} ./syslinux/ cp ${syslinux_mod}/${BOOT_TYPE}/${file} ./syslinux/
done done
create_dir "EFI/syslinux" create_dir "EFI/boot"
cp ${TMP_DIR}/syslinux-${SYSLINUX_VERSION}/${BOOT_TYPE}/efi/syslinux.efi ./EFI/boot/bootx64.efi cp -T ${syslinux_mod}/${BOOT_TYPE}/efi/syslinux.efi EFI/boot/bootx64.efi
;; ;;
bios) bios)
for file in $SYSLINUX_BIOS_FILES for file in $SYSLINUX_BIOS_FILES
do do
echo "copying $file ..." echo "copying $file ..."
cp ${TMP_DIR}/syslinux-${SYSLINUX_VERSION}/${BOOT_TYPE}/${file} ./syslinux/ cp ${syslinux_mod}/${BOOT_TYPE}/${file} ./syslinux/
done done
;; ;;
esac esac
@ -155,18 +145,18 @@ then
cp * $MOUNT_DIR &> /dev/null cp * $MOUNT_DIR &> /dev/null
cp -R syslinux $MOUNT_DIR &> /dev/null cp -R syslinux $MOUNT_DIR &> /dev/null
if [[ $BOOT_TYPE == "efi64" ]];then cp -R EFI $MOUNT_DIR &> /dev/null; fi if [[ $BOOT_TYPE == "efi64" ]];then cp -R EFI $MOUNT_DIR &> /dev/null; fi
sync
umount $MOUNT_DIR umount $MOUNT_DIR
sleep 5
# Make key bootable if bios. # Make key bootable if bios.
if [[ $BOOT_TYPE == "bios" ]] if [[ $BOOT_TYPE == "bios" ]]
then then
# In this mode, we need to write syslinux MBR. # In this mode, we need to write syslinux MBR.
echo "Writing syslinux mbr.ini fo $dest" echo "Writing syslinux mbr.ini fo $dest"
dd bs=440 count=1 conv=notrunc if=${TMP_DIR}/syslinux-${SYSLINUX_VERSION}/bios/mbr/mbr.bin of=${dest} dd bs=440 count=1 conv=notrunc if=${syslinux_mod}/${BOOT_TYPE}/mbr.bin of=${dest}
sleep 5 sleep 5
cd ${TMP_DIR}/syslinux-${SYSLINUX_VERSION}/bios/linux/ #cd ${TMP_DIR}/syslinux-${SYSLINUX_VERSION}/bios/linux/
linux32 syslinux --directory /syslinux/ --install ${dest}1 syslinux --directory syslinux --install ${dest}1
cd $current_dir cd $current_dir
fi fi
exit 0 exit 0
fi fi