Add external syslinux folder configuration files
This commit is contained in:
parent
a4a384f25f
commit
0a06b0f08e
3 changed files with 46 additions and 14 deletions
52
init.sh
52
init.sh
|
@ -15,8 +15,7 @@ repo_dir="repo"
|
|||
tmp_dir="tmp"
|
||||
current_dir=`pwd`
|
||||
# In Archlinux, this is default files for syslinux...
|
||||
syslinux_modules_dir="/usr/lib/syslinux"
|
||||
syslinux_efi_bootloader="/usr/lib/syslinux"
|
||||
conf_file="conf/archlinux.conf"
|
||||
key_mountpoint="/mnt/usbstick"
|
||||
device=""
|
||||
# constant
|
||||
|
@ -51,6 +50,16 @@ process_args() {
|
|||
-b|--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)
|
||||
if [ -b $2 ]
|
||||
then
|
||||
|
@ -119,6 +128,15 @@ download (){
|
|||
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(){
|
||||
# $1 directory to create
|
||||
if [ ! -d $1 ]
|
||||
|
@ -180,6 +198,12 @@ fi
|
|||
|
||||
|
||||
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"
|
||||
iso_url="http://cdimage.debian.org/debian-cd/${debian_version}/${debian_arch}/iso-cd"
|
||||
|
@ -212,23 +236,23 @@ case $boot_type in
|
|||
efi64)
|
||||
syslinux_folder=${tmp_dir}/efi/EFI/boot
|
||||
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
|
||||
do
|
||||
printf "copying %s \n" "$file"
|
||||
cp $syslinux_modules_dir/$boot_type/$file $syslinux_folder
|
||||
cp $syslinux_modules_folder/$boot_type/$file $syslinux_folder
|
||||
done
|
||||
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
|
||||
|
||||
;;
|
||||
;;
|
||||
bios)
|
||||
syslinux_folder=${tmp_dir}/syslinux
|
||||
create_dir $syslinux_folder
|
||||
for file in $SYSLINUX_BIOS_FILES
|
||||
do
|
||||
printf "copying %s\n" "$file"
|
||||
cp $syslinux_modules_dir/$boot_type/$file $syslinux_folder
|
||||
prin tf "copying %s\n" "$file"
|
||||
cp $syslinux_modules_folder/$boot_type/$file $syslinux_folder
|
||||
done
|
||||
cp $repo_path/{vmlinuz,initrd.gz} $tmp_dir
|
||||
cp -R syslinux $tmp_dir &> /dev/null
|
||||
|
@ -237,8 +261,8 @@ esac
|
|||
|
||||
for file in $SYSLINUX_FILES
|
||||
do
|
||||
printf "copying %s\n" "$file"
|
||||
cp $syslinux_modules_dir/$boot_type/$file $syslinux_folder
|
||||
printf "copying %s\n" "$file"
|
||||
cp $syslinux_modules_folder/$boot_type/$file $syslinux_folder
|
||||
done
|
||||
|
||||
echo Copying configurations files
|
||||
|
@ -260,11 +284,11 @@ then
|
|||
create_dir $key_mountpoint
|
||||
#dd if=/dev/zero of=${dest} bs=512 count=1 conv=notrunc &> /dev/null
|
||||
case $boot_type in
|
||||
"efi64")
|
||||
"efi64")
|
||||
efi_create_key_structure $device $key_mountpoint
|
||||
;;
|
||||
;;
|
||||
"bios")
|
||||
bios_create_key_structure $device $key_mountpoint
|
||||
bio s_create_key_structure $device $key_mountpoint
|
||||
;;
|
||||
esac
|
||||
printf "copying all file to USB drive\n"
|
||||
|
@ -276,7 +300,7 @@ then
|
|||
then
|
||||
# In this mode, we need to write syslinux MBR.
|
||||
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
|
||||
$SYSLINUX_EXE --directory /syslinux --install ${device}1
|
||||
fi
|
||||
|
|
Reference in a new issue