makedist.inc.sh 4.94 KB
# execute platform specific script
[ -e $TARGETDIR/platforms/$PLATFORM/pre.inc.sh ] && . $TARGETDIR/platforms/$PLATFORM/pre.inc.sh

[ "$PRODUCT_NAME" ] && \
   MEDIA_NAME=`PLATFORM=$PRODUCT_NAME media_name` ||
   MEDIA_NAME=`media_name`

#if [ "$FORCE" = "1" -o ! -e "$LOCALSTATEDIR/$MEDIA_NAME" ]; then

[ $MEDIA = "raw" ] && create_raw_filesystem $LOCALSTATEDIR/$MEDIA_NAME $MEDIA_SIZE 1024k $ROOTFS

#create_livecd

create_rpm_database
create_devices
create_fstab "$ROOTDEV" "$ROOTFS"

install_rpms "filesystem gzip texinfo ldconfig bash libreadline glibc libncurses initscripts setup coreutils" "--nodeps --noorder --noscripts"

# Workaround: avoid a circular dependency with bash
INSTALLED="texinfo"

#install_rpms_by_target \
#   "Installing kernel..." mtd-base \
#   "$NOARCHDIR/filesystem*"

install_rpms_by_target "Installing base packages for ${MAKEDIST_TARGET} target" ${MAKEDIST_TARGET}-base "${RPMEXTRAARGS}"

install_kernel ${KERNEL_EXTRAVER}${KERNEL_PLATFORM} "${KERNEL_ADDITIONAL}"

# disable the service command
#
mv $MOUNTDIR/sbin/service $MOUNTDIR/sbin/service.preinst
ln -sf /bin/true $MOUNTDIR/sbin/service

# change the uname command
#
mv $MOUNTDIR/bin/uname $MOUNTDIR/bin/uname.preinst
CURRKERNEL=`uname -r`
cat > $MOUNTDIR/bin/uname << _EOF
#!/bin/bash
/bin/uname.preinst \$@ | sed "s|${CURRKERNEL}|${KERNEL_MAJVER}${KERNEL_EXTRAVER}|"
_EOF
chmod +x $MOUNTDIR/bin/uname

# set system hostname and domain
[[ "$TARGET_HOSTNAME" ]] || TARGET_HOSTNAME="$MAKEDIST_TARGET"
[[ "$TARGET_DOMAIN" ]] || TARGET_DOMAIN="localdomain"

sed -i "s|HOSTNAME=.*|HOSTNAME=$TARGET_HOSTNAME|" $MOUNTDIR/etc/sysconfig/network
sed -i "s|\(127\.0\.0\.1\W*\)\(.*\)|\1 $TARGET_HOSTNAME.$TARGET_DOMAIN $TARGET_HOSTNAME \2|" \
   $MOUNTDIR/etc/hosts

#install_rpms_by_target "Installing tools packages for ${MAKEDIST_TARGET} target" ${MAKEDIST_TARGET}-tools ""

install_rpms_by_target "Installing ${PLATFORM} platform packages" ${MAKEDIST_TARGET}-${PLATFORM} "${RPMEXTRAARGS}"

[ "$LANGUAGE" ] && install_rpms_by_target "Installing ${PLATFORM} platform localization packages ($LANGUAGE)" ${MAKEDIST_TARGET}-${PLATFORM}-${LANGUAGE} "${RPMEXTRAARGS}"

update_modules_dependencies ${KERNEL_VER}${KERNEL_EXTRAVER}

if [ "$APPLICATION_TARGET" ]; then
   install_rpms_by_target "Installing application packages." "$APPLICATION_TARGET" "${RPMEXTRAARGS}"
fi

#   erase_rpm_database
if [ ${DEBUG:-0} -gt 0 ]; then
   install_rpms_by_target "Installing debugging packages." ${MAKEDIST_TARGET}-debug "${RPMEXTRAARGS}"
   cat > $MOUNTDIR/etc/sysconfig/network-devices/ifconfig.eth0 << _EOF
IF=eth0
ONBOOT=yes
ZONE=local
BOOTPROTO=dhcp
_EOF

fi

[ "$LANGUAGE" ] && {

[ "$LANGUAGE" = "en" ] && KEYMAP=us || KEYMAP="$LANGUAGE"

# configure localization
cat > $MOUNTDIR/etc/sysconfig/keyboard << _EOF
KEYMAP=$KEYMAP.map
XKB_LAYOUT=$KEYMAP
XKB_MODEL=pc105
XKB_OPTIONS=
_EOF

[ "$COUNTRY" ] && {
cat > $MOUNTDIR/etc/sysconfig/i18n << _EOF
LANG=${LANGUAGE}_${COUNTRY}.UTF-8
_EOF
}

}

echo "Deleting unuseful files..."
# delete unused localizations
#
find $MOUNTDIR/usr/share/locale \
 -maxdepth 1 -mindepth 1 -type d \
! -name it* ! -name en* ! -name C ! -name l10n -exec rm -rf {} \;

#$CHROOTCMD chkconfig --add acpid ||
#   { echo "$mkcd_me: fatal error, aborting installation" >&2
#      { (exit 1); exit 1; }; }

# configure extlinux boot loader
#cat > $MOUNTDIR/boot/extlinux.conf << _EOF
#DEFAULT $PLATFORM
#LABEL $PLATFORM
#KERNEL /boot/vmlinuz-${KERNEL_VER}${KERNEL_EXTRAVER}
#APPEND video=vesafb:1280x1024-32 root=$ROOTDEV console=tty1
#resume2=swap:$SWAPDEV
#_EOF

if [ "$U_BOOT" ]; then
echo "Copying u-boot Image for Kernel"
#mkimage -A ppc -O linux -T kernel -C gzip -a 0x8000 -e 0x8000 \
#              -n "$DISTRONAME 2.6" -d $MOUNTDIR/boot/vmlinuz-2.6.12 $DISTRONAME-$MAKEDIST_TARGET-uImage.bin
fi

# disable parport
#sed -i "/parport_pc/d" $MOUNTDIR/etc/modprobe.conf

# disable multithreaded init ?
if [ ${MULTITHREAD:-0} -gt 0 ]; then
   sed -i "s|multithread=1|multithread=0|" $MOUNTDIR/etc/sysconfig/rc
fi

# blacklist buggy ehci_hcd
#echo "blacklist ehci_hcd" > $MOUNTDIR/etc/modprobe.conf.d/ehci_hcd


# set rootdev on extlinux
[ -e $MOUNTDIR/boot/extlinux.conf ] && sed -i "s|\([^::alpha]root=\)[^ ]*|\1$ROOTDEV|" $MOUNTDIR/boot/extlinux.conf

# execute platform specific script
[ -e $TARGETDIR/platforms/$PLATFORM/post.inc.sh ] && . $TARGETDIR/platforms/$PLATFORM/post.inc.sh

# restore the service command
#
rm -f $MOUNTDIR/sbin/service
mv $MOUNTDIR/sbin/service.preinst $MOUNTDIR/sbin/service

# restore the uname command
#
rm -f $MOUNTDIR/bin/uname
mv $MOUNTDIR/bin/uname.preinst $MOUNTDIR/bin/uname

# copy static files for target
[ -e $TARGETDIR/root ] && 
   cp -a $TARGETDIR/root/* $MOUNTDIR/

# copy static files for specific platform
[ -e $TARGETDIR/platforms/$PLATFORM/root ] && 
   cp -a $TARGETDIR/platforms/$PLATFORM/root/* $MOUNTDIR/

# copy localized static files for specific platform
[ "$LANGUAGE" -a -e $TARGETDIR/platforms/$PLATFORM/root-$LANGUAGE ] &&
   cp -a $TARGETDIR/platforms/$PLATFORM/root-$LANGUAGE/* $MOUNTDIR/

produce_media