lorax/rewrite/scratch/upd-instroot

103 lines
3.3 KiB
Plaintext
Executable File

. $(dirname $0)/buildinstall.functions
# ..........this is the pylorax.instroot.installPackages() function in lorax
expandPackageSet() {
if [ -n "$UPDATES" ]; then
(cd $UPDATES; find) | (cd $UPDATES ; /bin/cpio --quiet -pmdu $YUMDIR)
fi
}
chown -R root:root $DEST
chmod -R a+rX-w $DEST
sed -i 's|\(installforallkernels\) = 0|\1 = 1|' $DEST/etc/yum/pluginconf.d/fedorakmod.conf
#
# Manual pages in rescue: We dont have man pages in the image, so we point everything (The pages
# and the man scripts to the /mnt/sysimage. We want the man command to depend only on the
# man.conf file, so we don't use the $MANPATH env variable. The executables stay unchanged as
# they will be soft links to /mnt/sysimage.
#
echo "Fixing up /etc/man.config to point into /mnt/sysimage"
#
# Lets avoid the lines with MANPATH_MAP for now
#
sed -i "s,^MANPATH[^_MAP][ \t]*,&/mnt/sysimage," $DEST/etc/man.config
#
# Lets change the lines with MANPATH_MAP. Don't know how much of a difference this will make.
#
sed -i "s,^MANPATH_MAP[ \t]*[a-zA-Z0-9/]*[ \t]*,&/mnt/sysimage," $DEST/etc/man.config
mv $DEST/usr/sbin/anaconda $DEST/usr/bin/anaconda
mv $DEST/usr/lib/anaconda-runtime/lib* $DEST/usr/$LIBDIR 2>/dev/null
mv $DEST/etc/yum.repos.d $DEST/etc/anaconda.repos.d
find $DEST -type d | xargs chmod 755
if [ -f $DEST/bin/bash ]; then
rm -f $DEST/bin/ash
ln -s bash $DEST/bin/sh
else
ln -sf busybox $DEST/bin/sh
fi
[ -d $DEST/bin ] || die "ERROR: directory missing: $DEST/bin"
[ -d $DEST/sbin ] || die "ERROR: directory missing: $DEST/sbin"
(cd $DEST/bin; find) | (cd $DEST/bin; /bin/cpio --quiet -pdmu $DEST/usr/bin)
(cd $DEST/sbin; find) | (cd $DEST/sbin; /bin/cpio --quiet -pdmu $DEST/usr/sbin)
rm -rf $DEST/bin
rm -rf $DEST/sbin
# Fix relative links like /usr/bin/udevinfo -> ../../sbin/udevadm
for brokenlink in $(find $DEST/usr/{bin,sbin} -follow -lname '*') ; do
target="$(readlink $brokenlink)"
for pathbit in bin sbin; do
# if it starts with "../../sbin/", remove that
newtarget="${target##../../$pathbit/}"
# if we removed something, replace it with the proper path
if [ "$newtarget" != "$target" ]; then
# make it ../sbin/ instead
ln -sf "../$pathbit/$newtarget" "$brokenlink"
fi
done
done
find $DEST -name "*.a" | grep -v kernel-wrapper/wrapper.a | xargs rm -rf
find $DEST -name "lib*.la" |grep -v "usr/$LIBDIR/gtk-2.0" | xargs rm -rf
# nuke some python stuff we don't need
for d in idle distutils bsddb lib-old hotshot doctest.py pydoc.py site-packages/japanese site-packages/japanese.pth ; do
rm -rf $DEST/$d
done
$DEST/usr/lib/anaconda-runtime/scrubtree $DEST
echo "Creating debug dir"
mkdir -p $DEST/usr/lib/debug
mkdir -p $DEST/usr/src/debug
find $DEST -name "*.py" | while read fn; do
rm -f ${fn}o
rm -f ${fn}c
ln -sf /dev/null ${fn}c
done
# some python stuff we don't need for install image
rm -rf $DEST/usr/$LIBDIR/python?.?/site-packages/distutils/
rm -rf $DEST/usr/$LIBDIR/python?.?/site-packages/lib-dynload/japanese
rm -rf $DEST/usr/$LIBDIR/python?.?/site-packages/encodings/
rm -rf $DEST/usr/$LIBDIR/python?.?/site-packages/compiler/
rm -rf $DEST/usr/$LIBDIR/python?.?/site-packages/email/test/
rm -rf $DEST/usr/$LIBDIR/python?.?/site-packages/curses/
rm -rf $DEST/usr/$LIBDIR/python?.?/site-packages/pydoc.py