2014-08-21 17:32:21 +02:00
|
|
|
# livecd post script
|
|
|
|
#
|
|
|
|
# creates a fake installation aimed at producing a kernel image and initrd
|
|
|
|
# for livecd boot
|
|
|
|
|
|
|
|
# make initramfs
|
|
|
|
|
|
|
|
[ -e $MOUNTDIR2/boot/isolinux ] || mkdir -p $MOUNTDIR2/boot/isolinux
|
|
|
|
|
|
|
|
ISOID=
|
|
|
|
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
|
|
|
|
chroot $MOUNTDIR depmod -a ${KERNEL_MAJVER}${K}
|
|
|
|
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR dracut \
|
|
|
|
--filesystems "autofs4 ext3 ext4 overlayfs squashfs isofs reiserfs" \
|
|
|
|
--nomdadmconf --nolvmconf \
|
|
|
|
/boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \
|
|
|
|
${KERNEL_MAJVER}${K}
|
|
|
|
|
|
|
|
# Note: isolinux requires 8.3 filenames
|
|
|
|
cp $MOUNTDIR/boot/initramfs-${KERNEL_MAJVER}${K}.img.gz \
|
|
|
|
$MOUNTDIR2/boot/initrd${ISOID}.gz
|
|
|
|
|
|
|
|
cp $MOUNTDIR/boot/vmlinuz-${KERNEL_MAJVER}${K} \
|
|
|
|
$MOUNTDIR2/boot/vmlinuz${ISOID}
|
|
|
|
|
|
|
|
ISOID=$(($ISOID + 1))
|
|
|
|
done
|
|
|
|
|
|
|
|
# add buildinfo
|
|
|
|
buildinfo="`cat $MOUNTDIR/etc/openmamba-release` ${PLATFORM}"
|
|
|
|
|
|
|
|
# configure isolinux boot loader
|
|
|
|
cat > $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF
|
|
|
|
PROMPT 0
|
|
|
|
TIMEOUT 20
|
|
|
|
DEFAULT vesamenu.c32
|
|
|
|
MENU TITLE ${buildinfo} (${KERNEL_MAJVER} kernel)
|
|
|
|
MENU BACKGROUND openmamba.png
|
|
|
|
MENU COLOR TITLE 1;32;49 #ff00993d #00000000 std
|
|
|
|
_EOF
|
|
|
|
|
|
|
|
ISOID=
|
|
|
|
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
|
|
|
|
cat >> $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF
|
|
|
|
LABEL default-${KERNEL_MAJVER}${K}
|
|
|
|
MENU LABEL default (${KERNEL_MAJVER}${K})
|
|
|
|
kernel /boot/vmlinuz${ISOID}
|
|
|
|
append initrd=/boot/initrd${ISOID}.gz root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 quiet splash vga=792
|
|
|
|
_EOF
|
|
|
|
ISOID=$(($ISOID + 1))
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "MENU SEPARATOR" >> $MOUNTDIR2/boot/isolinux/isolinux.cfg
|
|
|
|
ISOID=
|
|
|
|
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
|
|
|
|
cat >> $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF
|
|
|
|
LABEL vga800-${KERNEL_MAJVER}${K}
|
|
|
|
MENU LABEL VGA 800x600 no modeset (${KERNEL_MAJVER}${K})
|
|
|
|
kernel /boot/vmlinuz${ISOID}
|
|
|
|
append initrd=/boot/initrd${ISOID}.gz root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 quiet splash vga=789 nomodeset
|
|
|
|
_EOF
|
|
|
|
ISOID=$(($ISOID + 1))
|
|
|
|
done
|
|
|
|
|
|
|
|
ISOID=
|
|
|
|
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
|
|
|
|
cat >> $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF
|
|
|
|
LABEL vga1024-${KERNEL_MAJVER}${K}
|
|
|
|
MENU LABEL VGA 1024x768 no modeset (${KERNEL_MAJVER}${K})
|
|
|
|
kernel /boot/vmlinuz${ISOID}
|
|
|
|
append initrd=/boot/initrd${ISOID}.gz root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 quiet splash vga=792 nomodeset
|
|
|
|
_EOF
|
|
|
|
ISOID=$(($ISOID + 1))
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "MENU SEPARATOR" >> $MOUNTDIR2/boot/isolinux/isolinux.cfg
|
|
|
|
ISOID=
|
|
|
|
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
|
|
|
|
cat >> $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF
|
|
|
|
LABEL debug-${KERNEL_MAJVER}${K}
|
|
|
|
MENU LABEL Debug mode (${KERNEL_MAJVER}${K})
|
|
|
|
kernel /boot/vmlinuz${ISOID}
|
|
|
|
append initrd=/boot/initrd${ISOID}.gz root=live:LABEL=${MAKEDIST_TARGET}_${PLATFORM} ro selinux=0 rddebug nomodeset
|
|
|
|
_EOF
|
|
|
|
ISOID=$(($ISOID + 1))
|
|
|
|
done
|
|
|
|
|
|
|
|
cat >> $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF
|
|
|
|
MENU SEPARATOR
|
|
|
|
LABEL memtest
|
|
|
|
MENU LABEL Memory test
|
|
|
|
kernel memtest
|
|
|
|
MENU SEPARATOR
|
|
|
|
MENU SEPARATOR
|
|
|
|
LABEL -
|
|
|
|
MENU LABEL $PRODUCT_NAME build:`date -R`
|
|
|
|
MENU DISABLE
|
|
|
|
_EOF
|
|
|
|
|
|
|
|
# install isolinux binary
|
|
|
|
[ -e $MOUNTDIR/usr/share/syslinux/isolinux.bin ] && cp $MOUNTDIR/usr/share/syslinux/isolinux.bin $MOUNTDIR2/boot/isolinux/isolinux.bin ||
|
|
|
|
{ echo "Error: /usr/share/syslinux/isolinux.bin not found. Please install the syslinux package.";
|
|
|
|
exit 1; }
|
|
|
|
|
|
|
|
# copy syslinux addons to final root /boot dir
|
|
|
|
cp $MOUNTDIR/usr/share/syslinux/vesamenu.c32 $MOUNTDIR2/boot/isolinux/
|
|
|
|
|
|
|
|
# install memtest
|
|
|
|
[ -e $MOUNTDIR/boot/memtest.bin ] && cp $MOUNTDIR/boot/memtest.bin $MOUNTDIR2/boot/isolinux/memtest ||
|
|
|
|
{ echo "Error: /boot/memtest.bin not found. Please install the memtest86 package.";
|
|
|
|
exit 1; }
|
|
|
|
|
|
|
|
# copy static files for specific platform
|
|
|
|
[ -e $TARGETDIR/platforms/$PLATFORM/root ] &&
|
|
|
|
cp -a --no-preserve=ownership $TARGETDIR/platforms/$PLATFORM/root/* $MOUNTDIR2/
|
|
|
|
|
|
|
|
# copy localized static files for specific platform
|
|
|
|
[ "$LANGUAGE" -a -e $TARGETDIR/platforms/$PLATFORM/root-$LANGUAGE ] &&
|
|
|
|
cp -a --no-preserve=ownership $TARGETDIR/platforms/$PLATFORM/root-$LANGUAGE/* $MOUNTDIR2/
|
|
|
|
|
|
|
|
# add buildinfo
|
|
|
|
buildinfo="`cat $MOUNTDIR/etc/openmamba-release` [$PRODUCT_NAME build:`date +%c`]"
|
|
|
|
sed -i "s|%buildinfo%|$buildinfo|" $MOUNTDIR2/boot/isolinux/menu.txt
|
|
|
|
|
2015-04-09 10:22:43 +02:00
|
|
|
#
|
|
|
|
# EFI support section BEGIN
|
|
|
|
#
|
|
|
|
|
|
|
|
# create EFI grub 32 and 64 bit images
|
|
|
|
mkdir -p $MOUNTDIR2/EFI/BOOT/
|
|
|
|
grub-mkimage -o $MOUNTDIR2/EFI/BOOT/bootx64.efi -O x86_64-efi -p /EFI/BOOT \
|
|
|
|
part_gpt part_msdos ntfs ntfscomp hfsplus fat ext2 normal chain boot linux echo \
|
|
|
|
help gfxterm gettext png efi_gop efi_uga search search_label search_fs_uuid \
|
|
|
|
iso9660 configfile || {
|
|
|
|
errorAndExit $"Error: unable to create GRUB x86_64-efi image"
|
|
|
|
}
|
|
|
|
|
|
|
|
# basic extlinux.conf -> grub.cfg conversion
|
|
|
|
echo "search --no-floppy --label --set=root openmamba_live" > $MOUNTDIR2/EFI/BOOT/grub.cfg
|
|
|
|
while read line; do
|
|
|
|
case $line in
|
|
|
|
"MENU LABEL "*) [ "$CURR_BRACKET_OPEN" = "1" ] && echo "}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
|
|
|
|
echo "menuentry \"${line/MENU LABEL }\" {" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
|
|
|
|
CURR_BRACKET_OPEN=1
|
|
|
|
;;
|
|
|
|
"kernel "*) CURR_KERNEL="${line/kernel }"
|
|
|
|
echo "echo \"Loading ${CURR_KERNEL}\"" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
|
|
|
|
;;
|
|
|
|
"append "*) set -- ${line/append initrd=}
|
|
|
|
CURR_INITRD="$1"
|
|
|
|
CURR_CMDLINE="${line/append initrd=$CURR_INITRD}"
|
|
|
|
echo "linux ${CURR_KERNEL} ${CURR_CMDLINE}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
|
|
|
|
echo "echo \"Loading ${CURR_INITRD}\"" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
|
|
|
|
echo "initrd ${CURR_INITRD}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
|
|
|
|
echo "}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
|
|
|
|
CURR_BRACKET_OPEN=0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done < $MOUNTDIR2/boot/isolinux/isolinux.cfg
|
|
|
|
[ "$CURR_BRACKET_OPEN" = "1" ] && echo "}" >> $MOUNTDIR2/EFI/BOOT/grub.cfg
|
|
|
|
|
|
|
|
#
|
|
|
|
# EFI support section END
|
|
|
|
#
|
|
|
|
|
2014-08-21 17:32:21 +02:00
|
|
|
#echo "Adding binary packages from pkggroups.db..."
|
|
|
|
#. $LOCALSTATEDIR/.${MEDIA_NAMES[0]}.distinfo
|
|
|
|
#LANG=${LANGUAGE:0:2} . $MOUNTDIR/usr/share/openmamba/pkggroups.db
|
|
|
|
#
|
|
|
|
#add_binary_packages_to_repository $MOUNTDIR2/openmamba "$ALL_PKGS $EXTRA_PKGS" "$INSTALLED"
|
|
|
|
|
|
|
|
#echo "Generating APT database..."
|
|
|
|
#ln -s RPMS/$arch $MOUNTDIR2/openmamba/RPMS.$arch
|
|
|
|
#genbasedir $MOUNTDIR2/openmamba
|
|
|
|
#mkdir $MOUNTDIR2/.disk
|
|
|
|
#cat $MOUNTDIR/etc/openmamba-release > $MOUNTDIR2/.disk/info
|
|
|
|
|
|
|
|
# Finally produce the media
|
|
|
|
MOUNTDIR=$MOUNTDIR2 produce_media $MEDIA_NAME
|
|
|
|
|
|
|
|
for i in $SUBPLATFORM; do
|
|
|
|
. $TARGETDIR/platforms/$i/settings.inc
|
|
|
|
CURR_MEDIA_NAME=`PLATFORM=$i media_name`
|
|
|
|
cat >> $LOCALSTATEDIR/.$MEDIA_NAME.inc.html << _EOF
|
|
|
|
<br><p><b>Root target(s):</b>
|
|
|
|
<div><table width="90%"><tr><td>
|
|
|
|
_EOF
|
|
|
|
cat $LOCALSTATEDIR/.$CURR_MEDIA_NAME.inc.html >> \
|
|
|
|
$LOCALSTATEDIR/.$MEDIA_NAME.inc.html
|
|
|
|
echo "</td></tr></table></div>" >> $LOCALSTATEDIR/.$MEDIA_NAME.inc.html
|
|
|
|
done
|
|
|
|
|
|
|
|
exit 0
|