makedist-openmamba/makedist.inc.sh

193 lines
6.0 KiB
Bash

# execute platform specific script
[ -e $TARGETDIR/platforms/$PLATFORM/pre.inc.sh ] && . $TARGETDIR/platforms/$PLATFORM/pre.inc.sh
[ "$PRODUCT_NAME" ] && \
MEDIA_NAME=`PLATFORM=$PRODUCT_NAME VARIANT=$VARIANT medium_name` ||
MEDIA_NAME=`VARIANT=$VARIANT medium_name`
#if [ "$FORCE" = "1" -o ! -e "$LOCALSTATEDIR/$MEDIA_NAME" ]; then
#create_livecd
initialize_root_dir
create_rpm_database
create_devices
echo "Installing preparation packages..."
install_rpms "filesystem gzip texinfo ldconfig bash libreadline glibc libncurses initscripts setup coreutils chkconfig \
libattr libstdc++6 libpam pam" "--nodeps --noorder --noscripts"
[ "$LANGUAGE" ] && {
[ "$LANGUAGE" = "en" ] && KEYMAP=us || KEYMAP="$LANGUAGE"
# configure localization
if [ ! "$MULTILANGUAGE" ]; then
cat > $MOUNTDIR/etc/vconsole.conf << _EOF
KEYMAP=$KEYMAP
FONT=lat9w-16
FONT_MAP=8859-1_to_uni
FONT_UNIMAP=
UNICODE=1
_EOF
else
cat > $MOUNTDIR/etc/vconsole.conf << _EOF
FONT=lat9w-16
FONT_MAP=8859-1_to_uni
FONT_UNIMAP=
UNICODE=1
_EOF
fi
[ "$COUNTRY" ] && {
if [ ! "$MULTILANGUAGE" ]; then
cat > $MOUNTDIR/etc/locale.conf << _EOF
LANG=${LANGUAGE}_${COUNTRY}.UTF-8
LC_COLLATE=C
_EOF
else
cat > $MOUNTDIR/etc/locale.conf << _EOF
LC_COLLATE=C
_EOF
fi
}
}
# Workaround: avoid a circular dependency with bash
INSTALLED="texinfo"
#install_rpms_by_target \
# "Installing kernel..." mtd-base \
# "$NOARCHDIR/filesystem*"
#if [ "$BUILDARCH" != "$ARCH" ]; then
# NOSCRIPTARG="--noscripts"
#fi
if [ "$BUILDARCH" != "$ARCH" ]; then
pre_qemu
QEMU_COPIED_FOR_INST=1
fi
install_rpms_by_target "Installing base packages for ${MAKEDIST_TARGET} target" ${MAKEDIST_TARGET}-base "--replacepkgs ${RPMEXTRAARGS} ${NOSCRIPTARG}"
pre_install_rpms
if [ ! "$KERNEL_IGNORE" ]; then
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
install_kernel ${K}${KERNEL_PLATFORM} "${KERNEL_ADDITIONAL}"
done
fi
# set system hostname and domain
[[ "$TARGET_HOSTNAME" ]] || TARGET_HOSTNAME="$MAKEDIST_TARGET"
[[ "$TARGET_DOMAIN" ]] || TARGET_DOMAIN="localdomain"
echo "$TARGET_HOSTNAME.$TARGET_DOMAIN" > $MOUNTDIR/etc/hostname
#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}"
if [ "$MULTILANGUAGE" ]; then
for l in $MULTILANGUAGE; do
install_rpms_by_target "Installing ${PLATFORM} platform localization packages for language $l" ${MAKEDIST_TARGET}-${PLATFORM}-${l} "${RPMEXTRAARGS}"
done
else
[ "$LANGUAGE" ] && install_rpms_by_target "Installing ${PLATFORM} platform localization packages for language $LANGUAGE" ${MAKEDIST_TARGET}-${PLATFORM}-${LANGUAGE} "${RPMEXTRAARGS}"
fi
[ "$ARCH" ] && install_rpms_by_target "Installing ${PLATFORM} platform packages for arch $ARCH" ${MAKEDIST_TARGET}-${PLATFORM}-${ARCH} "${RPMEXTRAARGS}"
if [ "$APPLICATION_TARGET" ]; then
add_additional_defs_file /usr/share/openmamba/pkggroups.db
for t in $APPLICATION_TARGET; do
install_rpms_by_target "Installing $t application packages." "$t" "${RPMEXTRAARGS}"
done
fi
if [ ${DEBUG:-0} -gt 0 ]; then
install_rpms_by_target "Installing debugging packages." ${MAKEDIST_TARGET}-debug "${RPMEXTRAARGS}"
cat > $MOUNTDIR/etc/sysconfig/network-scripts/ifcfg-eth0 << _EOF
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
#NM_CONTROLLED=no
_EOF
fi
# delete unused localizations
#
if [ ! "$MULTILANGUAGE" ]; then
echo "Deleting other languages l10n files..."
for d in /usr/share/locale /opt/kde/share/locale \
/opt/kde/share/locale/l10n /opt/kde3/share/locale; do
find ${MOUNTDIR}${d} -maxdepth 1 -mindepth 1 -type d \
! -name ${LANGUAGE}* ! -name en* ! -name C ! -name l10n -exec rm -rf {} \; 2>/dev/null
done
fi
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
# 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
# cleanup: prevent generating a cleanfs script crash due to a unionfs bug
rm -rf $MOUNTDIR/tmp/.ICE-unix
rm -rf $MOUNTDIR/tmp/kde-root
# copy static files for target
[ -e $TARGETDIR/root ] &&
cp -a --no-preserve=ownership $TARGETDIR/root/* $MOUNTDIR/
# copy static files for specific platform
[ -e $TARGETDIR/platforms/$PLATFORM/root -a "`ls $TARGETDIR/platforms/$PLATFORM/root/* 2>/dev/null`" ] &&
cp -a --no-preserve=ownership $TARGETDIR/platforms/$PLATFORM/root/* $MOUNTDIR/
# copy localized static files for specific platform
if [ "$MULTILANGUAGE" ]; then
for l in $MULTILANGUAGE; do
[ -e $TARGETDIR/platforms/$PLATFORM/root-$l ] &&
cp -a --no-preserve=ownership $TARGETDIR/platforms/$PLATFORM/root-$l/* $MOUNTDIR/
done
else
[ "$LANGUAGE" -a -e $TARGETDIR/platforms/$PLATFORM/root-$LANGUAGE ] &&
cp -a --no-preserve=ownership $TARGETDIR/platforms/$PLATFORM/root-$LANGUAGE/* $MOUNTDIR/
fi
# enable additional smart repositories
if [ "$SMART_CHANNELS_ENABLE" != "" ]; then
for r in $SMART_CHANNELS_ENABLE; do
chroot $MOUNTDIR smart channel --enable $r
done
echo "$SMART_CHANNELS_ENABLE" > $MOUNTDIR/etc/smart/openmamba-install-enabled-channels
fi
if [ ! "$KERNEL_IGNORE" ]; then
for K in $KERNEL_EXTRAVER $KERNEL_MORE_EXTRAVER; do
echo "Updating modules dependencies for kernel ${KERNEL_MAJVER}${K}"
update_modules_dependencies ${KERNEL_MAJVER}${K}
done
fi
# rpm database
post_install_rpms
clean_rpm_database
[ "$QEMU_COPIED_FOR_INST" ] && post_qemu
produce_media