Add external syslinux folder configuration files
This commit is contained in:
parent
a4a384f25f
commit
0a06b0f08e
3 changed files with 46 additions and 14 deletions
4
conf/archlinux.conf
Normal file
4
conf/archlinux.conf
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Archlinux syslinux folder configuration
|
||||||
|
syslinux_mbr_bl_folder="/usr/lib/syslinux/bios"
|
||||||
|
syslinux_efi_bl_folder="/usr/lib/syslinux"
|
||||||
|
syslinux_modules_folder="/usr/lib/syslinux"
|
4
conf/debian.conf
Normal file
4
conf/debian.conf
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Debian syslinux folder configuration
|
||||||
|
syslinux_mbr_bl_folder="/usr/lib/SYSLINUX"
|
||||||
|
syslinux_efi_bl_folder="/usr/lib/SYSLINUX.EFI"
|
||||||
|
syslinux_modules_folder="/usr/lib/syslinux"
|
38
init.sh
38
init.sh
|
@ -15,8 +15,7 @@ repo_dir="repo"
|
||||||
tmp_dir="tmp"
|
tmp_dir="tmp"
|
||||||
current_dir=`pwd`
|
current_dir=`pwd`
|
||||||
# In Archlinux, this is default files for syslinux...
|
# In Archlinux, this is default files for syslinux...
|
||||||
syslinux_modules_dir="/usr/lib/syslinux"
|
conf_file="conf/archlinux.conf"
|
||||||
syslinux_efi_bootloader="/usr/lib/syslinux"
|
|
||||||
key_mountpoint="/mnt/usbstick"
|
key_mountpoint="/mnt/usbstick"
|
||||||
device=""
|
device=""
|
||||||
# constant
|
# constant
|
||||||
|
@ -51,6 +50,16 @@ process_args() {
|
||||||
-b|--bios)
|
-b|--bios)
|
||||||
boot_type="bios"
|
boot_type="bios"
|
||||||
;;
|
;;
|
||||||
|
-c|--conf)
|
||||||
|
if [ -f $2 ]
|
||||||
|
then
|
||||||
|
conf_file=$2
|
||||||
|
else
|
||||||
|
printf "%s file not found" $2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-d|--device)
|
-d|--device)
|
||||||
if [ -b $2 ]
|
if [ -b $2 ]
|
||||||
then
|
then
|
||||||
|
@ -119,6 +128,15 @@ download (){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
process_conf_file (){
|
||||||
|
for p in `cat $1 | grep '^[^#].*'`
|
||||||
|
do
|
||||||
|
var=`echo "$p" | awk -F"=" '{print $1}'`
|
||||||
|
param=`echo "$p" | awk -F"=" '{print $2}'`
|
||||||
|
eval $var=$param
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
create_dir(){
|
create_dir(){
|
||||||
# $1 directory to create
|
# $1 directory to create
|
||||||
if [ ! -d $1 ]
|
if [ ! -d $1 ]
|
||||||
|
@ -180,6 +198,12 @@ fi
|
||||||
|
|
||||||
|
|
||||||
process_args $@
|
process_args $@
|
||||||
|
process_conf_file $conf_file
|
||||||
|
if [[ ! -d $syslinux_mbr_bl_folder || ! -d $syslinux_efi_bl_folder || ! -d $syslinux_modules_folder ]]
|
||||||
|
then
|
||||||
|
printf "Bad folder configuration in %s\n" "$conf_file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
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"
|
||||||
|
@ -212,11 +236,11 @@ case $boot_type in
|
||||||
efi64)
|
efi64)
|
||||||
syslinux_folder=${tmp_dir}/efi/EFI/boot
|
syslinux_folder=${tmp_dir}/efi/EFI/boot
|
||||||
create_dir $syslinux_folder
|
create_dir $syslinux_folder
|
||||||
cp -T $syslinux_efi_bootloader/$boot_type/syslinux.efi $syslinux_folder/bootx64.efi &> /dev/null
|
cp -T $syslinux_efi_bl_folder/$boot_type/syslinux.efi $syslinux_folder/bootx64.efi &> /dev/null
|
||||||
for file in $SYSLINUX_EFI_FILES
|
for file in $SYSLINUX_EFI_FILES
|
||||||
do
|
do
|
||||||
printf "copying %s \n" "$file"
|
printf "copying %s \n" "$file"
|
||||||
cp $syslinux_modules_dir/$boot_type/$file $syslinux_folder
|
cp $syslinux_modules_folder/$boot_type/$file $syslinux_folder
|
||||||
done
|
done
|
||||||
cp $repo_path/{vmlinuz,initrd.gz} $tmp_dir/efi
|
cp $repo_path/{vmlinuz,initrd.gz} $tmp_dir/efi
|
||||||
cp -R syslinux/syslinux.cfg $syslinux_folder &> /dev/null
|
cp -R syslinux/syslinux.cfg $syslinux_folder &> /dev/null
|
||||||
|
@ -228,7 +252,7 @@ case $boot_type in
|
||||||
for file in $SYSLINUX_BIOS_FILES
|
for file in $SYSLINUX_BIOS_FILES
|
||||||
do
|
do
|
||||||
prin tf "copying %s\n" "$file"
|
prin tf "copying %s\n" "$file"
|
||||||
cp $syslinux_modules_dir/$boot_type/$file $syslinux_folder
|
cp $syslinux_modules_folder/$boot_type/$file $syslinux_folder
|
||||||
done
|
done
|
||||||
cp $repo_path/{vmlinuz,initrd.gz} $tmp_dir
|
cp $repo_path/{vmlinuz,initrd.gz} $tmp_dir
|
||||||
cp -R syslinux $tmp_dir &> /dev/null
|
cp -R syslinux $tmp_dir &> /dev/null
|
||||||
|
@ -238,7 +262,7 @@ esac
|
||||||
for file in $SYSLINUX_FILES
|
for file in $SYSLINUX_FILES
|
||||||
do
|
do
|
||||||
printf "copying %s\n" "$file"
|
printf "copying %s\n" "$file"
|
||||||
cp $syslinux_modules_dir/$boot_type/$file $syslinux_folder
|
cp $syslinux_modules_folder/$boot_type/$file $syslinux_folder
|
||||||
done
|
done
|
||||||
|
|
||||||
echo Copying configurations files
|
echo Copying configurations files
|
||||||
|
@ -276,7 +300,7 @@ then
|
||||||
then
|
then
|
||||||
# In this mode, we need to write syslinux MBR.
|
# In this mode, we need to write syslinux MBR.
|
||||||
printf "Writing syslinux mbr.ini to %s\n" "$device"
|
printf "Writing syslinux mbr.ini to %s\n" "$device"
|
||||||
dd bs=440 count=1 conv=notrunc if=$syslinux_modules_dir/$boot_type/mbr.bin of=$device
|
dd bs=440 count=1 conv=notrunc if=$syslinux_mbr_bl_folder/mbr.bin of=$device
|
||||||
sleep 2
|
sleep 2
|
||||||
$SYSLINUX_EXE --directory /syslinux --install ${device}1
|
$SYSLINUX_EXE --directory /syslinux --install ${device}1
|
||||||
fi
|
fi
|
||||||
|
|
Reference in a new issue