#!/bin/bash ORIGDIR=`pwd` COMPONENT="" DEBUG="" if [ "$1" == "--debug" ]; then DEBUG="--debug" shift fi if [ "$1" == "--comp" ]; then COMPONENT=$2 shift; shift fi if [ -z "$1" ]; then echo "upd-instroot: updates instimage from a Red Hat RPMS directory" echo "usage: $0 --comp [templatedir] [instroot]" exit 1 fi if [ ! -d $1 ]; then if [ -z "$ARCH" ]; then echo "ARCH must be set" >&2 exit 1 fi fi PACKAGEDIR=$1 if [ -z "$ARCH" ]; then ARCH=`rpm --nodigest --nosignature -qp --qf "%{ARCH}" $PACKAGEDIR/anaconda-runtime*.rpm` fi if [ $ARCH = x86_64 -o $ARCH = s390x ]; then LIBDIR=lib64 else LIBDIR=lib fi NEEDGR=yes prunePackageList() { PACKAGEPATH=$1 PACKAGES="$2" PATTERN="" PACKAGEFILES="" for PKG in $PACKAGES; do PATTERN="${PATTERN:+${PATTERN}|}(^$PKG )" PACKAGEFILES="$PACKAGEFILES $(ls $PACKAGEPATH/$PKG*{$ARCH,noarch}.rpm 2>/dev/null)" done # gtk+, enough said PATTERN=$(echo $PATTERN | sed 's,[\+\*],\\&,g') PACKAGEFILES=$(ls $PACKAGEFILES | sort -u) rpm --nodigest --nosignature --qf "%{NAME} $PACKAGEPATH/%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm\n" \ -qp $PACKAGEFILES | egrep "$PATTERN" | sed 's/.* //' } expandPackageSet() { RPMS=$1 PKGDEST=$2 KEEPFILES=$3 [ -d $PKGDEST ] || die "ERROR: directory missing: $PKGDEST" for n in $RPMS; do [ -n "$DEBUG" ] && echo -ne "\rExpanding packages..." $(basename $n) if [ "$(rpm --nosignature --nodigest -qp --qf '%{NAME}' $n)" = "tzdata" ] ; then TZDATA=$n fi rpm2cpio $n | (cd $PKGDEST; cpio -E $KEEPFILES --quiet -iumd) [ -n "$DEBUG" ] && echo -ne "\rExpanding packages..." "$(basename $n | sed 's/./ /g')" done pushd $PKGDEST/$LIBDIR >/dev/null 2>&1 if [ -d obsolete/linuxthreads/ ]; then for x in obsolete/linuxthreads/*-* ; do lib_base=$(basename $x | cut -d- -f1) rm -f ./$lib_base[.-]* mv -f obsolete/linuxthreads/$lib_base[.-]* . done rmdir obsolete/linuxthreads obsolete fi popd >/dev/null 2>&1 } die () { echo "$@" echo "Aborting instroot creation..." exit 1 } if [ -z "$2" ]; then DEST=/tmp/upd-instroot else DEST=$2 fi if [ -z "$3" ]; then DESTGR=/tmp/upd-instroot else DESTGR=$3 fi rm -rf $DEST $DESTGR mkdir -p $DEST mkdir -p $DESTGR PACKAGES="glibc glibc-common setup openssl python newt slang libselinux libsepol libtermcap zlib ash e2fsprogs util-linux raidtools popt procps rpm rpm-libs XFree86 Xconfigurator anaconda tzdata anaconda-runtime kudzu hwdata bzip2 beecrypt mdadm libsemanage bzip2-libs dosfstools pciutils reiserfs-utils parted sed busybox-anaconda rpm-python booty hdparm lvm2 beecrypt device-mapper rhpl pyxf86config libxml2 libxml2-python glib2 sqlite neon elfutils-libelf krb5-libs convertdb1 jfsutils xfsprogs xfsdump dmapi libacl libattr attr acl python-urlgrabber policy policycoreutils pyparted xorg-x11 selinux-policy-targeted libstdc++ expat libgcc readline ncurses yum python-sqlite python-elementtree pykickstart e2fsprogs-libs iscsi-initiator-utils db4 rhpxl xorg-x11-server-Xorg libuser" if [ $ARCH = i386 -o $ARCH = x86_64 ]; then PACKAGES="$PACKAGES pcmciautils kernel-utils" fi if [ $ARCH = ia64 ]; then PACKAGES="$PACKAGES elilo" fi if [ $ARCH = s390 -o $ARCH = s390x ]; then PACKAGES="$PACKAGES s390utils binutils libgcc tcp_wrappers sed net-tools xinetd openssl openssh openssh-server coreutils login initscripts XFree86-xauth bash portmap pam telnet-server login mount grep modutils gawk XFree86-libs strace xorg-x11-xauth xorg-x11-libs" fi if [ $ARCH != s390 -a $ARCH != s390x ]; then PACKAGES="$PACKAGES python-pyblock" fi if [ $ARCH = ppc -o $ARCH = ppc64 ]; then PACKAGES="$PACKAGES pcmciautils pdisk yaboot hfsutils" fi # xpm is missing # Some packages are listed twice, but that's okay # # The packages in this list are needed for the graphical installer to run # # Extra stuff we want for rescue mode should go in PACKAGESRESCUE # PACKAGESGR="anaconda XFree86-libs libpng XFree86-75dpi-fonts XFree86-ISO8859-2-75dpi-fonts gtk2 libglade2 XFree86-ISO8859-9-75dpi-fonts XFree86-100dpi-fonts fonts-ISO8859-2 fonts-ISO8859-9 XFree86-xfs e2fsprogs coreutils glibc glibc-common popt specspo util-linux rpm rpm-libs tzdata procps bash cpio gpm pygtk2-libglade XFree86 Xconfigurator pygtk2 gdk-pixbuf XFree86-KOI8-R XFree86-KOI8-R-75dpi-fonts pam libpixman reiserfs-utils atk pango freetype gnome-python2-canvas cairo libgnomecanvas libart_lgpl libgcc libacl libattr libstdc++ expat anaconda-images anaconda-help XFree86-base-fonts ttfonts-ko taipeifonts XFree86-ISO8859-15-75dpi-fonts rhpl system-config-keyboard Xft fontconfig gtk2-engines gnome-themes gtkhtml2 gnome-python2-gtkhtml2 gail ttfonts-ja ttfonts-zh_TW bitmap-fonts-cjk urw-fonts fonts-arabic comps-extras XFree86-libs-data convertdb1 fonts-bengali vnc-server libjpeg tcp_wrappers system-config-date xfsprogs xfsdump dmapi attr acl policy policycoreutils selinux-policy-targeted ttfonts-zh_CN redhat-artwork audit-libs xorg-x11-libs xorg-x11-ISO8859-2-75dpi-fonts xorg-x11-ISO8859-9-75dpi-fonts xorg-x11-100dpi-fonts xorg-x11-xfs xorg-x11 xorg-x11-KOI8-R xorg-x11-KOI8-R-75dpi-fonts xorg-x11-base-fonts xorg-x11-ISO8859-15-75dpi-fonts fonts-xorg-ISO8859-2-75dpi fonts-xorg-ISO8859-15-75dpi fonts-xorg-ISO8859-9-75dpi fonts-xorg-100dpi fonts-xorg-KOI8-R fonts-xorg-KOI8-R-75dpi fonts-xorg-base xorg-x11-base xorg-x11-ISO8859-15-75dpi system-logos xorg-x11-libs-data xorg-x11-xfs prelink redhat-logos fedora-logos ttfonts-ta ttfonts-bn ttfonts-gu ttfonts-hi ttfonts-pa fonts-japanese fonts-chinese fonts-korean fonts-indic fonts-gujarati fonts-hindi fonts-punjabi fonts-tamil synaptics firstboot pycairo pirut bitstream-vera-fonts" # # stuff ONLY included for rescue mode # # these packages are combined with the PACKAGES and PACKAGESGR for big stage 2 # PACKAGESRESCUE="bzip2 bzip2-libs dump findutils ftp gzip iputils joe krb5-libs less man modutils mtools mt-st mtr net-tools open openssh openssh-clients pciutils rsh traceroute tar rsync" if [ $ARCH = i386 -o $ARCH = x86_64 ]; then PACKAGESRESCUE="$PACKAGESRESCUE gpart grub" fi # turn off options we dont want, ie. set package list to something harmless if [ -z "$NEEDGR" ]; then PACKAGESGR="bash" PACKAGESRESCUE="bash" fi # dmraid stuff if [ $ARCH != s390 -a $ARCH != s390x ]; then PACKAGESRESCUE="$PACKAGESRESCUE device-mapper dmraid" fi # # add bootloader for particular arch # if [ $ARCH = sparc ]; then PACKAGESGR="$PACKAGESGR tilo silo" fi if [ $ARCH = i386 -o $ARCH = x86_64 ]; then PACKAGESGR="$PACKAGESGR syslinux memtest86+" fi if [ $ARCH = alpha ]; then PACKAGESGR="$PACKAGESGR aboot" fi if [ $ARCH = ia64 ]; then PACKAGESGR="$PACKAGESGR elilo" fi if [ $ARCH = ppc ]; then PACKAGESGR="$PACKAGESGR fbset yaboot ppc64-utils" fi # dogtail stuff... PACKAGESGR="$PACKAGESGR gail at-spi libbonobo ORBit2" # dmraid stuff if [ $ARCH != s390 -a $ARCH != s390x ]; then PACKAGESGR="$PACKAGESGR python-pyblock" fi # modular xorg... XORGLIBS="libICE libSM libX11 libXcursor libXext libXfixes libXft libXi libxkbfile libXmu libXpm libXrandr libXrender libXt libXxf86misc libXaw liblbxutil libXfont libfontenc libXau libXdmcp libXfont libXinerama" XORGDRIVERS="xorg-x11-drv-acecad xorg-x11-drv-aiptek xorg-x11-drv-apm xorg-x11-drv-ark xorg-x11-drv-ati xorg-x11-drv-calcomp xorg-x11-drv-chips xorg-x11-drv-cirrus xorg-x11-drv-citron xorg-x11-drv-cyrix xorg-x11-drv-digitaledge xorg-x11-drv-dmc xorg-x11-drv-dummy xorg-x11-drv-dynapro xorg-x11-drv-elo2300 xorg-x11-drv-elographics xorg-x11-drv-evdev xorg-x11-drv-fbdev xorg-x11-drv-fpit xorg-x11-drv-glint xorg-x11-drv-hyperpen xorg-x11-drv-i128 xorg-x11-drv-i740 xorg-x11-drv-i810 xorg-x11-drv-jamstudio xorg-x11-drv-joystick xorg-x11-drv-keyboard xorg-x11-drv-magellan xorg-x11-drv-magictouch xorg-x11-drv-mga xorg-x11-drv-microtouch xorg-x11-drv-mouse xorg-x11-drv-mutouch xorg-x11-drv-neomagic xorg-x11-drv-nsc xorg-x11-drv-nv xorg-x11-drv-palmax xorg-x11-drv-penmount xorg-x11-drv-rendition xorg-x11-drv-s3 xorg-x11-drv-s3virge xorg-x11-drv-savage xorg-x11-drv-siliconmotion xorg-x11-drv-sis xorg-x11-drv-sisusb xorg-x11-drv-spaceorb xorg-x11-drv-summa xorg-x11-drv-tdfx xorg-x11-drv-tek4957 xorg-x11-drv-trident xorg-x11-drv-tseng xorg-x11-drv-v4l xorg-x11-drv-vesa xorg-x11-drv-vga xorg-x11-drv-via xorg-x11-drv-vmware xorg-x11-drv-void xorg-x11-drv-voodoo" XORGFONTS="xorg-x11-fonts-75dpi xorg-x11-fonts-base xorg-x11-fonts-cyrillic xorg-x11-fonts-ISO8859-15-75dpi xorg-x11-fonts-ISO8859-1-75dpi xorg-x11-fonts-ISO8859-2-75dpi xorg-x11-fonts-ISO8859-9-75dpi xorg-x11-fonts-misc xorg-x11-fonts-ethiopic" XORG="$XORGLIBS $XORGDRIVERS $XORGFONTS xorg-x11-server-Xorg xorg-x11-xauth xorg-x11-font-utils xorg-x11-xkb-utils xorg-x11-xkbdata xorg-x11-server-utils" PACKAGESGR="$PACKAGESGR $XORG" # # KEEPFILE is all files to keep from the packages in PACKAGES # # This is what is present in http, ftp, and hard drive installs, and is # supposed to be a small image because these methods keep it in RAM. # # It also is the base on which the other install images build on top of, # so if something is needed by all images it should go here # KEEPFILE=/tmp/keepfile.$$ cat > $KEEPFILE <> $KEEPFILE <> $KEEPFILEGR <> $KEEPFILEGR < $KEEPFILERESCUE <> $KEEPFILERESCUE <<-EOF sbin/dmraid.static sbin/dmsetup.static EOF fi if [ $ARCH = i386 -o $ARCH = x86_64 ]; then cat >> $KEEPFILERESCUE <<-EOF boot/grub sbin/grub sbin/grub-install sbin/grub-md5-crypt sbin/grub-set-default usr/bin/gpart usr/bin/mbchk usr/share/grub/* EOF fi echo "Assembling package list..." RPMS=$(prunePackageList $PACKAGEDIR "$PACKAGES") [ -n "$DEBUG" ] && echo "RPMS are $RPMS" RPMSGR=$(prunePackageList $PACKAGEDIR "$PACKAGESGR $PACKAGESRESCUE") [ -n "$DEBUG" ] && echo "RPMSGR are $RPMSGR" rm -rf $DEST; mkdir -p $DEST/usr/sbin rm -rf $DESTGR; mkdir -p $DESTGR/usr/sbin $DESTGR/var/lib $DESTGR/boot ln -s /tmp $DESTGR/var/lib/xkb # # concat KEEPFILEGR and KEEPFILERESCUE lists # cat $KEEPFILERESCUE >> $KEEPFILEGR # # filter paths in keepfile lists for use by cpio # for file in $KEEPFILE $KEEPFILEGR; do cat $file | awk '{print $1 "\n./" $1}' > $file- mv -f $file- $file done echo "Expanding text packages..." expandPackageSet "$RPMS" $DEST $KEEPFILE (cd $DEST; tar cSpf - .) | (cd $DESTGR; tar xSpf -) echo "Expanding graphical packages..." expandPackageSet "$RPMSGR" $DESTGR $KEEPFILEGR echo "retrieving timezones" TZDIR=/tmp/glibc-timezone-$$ mkdir -p $TZDIR/usr/share/zoneinfo rpm2cpio $TZDATA | (cd $TZDIR; cpio --quiet -iumd usr/share/zoneinfo ./usr/share/zoneinfo ./usr/share/zoneinfo/* usr/share/zoneinfo/*) [ $? = 0 ] || die "ERROR: Unable to expand timezone data ($TZDATA)" (cd $TZDIR; tar cSpf - $TIMEZONES) | (cd $DEST; tar xSpf -) (cd $TZDIR; tar cSpf - $TIMEZONES) | (cd $DESTGR; tar xSpf -) chown -R root:root $DEST $DESTGR chmod -R a+rX-w $DEST $DESTGR if [ $ARCH = s390 -o $ARCH = s390x ]; then for i in $DEST $DESTGR; do mv $i/bin/sed $i/bin/sed_save mv $i/bin/sort $i/bin/sort_save done else for i in $DEST $DESTGR; do # there's never a case with only one of these... if [ -f $i/sbin/dmraid.static ]; then mv $i/sbin/dmraid.static $i/sbin/dmraid mv $i/sbin/dmsetup.static $i/sbin/dmsetup fi done fi # change mtimes to 0 (to match what happens on the cramfs) for p in $DEST $DESTGR; do if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then runroot $COMPONENT --onlyone --arch $ARCH "cd $p\; usr/lib/anaconda-runtime/fixmtime.py $DEBUG $p" else $p/usr/lib/anaconda-runtime/fixmtime.py $DEBUG $p fi done # Remove locales unused during the install cat $DESTGR/usr/lib/anaconda/lang-table* | awk ' { gsub("-", "", $4); print $4; print gensub(/\..*$/,"","",$4); print gensub(/_.*$/,"","",$4); if (split ($4, a, ".") > 1) { print gensub(/\..*$/,tolower("." a[2]),"",$4); }; print $2; } ' | LC_ALL=C sort -u > $DESTGR/locales for p in lib share; do ( cd $DESTGR/usr/$p/locale && { ls | grep -v locale.alias | LC_ALL=C sort > $DESTGR/locales.list LC_ALL=C comm -13 $DESTGR/locales $DESTGR/locales.list | xargs rm -rf } ); done rm -f $DESTGR/locales $DESTGR/locales.list # now, create a locale archive and nuke the locale dirs since # that ends up taking less space for p in $DEST $DESTGR; do echo "Building locale archive" if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then runroot $COMPONENT --onlyone --arch $ARCH "/usr/sbin/chroot $p /usr/sbin/build-locale-archive" else /usr/sbin/chroot $p /usr/sbin/build-locale-archive fi mv $p/usr/lib/locale/locale-archive $p/usr/lib/locale-archive rm -rf $p/usr/lib/locale/* rm -f $p/usr/sbin/build-locale-archive mv $p/usr/lib/locale-archive $p/usr/lib/locale/locale-archive done # Remove unneeded XFree86 modules rm -rf $DESTGR/usr/X11R6/$LIBDIR/modules/dri rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/libscanpci.a rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/libxf1bpp.a rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/fonts/libspeedo.a rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/drivers/linux/v4l_drv.o rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/extensions/libdri.a rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/extensions/libxtrap.a rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/extensions/librecord.a rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/extensions/lib{GLcore,glx,pex5}* # fixup joe links ln -fs jpicorc $DESTGR/etc/joe/picorc ln -fs jpicorc $DESTGR/etc/joe/jnanorc ln -fs jpicorc $DESTGR/etc/joe/nanorc ln -fs jmacsrc $DESTGR/etc/joe/emacsrc ln -fs jmacs $DESTGR/usr/bin/emacs ln -fs jpico $DESTGR/usr/bin/pico ln -fs jpico $DESTGR/usr/bin/nano # create selinux config if [ -e $DEST/etc/selinux/targeted ]; then cat > $DEST/etc/selinux/config < $DEST/etc/shells < $DEST/etc/nsswitch.conf < $DEST/etc/libuser.conf < $DESTGR/etc/man.config rm -f $DESTGR/etc/man.config-old fi echo "Running mkfontdir..." if [ -n "$NEEDGR" ]; then mkfontdir $DESTGR/usr/share/X11/fonts/* fi echo "Creating SELinux policy..." if [ -x $DESTGR/usr/sbin/semodule -a -x /usr/bin/runroot -a -n "$COMPONENT" ]; then runroot $COMPONENT --onlyone --arch $ARCH "/usr/sbin/chroot $DESTGR /usr/sbin/semodule -b /usr/share/selinux/targeted/base.pp -n -s targeted" else /usr/sbin/chroot $DESTGR /usr/sbin/semodule -b /usr/share/selinux/targeted/base.pp -n -s targeted fi rm -rf $DEST/etc/selinux mkdir $DEST/etc/selinux cp -r $DESTGR/etc/selinux/* $DEST/etc/selinux/ echo "Getting pango modules" if [ -n "$NEEDGR" ]; then # sick sick sick hack for pango-querymodules being -32 or -64 mv $DESTGR/usr/bin/pango-querymodules* $DESTGR/usr/bin/pango-querymodules if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then runroot $COMPONENT --onlyone --arch $ARCH "LD_LIBRARY_PATH=/usr/X11R6/$LIBDIR:$LD_LIBRARY_PATH /usr/sbin/chroot $DESTGR /usr/bin/pango-querymodules 2> $DESTGR/etc/pango/pango.modules" else LD_LIBRARY_PATH=/usr/X11R6/$LIBDIR:$LD_LIBRARY_PATH /usr/sbin/chroot $DESTGR /usr/bin/pango-querymodules > $DESTGR/etc/pango/pango.modules fi rm -f $DESTGR/usr/bin/pango-querymodules # more sick hackery since it doesn't fall back to this like owen thought cat > $DESTGR/etc/pango/pangorc < $DESTGR/etc/gtk-2.0/$HOSTTRIPLET/gtk.immodules" else LD_LIBRARY_PATH=/usr/X11R6/$LIBDIR:$LD_LIBRARY_PATH /usr/sbin/chroot $DESTGR /usr/bin/gtk-query-immodules-2.0 > $DESTGR/etc/gtk-2.0/$HOSTTRIPLET/gtk.immodules fi rm -f $DESTGR/usr/bin/gtk-query-immodules-2.0 fi echo "Getting gtk2 gdk-pixbuf loaders" if [ -n "$NEEDGR" ]; then mv $DESTGR/usr/bin/gdk-pixbuf-query-loaders* $DESTGR/usr/bin/gdk-pixbuf-query-loaders if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then runroot $COMPONENT --onlyone --arch $ARCH "LD_LIBRARY_PATH=/usr/X11R6/$LIBDIR:$LD_LIBRARY_PATH /usr/sbin/chroot $DESTGR /usr/bin/gdk-pixbuf-query-loaders 2> $DESTGR/etc/gtk-2.0/$HOSTTRIPLET/gdk-pixbuf.loaders" else LD_LIBRARY_PATH=/usr/X11R6/$LIBDIR:$LD_LIBRARY_PATH /usr/sbin/chroot $DESTGR /usr/bin/gdk-pixbuf-query-loaders > $DESTGR/etc/gtk-2.0/$HOSTTRIPLET/gdk-pixbuf.loaders fi rm -f $DESTGR/usr/bin/gdk-pixbuf-query-loaders fi rm -f $KEEPFILE $KEEPFILEGR $KEEPFILERESCUE for p in $DEST $DESTGR; do echo "Scrubbing trees..." "$p" cp $p/usr/lib/anaconda/raidstart-stub $p/usr/bin/raidstart cp $p/usr/lib/anaconda/raidstop-stub $p/usr/bin/raidstop cp $p/usr/lib/anaconda/losetup-stub $p/usr/bin/losetup cp $p/usr/lib/anaconda/pump-stub $p/usr/bin/pump cp $p/usr/lib/anaconda/list-harddrives-stub $p/usr/bin/list-harddrives cp $p/usr/lib/anaconda/kudzu-probe-stub $p/usr/bin/kudzu-probe cp $p/usr/lib/anaconda/loadkeys-stub $p/usr/bin/loadkeys cp $p/usr/lib/anaconda/mknod-stub $p/usr/bin/mknod cp $p/usr/lib/anaconda/rescue-startx-stub $p/usr/bin/rescue-startx mv $p/usr/sbin/anaconda $p/usr/bin/anaconda mv $p/usr/lib/anaconda-runtime/lib* $p/usr/$LIBDIR # we only want the libunicode-lite stuff on the minimal image if [ $p = $DESTGR ]; then rm -f $p/usr/$LIBDIR/libunicode-lite* fi find $p -type d | xargs chmod 755 if [ -f $p/bin/bash ]; then rm -f $p/bin/ash ln -s bash $p/bin/sh else ln -sf busybox $p/bin/sh fi [ -d $p/bin ] || die "ERROR: directory missing: $p/bin" [ -d $p/sbin ] || die "ERROR: directory missing: $p/sbin" (cd $p/bin; find) | (cd $p/bin; /bin/cpio --quiet -pdmu $p/usr/bin) (cd $p/sbin; find) | (cd $p/sbin; /bin/cpio --quiet -pdmu $p/usr/sbin) rm -rf $p/bin rm -rf $p/sbin # copy bootloader files for sparc if [ $ARCH = sparc -a $p = $DESTGR ]; then mkdir -p $p/usr/lib/anaconda-runtime/boot [ -d $p/boot ] || die "ERROR: directory missing: $p/boot" (cd $p/boot; find -name "*.b") | (cd $p/boot; /bin/cpio --quiet -pdmu $p/usr/lib/anaconda-runtime/boot) fi # copy bootloader file for alpha if [ $ARCH = alpha -a $p = $DESTGR ]; then mkdir -p $p/usr/lib/anaconda-runtime/boot cp -af $p/boot/bootlx $p/usr/lib/anaconda-runtime/boot fi # copy bootloader files for ia64 if [ $ARCH = ia64 -a $p = $DESTGR ]; then mkdir -p $p/usr/lib/anaconda-runtime/boot cp -af $p/boot/efi/EFI/redhat//* $p/usr/lib/anaconda-runtime/boot fi # copy bootloader files for i386/x86_64 if [ $ARCH = i386 -o $ARCH = x86_64 ]; then if [ $p = $DESTGR ]; then mkdir -p $p/usr/lib/anaconda-runtime/boot cp -af $p/boot/memtest* $p/usr/lib/anaconda-runtime/boot fi fi rm -rf $p/boot $p/home $p/root $p/tmp find $p -name "*.a" | grep -v "usr/X11R6/$LIBDIR/modules" | xargs rm -rf find $p -name "lib*.la" |grep -v "usr/$LIBDIR/gtk-2.0" | xargs rm -rf for f in newt popt rpm rpmio; do rm -f $p/usr/$LIBDIR/lib$f.so done # 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 $p/$d done if [ "$ARCH" != "s390" -a "$ARCH" != "s390x" ]; then (cd $p/lib* && rm -f libnss_files.so.1 libnss_dns.so.1) fi if [ -d $DEST/usr/share/zoneinfo ]; then (cd $DEST/usr/share/zoneinfo; find . -type f -or -type l | grep '^./[A-Z]' | sort | sed 's/^..//' | gzip -9) > $p/usr/lib/timezones.gz else echo "ERROR: unable to explode tzdata for small images" fi if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then runroot $COMPONENT --onlyone --arch $ARCH "cd $p\; usr/lib/anaconda-runtime/scrubtree $DEBUG $p" else $p/usr/lib/anaconda-runtime/scrubtree $p fi done echo "Compressing .mo files in stage2 images..." if [ -d $DEST/usr/share/locale ]; then for i in `find $DEST/usr/share/locale -name anaconda.mo`; do gzip -9 $i mv -f $i.gz $i done fi echo "Creating fontconfig cache" if [ -n "$NEEDGR" ]; then if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then runroot $COMPONENT --onlyone --arch $ARCH "LD_LIBRARY_PATH=/usr/X11R6/$LIBDIR:$LD_LIBRARY_PATH /usr/sbin/chroot $DESTGR /usr/bin/fc-cache" else LD_LIBRARY_PATH=/usr/X11R6/$LIBDIR:$LD_LIBRARY_PATH /usr/sbin/chroot $DESTGR /usr/bin/fc-cache fi rm -f $DESTGR/usr/bin/fc-cache fi echo "Creating debug dir" for p in $DEST $DESTGR ; do mkdir -p $p/usr/lib/debug mkdir -p $p/usr/src/debug done if [ $ARCH = "alpha" ]; then rm -rf $DEST/usr/share/locale rm -rf $DEST/usr/$LIBDIR/locale fi echo "Patching python library..." # always use passive mode for ftp installs cd $DEST/usr/$LIBDIR/python2.4 patch -p0 > /dev/null <