reworked folders architecture
This commit is contained in:
parent
9f54bf57a0
commit
eed9a5d9c5
1 changed files with 44 additions and 25 deletions
69
init.sh
69
init.sh
|
@ -14,6 +14,7 @@ SYSLINUX_FILES="menu.c32 vesamenu.c32 libutil.c32 libcom32.c32"
|
||||||
SYSLINUX_BIOS_FILES=""
|
SYSLINUX_BIOS_FILES=""
|
||||||
SYSLINUX_EFI_FILES="ldlinux.e64"
|
SYSLINUX_EFI_FILES="ldlinux.e64"
|
||||||
TMP_DIR="tmp"
|
TMP_DIR="tmp"
|
||||||
|
REPO_DIR="repo"
|
||||||
MOUNT_DIR="/mnt/usbstick"
|
MOUNT_DIR="/mnt/usbstick"
|
||||||
syslinux_mod="/usr/lib/syslinux"
|
syslinux_mod="/usr/lib/syslinux"
|
||||||
current_dir=`pwd`
|
current_dir=`pwd`
|
||||||
|
@ -46,7 +47,16 @@ download (){
|
||||||
|
|
||||||
create_dir(){
|
create_dir(){
|
||||||
# $1 directory to create
|
# $1 directory to create
|
||||||
if [ ! -d $1 ]; then mkdir -p $1; fi
|
if [ ! -d $1 ]
|
||||||
|
then
|
||||||
|
mkdir -p $1
|
||||||
|
else
|
||||||
|
if [[ $2 == 1 ]]
|
||||||
|
then
|
||||||
|
rm -rf $1
|
||||||
|
create_dir $1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
#Stop script if syslinux is not installed
|
#Stop script if syslinux is not installed
|
||||||
|
@ -90,47 +100,55 @@ done
|
||||||
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"
|
||||||
|
$repo_path=$REPO_DIR/$DEBIAN_ARCH/$DEBIAN_VERSION
|
||||||
|
|
||||||
|
|
||||||
|
# Download Debian files (kernel, initrd and iso)
|
||||||
|
echo -e "\nPrepare Debian files\n---"
|
||||||
# Création du répertoire temporaire
|
# Création du répertoire temporaire
|
||||||
if [ ! -d $TMP_DIR ]; then mkdir $TMP_DIR; fi
|
create_dir $repo_path
|
||||||
|
cd $repo_path
|
||||||
|
download $iso_file $iso_url 1
|
||||||
|
for file in "vmlinuz" "initrd.gz"
|
||||||
|
do
|
||||||
|
download $file $bootfiles_Debian 1
|
||||||
|
done
|
||||||
|
cd $current_dir
|
||||||
|
|
||||||
if [[ -z $dest ]]
|
if [[ -z $dest ]]
|
||||||
then
|
then
|
||||||
echo "No destination device specified, USB key will not be created."
|
echo "No destination device specified, USB key will not be created."
|
||||||
fi
|
fi
|
||||||
|
create_dir $TMP_DIR 1
|
||||||
# Download Debian files (kernel, initrd and iso)
|
cp $repo_path $TMP_DIR
|
||||||
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
|
# 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} ${TMP_DIR}/syslinux/
|
|
||||||
done
|
|
||||||
|
|
||||||
case $BOOT_TYPE in
|
case $BOOT_TYPE in
|
||||||
efi64)
|
efi64)
|
||||||
for file in $SYSLINUX_EFI_FILES
|
|
||||||
do
|
|
||||||
echo "copying $file ..."
|
|
||||||
cp ${syslinux_mod}/${BOOT_TYPE}/${file} ${TMP_DIR}/syslinux/
|
|
||||||
done
|
|
||||||
create_dir "${TMP_DIR}/EFI/boot"
|
create_dir "${TMP_DIR}/EFI/boot"
|
||||||
cp -T ${syslinux_mod}/${BOOT_TYPE}/syslinux.efi ${TMP_DIR}/EFI/boot/bootx64.efi
|
cp -T ${syslinux_mod}/${BOOT_TYPE}/syslinux.efi ${TMP_DIR}/EFI/boot/bootx64.efi
|
||||||
|
for file in $SYSLINUX_EFI_FILES
|
||||||
|
do
|
||||||
|
echo "copying $file ..."
|
||||||
|
cp ${syslinux_mod}/${BOOT_TYPE}/${file} ${TMP_DIR}/EFI/boot
|
||||||
|
done
|
||||||
|
for file in $SYSLINUX_FILES
|
||||||
|
do
|
||||||
|
echo "copie de $file"
|
||||||
|
cp ${syslinux_mod}/${BOOT_TYPE}/${file} ${TMP_DIR}/EFI/boot
|
||||||
|
done
|
||||||
;;
|
;;
|
||||||
bios)
|
bios)
|
||||||
|
create_dir ${TMP_DIR}/syslinux 1
|
||||||
|
for file in $SYSLINUX_FILES
|
||||||
|
do
|
||||||
|
echo "copie de $file"
|
||||||
|
cp ${syslinux_mod}/${BOOT_TYPE}/${file} ${TMP_DIR}/syslinux/
|
||||||
|
done
|
||||||
|
|
||||||
for file in $SYSLINUX_BIOS_FILES
|
for file in $SYSLINUX_BIOS_FILES
|
||||||
do
|
do
|
||||||
echo "copying $file ..."
|
echo "copying $file ..."
|
||||||
cp ${syslinux_mod}/${BOOT_TYPE}/${file} ${TMP_DIR}/syslinux/
|
cp ${syslinux_mod}/${BOOT_TYPE}/${file} ${TMP_DIR}/syslinux/
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
|
@ -172,4 +190,5 @@ then
|
||||||
syslinux --directory /syslinux --install ${dest}1
|
syslinux --directory /syslinux --install ${dest}1
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
rm -rf $TMP_DIR
|
||||||
fi
|
fi
|
||||||
|
|
Reference in a new issue