From 63ad27b2f56030e9bc2f110adf7a6bde0b1dfc5f Mon Sep 17 00:00:00 2001 From: Yorick Date: Mon, 10 Oct 2016 17:45:12 +0200 Subject: [PATCH] Create disk architecture in a TMP directory --- init.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/init.sh b/init.sh index 2b5bd3b..01cba0c 100755 --- a/init.sh +++ b/init.sh @@ -87,24 +87,27 @@ then 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_url="http://cdimage.debian.org/debian-cd/${DEBIAN_VERSION}/${DEBIAN_ARCH}/iso-cd" iso_file="debian-${DEBIAN_VERSION}-${DEBIAN_ARCH}-netinst.iso " -syslinux_mod="/usr/lib/syslinux/" +syslinux_mod="/usr/lib/syslinux" current_dir=`pwd` # Download Debian files (kernel, initrd and iso) echo -e "\nPrepare Debian files\n---" +cd $TMP_DIR for file in "vmlinuz" "initrd.gz" do download $file $bootfiles_Debian 1 done download $iso_file $iso_url 1 +cd $current_dir # Copy wanted syslinux file from archive +create_dir ${TMP_DIR}/syslinux 1 for file in $SYSLINUX_FILES do echo "copie de $file" - cp ${syslinux_mod}/${BOOT_TYPE}/${file} ./syslinux/ + cp ${syslinux_mod}/${BOOT_TYPE}/${file} ${TMP_DIR}/syslinux/ done case $BOOT_TYPE in @@ -112,19 +115,21 @@ case $BOOT_TYPE in for file in $SYSLINUX_EFI_FILES do echo "copying $file ..." - cp ${syslinux_mod}/${BOOT_TYPE}/${file} ./syslinux/ + cp ${syslinux_mod}/${BOOT_TYPE}/${file} ${TMP_DIR}/syslinux/ done - create_dir "EFI/boot" - cp -T ${syslinux_mod}/${BOOT_TYPE}/efi/syslinux.efi EFI/boot/bootx64.efi + create_dir "${TMP_DIR}/EFI/boot" + cp -T ${syslinux_mod}/${BOOT_TYPE}/syslinux.efi ${TMP_DIR}/EFI/boot/bootx64.efi ;; bios) for file in $SYSLINUX_BIOS_FILES do echo "copying $file ..." - cp ${syslinux_mod}/${BOOT_TYPE}/${file} ./syslinux/ + cp ${syslinux_mod}/${BOOT_TYPE}/${file} ${TMP_DIR}/syslinux/ done ;; esac +echo Copying configuration file +cp -R syslinux $TMP_DIR &> /dev/null if [[ -n $dest ]] then @@ -142,9 +147,7 @@ then create_dir $MOUNT_DIR mount ${dest}1 $MOUNT_DIR echo "copying all file to USB drive" - 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 + cp ${TMP_DIR}/* $MOUNT_DIR &> /dev/null sync umount $MOUNT_DIR # Make key bootable if bios.