makedist-openmamba-milestone1/platforms/installdvd/post.inc.sh

140 lines
4.6 KiB
Bash
Raw Normal View History

2011-05-19 16:08:22 +02:00
# installdvd post script
#
# creates a fake installation aimed at producing a kernel image and initrd
# for livecd boot
# make initramfs
for i in \
`find $MOUNTDIR/lib/modules/${KERNEL_MAJVER}${KERNEL_EXTRAVER}/kernel/drivers/ata/ -name *.ko`; do
modulename=${i/*ata\//}
echo "alias scsi_hostadapter ${modulename/\.ko/}" >> $MOUNTDIR/etc/modprobe.conf
done
for i in \
`find $MOUNTDIR/lib/modules/${KERNEL_MAJVER}${KERNEL_EXTRAVER}/kernel/drivers/scsi/ -name *.ko`; do
modulename=${i/*\//}
echo "alias scsi_hostadapter ${modulename/\.ko/}" >> $MOUNTDIR/etc/modprobe.conf
done
cat >> $MOUNTDIR/etc/modprobe.conf << _EOF
alias scsi_hostadapter ehci-hcd
alias scsi_hostadapter uhci-hcd
alias scsi_hostadapter ohci-hcd
alias scsi_hostadapter usb-storage
#alias init_module cdrom
alias init_module sg
alias init_module sr_mod
alias init_module ide-cd_mod
alias init_module usbhid
alias scsi_hostadapter isofs
alias init_module squashfs
_EOF
[ -e $MOUNTDIR2/boot/isolinux ] || mkdir -p $MOUNTDIR2/boot/isolinux
cp $TARGETDIR/platforms/$PLATFORM/initramfs-include.sh $MOUNTDIR/
chroot $MOUNTDIR depmod -ae ${KERNEL_MAJVER}${KERNEL_EXTRAVER}
LANG=${LANGUAGE}_${COUNTRY} chroot $MOUNTDIR mkinitramfs \
--with-udev --postrc=/initramfs-include.sh \
/boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \
${KERNEL_MAJVER}${KERNEL_EXTRAVER}
# Note: isolinux requires 8.3 filenames
cp $MOUNTDIR/boot/initramfs-${KERNEL_MAJVER}${KERNEL_EXTRAVER}.img.gz \
$MOUNTDIR2/boot/initrmfs.gz
cp $MOUNTDIR/boot/vmlinuz-${KERNEL_MAJVER}${KERNEL_EXTRAVER} \
$MOUNTDIR2/boot/vmlinuz
COMMON_OPTS="root= console=tty1 initrd=/boot/initrmfs.gz splash=silent,fadein"
# configure isolinux boot loader
cat > $MOUNTDIR2/boot/isolinux/isolinux.cfg << _EOF
timeout 100
prompt 1
display menu.txt
F1 help.txt
default 1
label 1
kernel /boot/vmlinuz
append video=uvesafb:800x600-32,ywrap,mtrr $COMMON_OPTS quiet
label 2
kernel /boot/vmlinuz
append video=uvesafb:1024x768-32,ywrap,mtrr $COMMON_OPTS quiet
label 3
kernel /boot/vmlinuz
append video=uvesafb:1280x1024-32,ywrap,mtrr $COMMON_OPTS quiet
label 1-freevideo
kernel /boot/vmlinuz
append video=uvesafb:800x600-32,ywrap,mtrr $COMMON_OPTS quiet
label 2-freevideo
kernel /boot/vmlinuz
append video=uvesafb:1024x768-32,ywrap,mtrr $COMMON_OPTS quiet
label 3-freevideo
kernel /boot/vmlinuz
append video=uvesafb:1280x1024-32,ywrap,mtrr $COMMON_OPTS quiet
label 4
kernel /boot/vmlinuz
append video=uvesafb:800x600-32,ywrap,mtrr $COMMON_OPTS quiet postplug=lowresvideo,freevideo
label 8
kernel /boot/vmlinuz
append video=uvesafb:off $COMMON_OPTS debug debug=1
label 9
kernel memtest
_EOF
# install isolinux binary
[ -e $MOUNTDIR/usr/lib/syslinux/isolinux.bin ] && cp $MOUNTDIR/usr/lib/syslinux/isolinux.bin $MOUNTDIR2/boot/isolinux/isolinux.bin ||
{ echo "Error: /boot/isolinux.bin not found. Please install the syslinux package.";
exit 1; }
# 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 $TARGETDIR/platforms/$PLATFORM/root/* $MOUNTDIR2/
# copy localized static files for specific platform
[ "$LANGUAGE" -a -e $TARGETDIR/platforms/$PLATFORM/root-$LANGUAGE ] &&
cp -a $TARGETDIR/platforms/$PLATFORM/root-$LANGUAGE/* $MOUNTDIR2/
# add buildinfo
releaseinfo=`cat $MOUNTDIR/etc/openmamba-release`
buildinfo="[ $PRODUCT_NAME `date \"+%x %X\"` ]"
sed -i "s|%releaseinfo%|$releaseinfo|" $MOUNTDIR2/boot/isolinux/menu.txt
sed -i "s|%buildinfo%|$buildinfo|" $MOUNTDIR2/boot/isolinux/menu.txt
echo "Adding base binary packages..."
LANG=${LANGUAGE:0:2} . $MOUNTDIR/usr/share/openmamba/pkggroups.db
add_binary_packages_to_repository $MOUNTDIR2/openmamba "$ALL_PKGS $EXTRA_PKGS"
[ "$ADDITIONAL_PKGS" ] && \
add_binary_packages_to_repository_nodeps $MOUNTDIR2/openmamba "$ADDITIONAL_PKGS"
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