Use system syslinux instead of downloaded one
This commit is contained in:
parent
838ea9ce7f
commit
8be47ee171
1 changed files with 15 additions and 25 deletions
40
init.sh
40
init.sh
|
@ -10,9 +10,9 @@ DEBIAN_VERSION="8.6.0"
|
|||
DEBIAN_ARCH="amd64"
|
||||
BOOT_TYPE="efi64"
|
||||
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_EFI_FILES="com32/elflink/ldlinux/ldlinux.e64"
|
||||
SYSLINUX_EFI_FILES="ldlinux.e64"
|
||||
TMP_DIR="tmp"
|
||||
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"
|
||||
iso_url="http://cdimage.debian.org/debian-cd/${DEBIAN_VERSION}/${DEBIAN_ARCH}/iso-cd/"
|
||||
iso_file="debian-${DEBIAN_VERSION}-${DEBIAN_ARCH}-netinst.iso "
|
||||
syslinux_url="https://www.kernel.org/pub/linux/utils/boot/syslinux/"
|
||||
syslinux_archive="syslinux-${SYSLINUX_VERSION}.tar.gz"
|
||||
syslinux_mod="/usr/lib/syslinux/"
|
||||
current_dir=`pwd`
|
||||
|
||||
# Download Debian files (kernel, initrd and iso)
|
||||
|
@ -101,37 +100,28 @@ do
|
|||
done
|
||||
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
|
||||
for file in $SYSLINUX_FILES
|
||||
do
|
||||
echo "copie de $file"
|
||||
cp ${TMP_DIR}/syslinux-${SYSLINUX_VERSION}/${BOOT_TYPE}/${file} ./syslinux/
|
||||
echo "copie de $file"
|
||||
cp ${syslinux_mod}/${BOOT_TYPE}/${file} ./syslinux/
|
||||
done
|
||||
|
||||
case $BOOT_TYPE in
|
||||
efi64)
|
||||
for file in $SYSLINUX_EFI_FILES
|
||||
do
|
||||
echo "copying $file ..."
|
||||
cp ${TMP_DIR}/syslinux-${SYSLINUX_VERSION}/${BOOT_TYPE}/${file} ./syslinux/
|
||||
cp ${syslinux_mod}/${BOOT_TYPE}/${file} ./syslinux/
|
||||
done
|
||||
create_dir "EFI/syslinux"
|
||||
cp ${TMP_DIR}/syslinux-${SYSLINUX_VERSION}/${BOOT_TYPE}/efi/syslinux.efi ./EFI/boot/bootx64.efi
|
||||
create_dir "EFI/boot"
|
||||
cp -T ${syslinux_mod}/${BOOT_TYPE}/efi/syslinux.efi EFI/boot/bootx64.efi
|
||||
;;
|
||||
bios)
|
||||
for file in $SYSLINUX_BIOS_FILES
|
||||
do
|
||||
echo "copying $file ..."
|
||||
cp ${TMP_DIR}/syslinux-${SYSLINUX_VERSION}/${BOOT_TYPE}/${file} ./syslinux/
|
||||
cp ${syslinux_mod}/${BOOT_TYPE}/${file} ./syslinux/
|
||||
done
|
||||
;;
|
||||
esac
|
||||
|
@ -155,18 +145,18 @@ then
|
|||
cp * $MOUNT_DIR &> /dev/null
|
||||
cp -R syslinux $MOUNT_DIR &> /dev/null
|
||||
if [[ $BOOT_TYPE == "efi64" ]];then cp -R EFI $MOUNT_DIR &> /dev/null; fi
|
||||
sync
|
||||
umount $MOUNT_DIR
|
||||
sleep 5
|
||||
# Make key bootable if bios.
|
||||
if [[ $BOOT_TYPE == "bios" ]]
|
||||
then
|
||||
# In this mode, we need to write syslinux MBR.
|
||||
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
|
||||
cd ${TMP_DIR}/syslinux-${SYSLINUX_VERSION}/bios/linux/
|
||||
linux32 syslinux --directory /syslinux/ --install ${dest}1
|
||||
#cd ${TMP_DIR}/syslinux-${SYSLINUX_VERSION}/bios/linux/
|
||||
syslinux --directory syslinux --install ${dest}1
|
||||
cd $current_dir
|
||||
fi
|
||||
exit 0
|
||||
exit 0
|
||||
fi
|
||||
|
|
Reference in a new issue