From 18f6603943584a1e09ef9300e8656ee6f96ec357 Mon Sep 17 00:00:00 2001 From: Yorick Date: Thu, 26 Jan 2017 15:09:10 +0100 Subject: [PATCH] Better UEFI support --- init.sh | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/init.sh b/init.sh index 0cafc10..324649b 100755 --- a/init.sh +++ b/init.sh @@ -100,7 +100,7 @@ done 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" -$repo_path=$REPO_DIR/$DEBIAN_ARCH/$DEBIAN_VERSION +repo_path="$REPO_DIR/$DEBIAN_ARCH/$DEBIAN_VERSION" # Download Debian files (kernel, initrd and iso) @@ -120,23 +120,27 @@ then echo "No destination device specified, USB key will not be created." fi create_dir $TMP_DIR 1 -cp $repo_path $TMP_DIR +cp $repo_path/$iso_file $TMP_DIR # Copy wanted syslinux file from archive case $BOOT_TYPE in efi64) - create_dir "${TMP_DIR}/EFI/boot" - cp -T ${syslinux_mod}/${BOOT_TYPE}/syslinux.efi ${TMP_DIR}/EFI/boot/bootx64.efi + syslinux_folder=${TMP_DIR}/efi/EFI/boot + create_dir $syslinux_folder + cp -T ${syslinux_mod}/${BOOT_TYPE}/syslinux.efi $syslinux_folder/bootx64.efi for file in $SYSLINUX_EFI_FILES do echo "copying $file ..." - cp ${syslinux_mod}/${BOOT_TYPE}/${file} ${TMP_DIR}/EFI/boot + cp $syslinux_mod/$BOOT_TYPE/$file $syslinux_folder done for file in $SYSLINUX_FILES do echo "copie de $file" - cp ${syslinux_mod}/${BOOT_TYPE}/${file} ${TMP_DIR}/EFI/boot + cp ${syslinux_mod}/${BOOT_TYPE}/${file} $syslinux_folder done + cp $repo_path/{vmlinuz,initrd.gz} $TMP_DIR/efi + cp -R syslinux/syslinux.cfg $syslinux_folder &> /dev/null + ;; bios) create_dir ${TMP_DIR}/syslinux 1 @@ -151,11 +155,11 @@ case $BOOT_TYPE in echo "copying $file ..." cp ${syslinux_mod}/${BOOT_TYPE}/${file} ${TMP_DIR}/syslinux/ done + cp -R syslinux $TMP_DIR &> /dev/null ;; esac echo Copying configurations files -cp -R syslinux $TMP_DIR &> /dev/null -create_dir ${TMP_DIR}/partman_recipes +create_dir $TMP_DIR/partman_recipes cp -R partman_recipes $TMP_DIR &> /dev/null create_dir $TMP_DIR/preseeds cp -R preseeds $TMP_DIR &> /dev/null @@ -169,14 +173,20 @@ then fi #dd if=/dev/zero of=${dest} bs=512 count=1 conv=notrunc &> /dev/null echo -e "\nCreating partition" - parted -s ${dest} mklabel msdos mkpart primary fat32 1MiB 100% set 1 boot on - mkfs.vfat ${dest}1 -n debian &> /dev/null - + parted -s $dest mklabel gpt mkpart EFS fat32 1MiB 128MiB set 1 boot on + parted -s $dest mkpart EFS fat32 128MiB 100% + mkfs.vfat ${dest}1 -n efi &> /dev/null + mkfs.vfat ${dest}2 -n debian &> /dev/null + # mount and copy create_dir $MOUNT_DIR - mount ${dest}1 $MOUNT_DIR + mount ${dest}2 $MOUNT_DIR + create_dir $MOUNT_DIR/efi + mount ${dest}1 $MOUNT_DIR/efi + echo "copying all file to USB drive" - cp -R ${TMP_DIR}/* $MOUNT_DIR &> /dev/null + cp -R ${TMP_DIR}/* $MOUNT_DIR + umount $MOUNT_DIR/efi umount $MOUNT_DIR echo Unmounting key, please wait ... sleep 5 @@ -190,5 +200,5 @@ then syslinux --directory /syslinux --install ${dest}1 fi exit 0 - rm -rf $TMP_DIR + #rm -rf $TMP_DIR fi