Create disk architecture in a TMP directory

This commit is contained in:
Yorick Barbanneau 2016-10-10 17:45:12 +02:00
parent 8be47ee171
commit 63ad27b2f5

23
init.sh
View file

@ -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.