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.
|
|
|
|
|
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
|
2016-10-15 11:49:38 +02:00
|
|
|
}
|
|
|
|
|
2016-10-24 16:56:42 +02:00
|
|
|
prepare_initramfs(){
|
2017-03-09 12:23:07 +01:00
|
|
|
cp ${DATADIR}/mkinitcpio.conf $1/etc/mkinitcpio-${iso_name}.conf
|
|
|
|
local _kernver=$(cat $1/usr/lib/modules/*/version)
|
2017-02-15 01:18:20 +01:00
|
|
|
if [[ -n ${gpgkey} ]]; then
|
|
|
|
su ${OWNER} -c "gpg --export ${gpgkey} >${USERCONFDIR}/gpgkey"
|
|
|
|
exec 17<>${USERCONFDIR}/gpgkey
|
|
|
|
fi
|
2017-03-09 12:23:07 +01:00
|
|
|
MISO_GNUPG_FD=${gpgkey:+17} chroot-run $1 \
|
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
|
2017-02-15 01:18:20 +01:00
|
|
|
|
|
|
|
if [[ -n ${gpgkey} ]]; then
|
|
|
|
exec 17<&-
|
|
|
|
fi
|
2017-02-16 22:18:47 +01:00
|
|
|
if [[ -f ${USERCONFDIR}/gpgkey ]]; then
|
|
|
|
rm ${USERCONFDIR}/gpgkey
|
|
|
|
fi
|
2015-03-04 10:42:15 +01:00
|
|
|
}
|
|
|
|
|
2016-10-24 16:56:42 +02:00
|
|
|
prepare_boot_extras(){
|
2018-08-26 16:21:28 +02:00
|
|
|
cp $1/boot/amd-ucode.img $2/amd_ucode.img
|
2016-09-15 23:58:18 +02:00
|
|
|
cp $1/boot/intel-ucode.img $2/intel_ucode.img
|
2018-08-26 16:43:54 +02:00
|
|
|
cp $1/usr/share/licenses/amd-ucode/LICENSE $2/amd_ucode.LICENSE
|
2016-09-15 23:58:18 +02:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2017-03-23 21:15:35 +01:00
|
|
|
prepare_grub(){
|
2017-03-24 18:19:42 +01:00
|
|
|
local platform=i386-pc img='core.img' grub=$2/boot/grub efi=$2/efi/boot \
|
2019-05-03 22:23:21 +02:00
|
|
|
data_live=$1/usr/share/grub lib=usr/lib/grub prefix=(hd0)/boot/grub data=/usr/share/grub \
|
2017-04-02 15:00:12 +02:00
|
|
|
path="${work_dir}/rootfs"
|
2017-03-24 11:47:53 +01:00
|
|
|
|
2017-03-24 18:19:42 +01:00
|
|
|
prepare_dir ${grub}/${platform}
|
2017-03-24 11:47:53 +01:00
|
|
|
|
2017-03-31 19:38:19 +02:00
|
|
|
cp ${data_live}/cfg/*.cfg ${grub}
|
2017-03-24 11:47:53 +01:00
|
|
|
|
2017-04-02 15:00:12 +02:00
|
|
|
cp ${path}/${lib}/${platform}/* ${grub}/${platform}
|
2017-03-24 11:47:53 +01:00
|
|
|
|
2017-03-24 18:19:42 +01:00
|
|
|
msg2 "Building %s ..." "${img}"
|
2017-03-24 11:47:53 +01:00
|
|
|
|
2019-04-28 12:33:41 +02:00
|
|
|
grub-mkimage -d ${grub}/${platform} -o ${grub}/${platform}/${img} -O ${platform} -p ${prefix} biosdisk iso9660 part_msdos part_gpt fat ntfs
|
2017-03-24 11:47:53 +01:00
|
|
|
|
2017-03-24 18:19:42 +01:00
|
|
|
cat ${grub}/${platform}/cdboot.img ${grub}/${platform}/${img} > ${grub}/${platform}/eltorito.img
|
2017-03-24 11:47:53 +01:00
|
|
|
|
|
|
|
case ${target_arch} in
|
|
|
|
'i686')
|
2017-03-24 18:19:42 +01:00
|
|
|
platform=i386-efi
|
|
|
|
img=bootia32.efi
|
2017-03-23 21:15:35 +01:00
|
|
|
;;
|
|
|
|
'x86_64')
|
2017-03-24 18:19:42 +01:00
|
|
|
platform=x86_64-efi
|
|
|
|
img=bootx64.efi
|
2017-03-23 21:15:35 +01:00
|
|
|
;;
|
|
|
|
esac
|
2017-03-24 11:47:53 +01:00
|
|
|
|
2017-03-23 21:15:35 +01:00
|
|
|
prepare_dir ${efi}
|
2017-03-24 18:19:42 +01:00
|
|
|
prepare_dir ${grub}/${platform}
|
2017-03-24 11:47:53 +01:00
|
|
|
|
2017-04-02 15:00:12 +02:00
|
|
|
cp ${path}/${lib}/${platform}/* ${grub}/${platform}
|
2017-03-24 11:47:53 +01:00
|
|
|
|
2017-03-24 18:19:42 +01:00
|
|
|
msg2 "Building %s ..." "${img}"
|
2016-10-09 18:04:22 +02:00
|
|
|
|
2019-04-28 12:33:41 +02:00
|
|
|
grub-mkimage -d ${grub}/${platform} -o ${efi}/${img} -O ${platform} -p ${prefix} iso9660 part_msdos part_gpt fat ntfs
|
2017-03-24 11:47:53 +01:00
|
|
|
|
2017-03-23 21:15:35 +01:00
|
|
|
prepare_dir ${grub}/themes
|
2017-03-31 19:38:19 +02:00
|
|
|
cp -r ${data_live}/themes/${iso_name}-live ${grub}/themes/
|
2017-03-23 21:15:35 +01:00
|
|
|
cp ${data}/unicode.pf2 ${grub}
|
2017-03-31 19:38:19 +02:00
|
|
|
cp -r ${data_live}/{locales,tz} ${grub}
|
2017-03-24 11:47:53 +01:00
|
|
|
|
2018-10-02 20:12:02 +02:00
|
|
|
msg2 "Set menu_show_once=1 in '${grub}/grubenv'"
|
|
|
|
grub-editenv ${grub}/grubenv set menu_show_once=1
|
|
|
|
|
2017-03-31 19:38:19 +02:00
|
|
|
local size=4M mnt="${mnt_dir}/efiboot" efi_img="$2/efi.img"
|
2017-03-23 21:15:35 +01:00
|
|
|
msg2 "Creating fat image of %s ..." "${size}"
|
2017-03-26 10:49:52 +02:00
|
|
|
truncate -s ${size} "${efi_img}"
|
|
|
|
mkfs.fat -n MISO_EFI "${efi_img}" &>/dev/null
|
|
|
|
prepare_dir "${mnt}"
|
2017-03-27 15:32:47 +02:00
|
|
|
mount_img "${efi_img}" "${mnt}"
|
2017-03-23 21:15:35 +01:00
|
|
|
prepare_dir ${mnt}/efi/boot
|
2017-03-26 17:23:30 +02:00
|
|
|
msg2 "Building %s ..." "${img}"
|
2019-04-28 12:33:41 +02:00
|
|
|
grub-mkimage -d ${grub}/${platform} -o ${mnt}/efi/boot/${img} -O ${platform} -p ${prefix} iso9660 part_msdos part_gpt fat ntfs
|
2017-03-23 21:15:35 +01:00
|
|
|
umount_img "${mnt}"
|
2015-03-04 21:10:34 +01:00
|
|
|
}
|