2015-03-04 00:40:44 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; version 2 of the License.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
2015-06-20 00:19:51 +02:00
|
|
|
set_mkinicpio_hooks(){
|
2016-09-15 23:58:18 +02:00
|
|
|
if ! ${pxe_boot};then
|
|
|
|
msg2 "Removing pxe hooks"
|
2016-10-10 22:07:49 +02:00
|
|
|
sed -e 's/miso_pxe_common miso_pxe_http miso_pxe_nbd miso_pxe_nfs //' \
|
2016-09-15 23:58:18 +02:00
|
|
|
-e 's/memdisk //' -i $1
|
|
|
|
fi
|
|
|
|
if ! ${plymouth_boot};then
|
|
|
|
msg2 "Removing plymouth hook"
|
|
|
|
sed -e 's/plymouth //' -i $1
|
|
|
|
fi
|
2016-10-12 12:32:54 +02:00
|
|
|
if ! ${use_overlayfs};then
|
2016-10-19 16:01:16 +02:00
|
|
|
msg2 "Setting aufs hook"
|
2016-10-12 12:58:14 +02:00
|
|
|
sed -e 's/miso /miso_aufs /' -i $1
|
2016-09-15 23:58:18 +02:00
|
|
|
fi
|
2015-06-20 00:46:05 +02:00
|
|
|
}
|
|
|
|
|
2016-10-09 18:04:22 +02:00
|
|
|
gen_boot_args(){
|
2016-10-12 12:32:54 +02:00
|
|
|
# local args=(quiet)
|
2016-10-11 21:53:04 +02:00
|
|
|
local args=()
|
2016-10-09 18:04:22 +02:00
|
|
|
if ${plymouth_boot};then
|
|
|
|
args+=(splash)
|
|
|
|
fi
|
|
|
|
echo ${args[@]}
|
|
|
|
}
|
|
|
|
|
2016-10-12 12:32:54 +02:00
|
|
|
prepare_initcpio(){
|
2016-09-15 23:58:18 +02:00
|
|
|
msg2 "Copying initcpio ..."
|
2016-12-06 15:16:17 +01:00
|
|
|
cp /etc/initcpio/hooks/miso* $1/etc/initcpio/hooks
|
|
|
|
cp /etc/initcpio/install/miso* $1/etc/initcpio/install
|
|
|
|
cp /etc/initcpio/miso_shutdown $1/etc/initcpio
|
|
|
|
# sed -e "s|/usr/lib/initcpio/|/etc/initcpio/|" -i $1/etc/initcpio/install/miso_shutdown
|
2016-10-15 11:49:38 +02:00
|
|
|
}
|
|
|
|
|
2016-10-24 16:56:42 +02:00
|
|
|
prepare_initramfs(){
|
2016-09-15 23:58:18 +02:00
|
|
|
cp $1/mkinitcpio.conf $2/etc/mkinitcpio-${iso_name}.conf
|
|
|
|
set_mkinicpio_hooks "$2/etc/mkinitcpio-${iso_name}.conf"
|
2016-10-24 16:56:42 +02:00
|
|
|
local _kernver=$(cat $2/usr/lib/modules/*/version)
|
|
|
|
chroot-run $2 \
|
2016-09-15 23:58:18 +02:00
|
|
|
/usr/bin/mkinitcpio -k ${_kernver} \
|
|
|
|
-c /etc/mkinitcpio-${iso_name}.conf \
|
2016-10-09 00:40:25 +02:00
|
|
|
-g /boot/initramfs.img
|
2015-03-04 10:42:15 +01:00
|
|
|
}
|
|
|
|
|
2016-10-24 16:56:42 +02:00
|
|
|
prepare_boot_extras(){
|
2016-09-15 23:58:18 +02:00
|
|
|
cp $1/boot/intel-ucode.img $2/intel_ucode.img
|
|
|
|
cp $1/usr/share/licenses/intel-ucode/LICENSE $2/intel_ucode.LICENSE
|
2016-10-12 12:32:54 +02:00
|
|
|
cp $1/boot/memtest86+/memtest.bin $2/memtest
|
|
|
|
cp $1/usr/share/licenses/common/GPL2/license.txt $2/memtest.COPYING
|
2015-05-29 00:13:54 +02:00
|
|
|
}
|
|
|
|
|
2016-10-09 22:17:10 +02:00
|
|
|
prepare_efiboot_image(){
|
2016-10-13 15:24:31 +02:00
|
|
|
local efi=$1/EFI/miso boot=$2/${iso_name}/boot
|
2016-10-09 22:17:10 +02:00
|
|
|
prepare_dir "${efi}"
|
|
|
|
cp ${boot}/x86_64/vmlinuz ${efi}/vmlinuz.efi
|
|
|
|
cp ${boot}/x86_64/initramfs.img ${efi}/initramfs.img
|
2016-10-09 18:04:22 +02:00
|
|
|
if [[ -f ${boot}/intel_ucode.img ]] ; then
|
2016-10-09 22:17:10 +02:00
|
|
|
cp ${boot}/intel_ucode.img ${efi}/intel_ucode.img
|
2016-10-03 21:29:34 +02:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-10-09 09:08:30 +02:00
|
|
|
vars_to_boot_conf(){
|
2016-10-07 08:25:08 +02:00
|
|
|
sed -e "s|@ISO_NAME@|${iso_name}|g" \
|
|
|
|
-e "s|@ISO_LABEL@|${iso_label}|g" \
|
2016-10-09 09:08:30 +02:00
|
|
|
-e "s|@DIST_NAME@|${dist_name}|g" \
|
|
|
|
-e "s|@ARCH@|${target_arch}|g" \
|
2016-10-07 08:25:08 +02:00
|
|
|
-e "s|@DRV@|$2|g" \
|
|
|
|
-e "s|@SWITCH@|$3|g" \
|
|
|
|
-e "s|@BOOT_ARGS@|$(gen_boot_args)|g" \
|
|
|
|
-i $1
|
2015-03-04 00:40:44 +01:00
|
|
|
}
|
2015-03-04 01:44:52 +01:00
|
|
|
|
2016-10-09 18:04:22 +02:00
|
|
|
prepare_efi_loader(){
|
2016-10-14 01:11:09 +02:00
|
|
|
local efi_data=$1/usr/share/efi-utils efi=$2/EFI/boot
|
2016-10-09 22:17:10 +02:00
|
|
|
msg2 "Preparing efi loaders ..."
|
|
|
|
prepare_dir "${efi}"
|
|
|
|
cp $1/usr/share/efitools/efi/PreLoader.efi ${efi}/bootx64.efi
|
|
|
|
cp $1/usr/share/efitools/efi/HashTool.efi ${efi}
|
|
|
|
cp ${efi_data}/gummibootx64.efi ${efi}/loader.efi
|
|
|
|
cp ${efi_data}/shellx64_v{1,2}.efi $2/EFI
|
|
|
|
|
|
|
|
local entries=$2/loader/entries
|
|
|
|
msg2 "Preparing efi loader config ..."
|
|
|
|
prepare_dir "${entries}"
|
|
|
|
|
2016-10-09 23:59:04 +02:00
|
|
|
cp ${efi_data}/loader.conf $2/loader/loader.conf
|
2016-10-09 18:04:22 +02:00
|
|
|
vars_to_boot_conf $2/loader/loader.conf
|
2016-10-09 22:17:10 +02:00
|
|
|
cp ${efi_data}/uefi-shell-v{1,2}-x86_64.conf ${entries}
|
2016-10-09 18:04:22 +02:00
|
|
|
|
2016-10-07 08:25:08 +02:00
|
|
|
local drv='free' switch="no"
|
2016-10-09 22:17:10 +02:00
|
|
|
cp ${efi_data}/entry-x86_64-$3.conf ${entries}/${iso_name}-x86_64.conf
|
|
|
|
vars_to_boot_conf "${entries}/${iso_name}-x86_64.conf" "$drv" "$switch"
|
2016-09-15 23:58:18 +02:00
|
|
|
if ${nonfree_mhwd};then
|
2016-10-07 08:25:08 +02:00
|
|
|
drv='nonfree' switch="yes"
|
2016-10-09 22:17:10 +02:00
|
|
|
cp ${efi_data}/entry-x86_64-$3.conf ${entries}/${iso_name}-x86_64-nonfree.conf
|
|
|
|
vars_to_boot_conf "${entries}/${iso_name}-x86_64-nonfree.conf" "$drv" "$switch"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
check_syslinux_optional(){
|
2016-10-09 23:59:04 +02:00
|
|
|
msg2 "Configuring syslinux menu ..."
|
|
|
|
sed -e "/LABEL optional/,/^$/d" -i "$1/miso_sys_i686.cfg"
|
|
|
|
sed -e "/LABEL optional/,/^$/d" -i "$1/miso_sys_x86_64.cfg"
|
|
|
|
sed -e "/nonfree/ d" -i $1/syslinux.msg
|
2015-03-04 13:11:50 +01:00
|
|
|
}
|
|
|
|
|
2016-10-14 01:11:09 +02:00
|
|
|
prepare_isolinux(){
|
|
|
|
local syslinux=$1/usr/lib/syslinux/bios
|
|
|
|
msg2 "Copying isolinux binaries ..."
|
|
|
|
cp ${syslinux}/{{isolinux,isohdpfx}.bin,ldlinux.c32} $2
|
|
|
|
msg2 "Copying isolinux.cfg ..."
|
|
|
|
cp $1/usr/share/syslinux/isolinux/isolinux.cfg $2
|
|
|
|
vars_to_boot_conf "$2/isolinux.cfg"
|
|
|
|
}
|
|
|
|
|
2016-10-07 08:25:08 +02:00
|
|
|
prepare_syslinux(){
|
2016-10-10 22:07:49 +02:00
|
|
|
local syslinux=$1/usr/lib/syslinux/bios
|
2016-10-09 09:08:30 +02:00
|
|
|
msg2 "Copying syslinux binaries ..."
|
2016-10-14 01:11:09 +02:00
|
|
|
cp ${syslinux}/{*.c32,lpxelinux.0,memdisk} $2
|
2016-10-09 00:40:25 +02:00
|
|
|
msg2 "Copying syslinux theme ..."
|
2016-10-14 01:11:09 +02:00
|
|
|
syslinux=$1/usr/share/syslinux/theme
|
|
|
|
cp ${syslinux}/* $2
|
2016-10-10 22:07:49 +02:00
|
|
|
for conf in $2/*.cfg; do
|
2016-10-09 23:59:04 +02:00
|
|
|
vars_to_boot_conf "${conf}"
|
2016-10-07 08:25:08 +02:00
|
|
|
done
|
2016-10-09 23:59:04 +02:00
|
|
|
if ! ${nonfree_mhwd};then
|
2016-10-10 22:07:49 +02:00
|
|
|
check_syslinux_optional "$2"
|
2016-10-09 23:59:04 +02:00
|
|
|
fi
|
2015-03-04 21:10:34 +01:00
|
|
|
}
|