7 if [ "$1" == "--debug" ]; then
12 if [ "$1" == "--comp" ]; then
18 echo "upd-instroot: updates instimage from a Red Hat RPMS directory"
19 echo "usage: $0 --comp <comp> <packagedir> [templatedir] [instroot]"
24 if [ -z "$ARCH" ]; then
25 echo "ARCH must be set" >&2
28 LATEST="latest --arch $ARCH"
33 if [ -z "$ARCH" ]; then
34 ARCH=`rpm --nodigest --nosignature -qp --qf "%{ARCH}" $PACKAGEDIR/anaconda-runtime*.rpm`
37 if [ $ARCH = x86_64 -o $ARCH = s390x ]; then
49 if [ -n "$LATEST" ]; then
50 $LATEST $PACKAGEPATH $PACKAGES
52 $LATEST $PACKAGEPATH $PACKAGES >&2
61 for PKG in $PACKAGES; do
62 PATTERN="${PATTERN:+${PATTERN}|}(^$PKG )"
63 PACKAGEFILES="$PACKAGEFILES $(ls $PACKAGEPATH/$PKG*{$ARCH,noarch}.rpm 2>/dev/null)"
67 PATTERN=$(echo $PATTERN | sed 's,[\+\*],\\&,g')
69 PACKAGEFILES=$(ls $PACKAGEFILES | sort -u)
71 rpm --nodigest --nosignature --qf "%{NAME} $PACKAGEPATH/%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm\n" \
72 -qp $PACKAGEFILES | egrep "$PATTERN" | sed 's/.* //'
80 [ -d $PKGDEST ] || die "ERROR: directory missing: $PKGDEST"
82 [ -n "$DEBUG" ] && echo -ne "\rExpanding packages..." $(basename $n)
83 if [ "$(rpm --nosignature --nodigest -qp --qf '%{NAME}' $n)" = "glibc-misc" ] ; then
86 rpm2cpio $n | (cd $PKGDEST; cpio -E $KEEPFILES --quiet -iumd)
87 [ -n "$DEBUG" ] && echo -ne "\rExpanding packages..." "$(basename $n | sed 's/./ /g')"
89 pushd $PKGDEST/$LIBDIR >/dev/null 2>&1
90 if [ -d obsolete/linuxthreads/ ]; then
91 for x in obsolete/linuxthreads/*-* ; do
92 lib_base=$(basename $x | cut -d- -f1)
93 rm -f ./$lib_base[.-]*
94 mv -f obsolete/linuxthreads/$lib_base[.-]* .
96 rmdir obsolete/linuxthreads obsolete
103 echo "Aborting instroot creation..."
108 DEST=/tmp/upd-instroot
114 DESTGR=/tmp/upd-instroot
123 # glibc-misc for timezone data (was tzdata)
126 PACKAGES="acl anaconda anaconda-runtime ash attr
127 bash beecrypt bogl bogl-bterm busybox-anaconda bzip2 bzip2-libs
128 device-mapper dlm dmapi dosfstools
129 e2fsprogs elfutils-libelf expat
131 glib2 glibc glibc-misc
135 libgcc libselinux libsepol libstdc++ libxml2 lvm2
139 parted pciutils policy policycoreutils popt procps python python-booty python-libs python-libxml2 python-parted python-rhpl python-rpm python-urlgrabber python-xf86config
140 readline reiserfsprogs rpm rpm-lib
141 sed setup slang sqlite
148 if [ $ARCH = i686 -o $ARCH = x86_64 ]; then
149 PACKAGES="$PACKAGES pcmcia-cs"
152 if [ $ARCH = ia64 ]; then
153 PACKAGES="$PACKAGES elilo"
156 if [ $ARCH = s390 -o $ARCH = s390x ]; then
157 PACKAGES="$PACKAGES s390utils binutils libgcc tcp_wrappers
158 sed net-tools xinetd openssl openssh openssh-server coreutils
159 login initscripts XFree86-xauth bash portmap pam
160 telnet-server login mount grep modutils gawk
161 XFree86-libs strace xorg-x11-xauth xorg-x11-libs"
164 if [ $ARCH = ppc -o $ARCH = ppc64 ]; then
165 PACKAGES="$PACKAGES kernel-pcmcia-cs pdisk yaboot hfsutils"
170 # Some packages are listed twice, but that's okay
172 # The packages in this list are needed for the graphical installer to run
174 # Extra stuff we want for rescue mode should go in PACKAGESRESCUE
176 PACKAGESGR="acl anaconda anaconda-help anaconda-images attr audit-libs
177 bash bogl-bterm bogl-devel
178 comps-extras coreutils cpio
181 fedora-logos fontconfig freetype
182 gdk-pixbuf glibc glibc-misc gnome-themes gpm gtk+2 gtk2-engines
183 libacl libattr libart_lgpl libgcc libglade2 libgnomecanvas libjpeg libpng libstdc++
184 pam policy policycoreutils popt prelink procps python-gnome-canvas python-pygtk python-pygtk-libglade python-rhpl
185 redhat-artwork reiserfsprogs rpm rpm-libs
186 selinux-policy-targeted specspo system-config-keyboard system-config-date
191 X11 X11-fonts-100dpi X11-fonts-100dpi-ISO8859-15 X11-fonts-100dpi-ISO8859-2 X11-fonts-100dpi-ISO8859-9 X11-fonts-75dpi X11-fonts-75dpi-ISO8859-15 X11-fonts-75dpi-ISO8859-2 X11-fonts-75dpi-ISO8859-9 X11-fonts-base X11-fonts-ISO8859-15 X11-fonts-ISO8859-2 X11-fonts-ISO8859-9 X11-fonts-KOI8-R X11-libs X11-xfs Xconfigurator
194 # stuff ONLY included for rescue mode
196 # these packages are combined with the PACKAGES and PACKAGESGR for big stage 2
198 PACKAGESRESCUE="bzip2 bzip2-libs dump
199 findutils ftp gzip iputils joe krb5-libs less man man-config man-pages
200 modutils mtools mt-st mtr net-tools open
201 openssh openssh-clients pciutils rsh traceroute tar"
203 if [ $ARCH = i386 ]; then
204 PACKAGESRESCUE="$PACKAGESRESCUE"
207 # turn off options we dont want, ie. set package list to something harmless
208 if [ -z "$NEEDGR" ]; then
210 PACKAGESRESCUE="bash"
214 # add bootloader for particular arch
216 if [ $ARCH = sparc ]; then
217 PACKAGESGR="$PACKAGESGR tilo silo"
220 if [ $ARCH = i686 -o $ARCH = x86_64 ]; then
221 PACKAGESGR="$PACKAGESGR syslinux memtest86+"
224 if [ $ARCH = alpha ]; then
225 PACKAGESGR="$PACKAGESGR aboot"
228 if [ $ARCH = ia64 ]; then
229 PACKAGESGR="$PACKAGESGR elilo"
232 if [ $ARCH = ppc ]; then
233 PACKAGESGR="$PACKAGESGR fbset yaboot ppc64-utils"
237 # KEEPFILE is all files to keep from the packages in PACKAGES
239 # This is what is present in http, ftp, and hard drive installs, and is
240 # supposed to be a small image because these methods keep it in RAM.
242 # It also is the base on which the other install images build on top of,
243 # so if something is needed by all images it should go here
245 KEEPFILE=/tmp/keepfile.$$
247 cat > $KEEPFILE <<EOF
248 boot/efi/EFI/redhat/elilo.efi
257 etc/selinux/targeted/booleans
258 etc/selinux/targeted/policy/policy.*
259 etc/selinux/targeted/contexts/files/file_contexts
260 etc/security/selinux/policy.*
261 etc/security/selinux/file_contexts
270 $LIBDIR/libdevmapper*
274 $LIBDIR/liblvm-10.so*
278 $LIBDIR/libnss_files*
290 sbin/busybox.anaconda
330 usr/X11R6/share/Xconfigurator/MonitorsDB
338 usr/lib/anaconda-runtime/*
340 usr/lib/anaconda/installclasses/*
341 usr/lib/anaconda/textw/*
342 usr/$LIBDIR/bogl/font.bgf.gz
344 usr/kerberos/$LIBDIR/libkrb5.so*
345 usr/kerberos/$LIBDIR/libkrb5support.so*
346 usr/kerberos/$LIBDIR/libk5crypto.so*
347 usr/kerberos/$LIBDIR/libcom_err.so*
348 usr/kerberos/$LIBDIR/libgssapi_krb5.so*
349 usr/$LIBDIR/libkrb5.so*
350 usr/$LIBDIR/libkrb5support.so*
351 usr/$LIBDIR/libk5crypto.so*
352 usr/$LIBDIR/libcom_err.so*
353 usr/$LIBDIR/libgssapi_krb5.so*
354 usr/$LIBDIR/gconv/ISO8859-1.so
355 usr/$LIBDIR/gconv/gconv-modules
356 usr/$LIBDIR/libbeecrypt*
357 usr/$LIBDIR/libexpat*
359 usr/$LIBDIR/libgmodule*
360 usr/$LIBDIR/libgobject*
361 usr/$LIBDIR/libgthread*
363 usr/$LIBDIR/libcrypto*
366 usr/$LIBDIR/libncurses*
368 usr/$LIBDIR/libparted*
370 usr/$LIBDIR/libpython*
372 usr/$LIBDIR/libsqlite3*
373 usr/$LIBDIR/librpm-*4.?.so*
374 usr/$LIBDIR/librpmbuild-*4.?.so*
375 usr/$LIBDIR/librpmdb*4.?.so*
376 usr/$LIBDIR/librpmio*4.?.so*
377 usr/$LIBDIR/libslang*
378 usr/$LIBDIR/libstdc++.so.6*
379 usr/$LIBDIR/libxml2.so*
381 usr/$LIBDIR/libbogl.so*
382 usr/$LIBDIR/libreadline*
383 usr/$LIBDIR/python?.?/*
384 usr/$LIBDIR/python?.?/site-packages/libxml2*
385 usr/$LIBDIR/python?.?/site-packages/*kudzu*
386 usr/$LIBDIR/python?.?/site-packages/rpmmodule.so
387 usr/$LIBDIR/python?.?/site-packages/partedmodule.so
388 usr/$LIBDIR/python?.?/site-packages/ixf86configmodule.so
389 usr/$LIBDIR/python?.?/site-packages/xf86config.py
390 usr/$LIBDIR/python?.?/site-packages/rhpl
392 usr/lib/python?.?/site-packages/urlgrabber/*
396 usr/lib/yaboot/addnote
397 usr/lib/yaboot/ofboot
398 usr/lib/yaboot/yaboot
399 usr/libexec/convertdb1
400 usr/share/locale/*/LC_MESSAGES/anaconda.mo
401 usr/share/locale/locale.alias
410 usr/sbin/build-locale-archive
411 usr/share/anaconda/locale-list
412 usr/share/anaconda/anaconda.conf
413 usr/share/terminfo/b/bterm
414 usr/share/terminfo/l/linux
415 usr/share/terminfo/v/vt100
416 usr/share/terminfo/v/vt100-nav
417 usr/share/hwdata/pcitable
418 usr/share/hwdata/pci.ids
419 usr/share/hwdata/Cards
420 usr/share/hwdata/MonitorsDB
421 usr/share/rhpl/extramodes
422 usr/share/rhpl/vesamodes
425 if [ $ARCH = s390 -o $ARCH = s390x ]; then
426 cat >> $KEEPFILE <<EOF
427 usr/share/terminfo/a/ansi
428 usr/share/terminfo/d/dumb
429 usr/share/terminfo/k/kterm
430 usr/share/terminfo/s/screen
431 usr/share/terminfo/v/vt100
432 usr/share/terminfo/v/vt100-nav
433 usr/share/terminfo/v/vt102
434 usr/share/terminfo/x/xterm
435 usr/share/terminfo/x/xterm-color
440 usr/sbin/glibc_post_upgrade
445 sbin/busybox.anaconda
473 $LIBDIR/libutil-*.so*
479 $LIBDIR/libresolv.so*
480 $LIBDIR/libresolv-*.so*
486 etc/security/limits.conf
487 etc/security/pam_env.conf
489 $LIBDIR/security/pam_*
490 usr/$LIBDIR/libwrap.so*
491 usr/X11R6/$LIBDIR/libXmuu.so*
492 usr/X11R6/$LIBDIR/libX11.so*
493 usr/X11R6/$LIBDIR/libXext.so*
494 usr/X11R6/$LIBDIR/libXxf86misc.so*
500 # KEEPFILEGR is all files to keep from the packages in PACKAGESGR
502 # This defines the files in addition to KEEPFILE that make up the install
503 # images for NFS and CD/DVD based installs. This image is not loaded into
504 # memory so it can be considerably larger.
506 # The rescue mode of anaconda uses these files as well as those defined
507 # by KEEPFILERESCUE below. The total size of this image should be
508 # under the size of the miniature CD used for the rescue CD (around 68MB).
510 KEEPFILEGR=/tmp/keepfilegr.$$
511 cp $KEEPFILE $KEEPFILEGR
512 cat >> $KEEPFILEGR <<EOF
513 boot/efi/EFI/redhat/elilo.efi
541 etc/rpm/macros.prelink
544 $LIBDIR/libaudit*.so*
563 usr/X11R6/bin/XFree86
565 usr/X11R6/bin/setxkbmap
566 usr/X11R6/bin/xsetroot
567 usr/X11R6/lib/X11/XKeysymDB
568 usr/X11R6/lib/X11/fonts/misc/6x13*
569 usr/X11R6/lib/X11/fonts/misc/fonts*
570 usr/X11R6/lib/X11/fonts/misc/cursor*
571 usr/X11R6/lib/X11/fonts/misc/olcursor*
572 usr/X11R6/lib/X11/fonts/Type1/l047013t*
573 usr/X11R6/lib/X11/fonts/Type1/*
574 usr/X11R6/lib/X11/locale/*
575 usr/X11R6/lib/X11/rgb*
576 usr/X11R6/lib/X11/xkb/*
577 usr/X11R6/lib/X11/xserver/SecurityPolicy
578 usr/X11R6/$LIBDIR/libICE*
579 usr/X11R6/$LIBDIR/libSM*
580 usr/X11R6/$LIBDIR/libXaw.so*
581 usr/X11R6/$LIBDIR/libX11*
582 usr/X11R6/$LIBDIR/libXcursor*
583 usr/X11R6/$LIBDIR/libXext*
584 usr/X11R6/$LIBDIR/libXfixes*
585 usr/X11R6/$LIBDIR/libXft*
586 usr/X11R6/$LIBDIR/libXi*
587 usr/X11R6/$LIBDIR/libxkbfile*
588 usr/X11R6/$LIBDIR/libXmu*
589 usr/X11R6/$LIBDIR/libXpm*
590 usr/X11R6/$LIBDIR/libXrandr*
591 usr/X11R6/$LIBDIR/libXrender*
592 usr/X11R6/$LIBDIR/libXt*
593 usr/X11R6/$LIBDIR/libXxf86misc*
594 usr/X11R6/$LIBDIR/modules/*
595 usr/X11R6/share/Xconfigurator/pixmaps/*
599 usr/bin/gdk-pixbuf-query-loaders*
617 usr/lib/bogl/font.bdf.gz
619 usr/$LIBDIR/gdk-pixbuf/loaders/*png*
620 usr/$LIBDIR/gdk-pixbuf/loaders/*la*
621 usr/$LIBDIR/gtk-2.0/*/engines/libclearlooks.so
622 usr/$LIBDIR/gtk-2.0/*/loaders/*png*
623 usr/$LIBDIR/gtk-2.0/*/loaders/*la*
624 usr/$LIBDIR/gtk-2.0/immodules/
625 usr/$LIBDIR/libImlib*
629 usr/$LIBDIR/libaudio*
631 usr/$LIBDIR/libfontconfig*
632 usr/$LIBDIR/libfreetype*
634 usr/$LIBDIR/libglade*
635 usr/$LIBDIR/libgnomecanvas*
636 usr/$LIBDIR/libgnomeui*
640 usr/$LIBDIR/libpango*
641 usr/$LIBDIR/libpng.so.3*
642 usr/$LIBDIR/libpng12.so*
643 usr/$LIBDIR/libstdc++.so.*
646 usr/$LIBDIR/python?.?/site-packages/gtk*/gtk/*
647 usr/$LIBDIR/rpm/rpmpopt
656 usr/share/icons/default/*
657 usr/share/icons/gnome/cursors/*
658 usr/share/icons/gnome/*/stock/*
659 usr/share/icons/gnome/index.theme
660 usr/share/fonts/default/Type1/n019003l*
661 usr/share/fonts/default/Type1/n019004l*
662 usr/share/fonts/default/Type1/n019023l*
663 usr/share/fonts/default/Type1/n019024l*
664 usr/share/fonts/default/Type1/n021003l*
665 usr/share/fonts/default/Type1/n021004l*
666 usr/share/fonts/default/Type1/n021023l*
667 usr/share/fonts/default/Type1/n021024l*
668 usr/share/fonts/korean/TrueType/dotum.ttf
669 usr/share/fonts/japanese/TrueType/kochi-gothic-subst.ttf
670 usr/share/fonts/chinese/TrueType/gbsn00lp.ttf
671 usr/share/fonts/chinese/TrueType/bsmi00lp.ttf
672 usr/share/fonts/bengali/MuktiNarrow.ttf
673 usr/share/fonts/arabic/KacstFarsi.ttf
674 usr/share/fonts/arabic/KacstQura.ttf
675 usr/share/fonts/tamil/lohit_ta.ttf
676 usr/share/fonts/gujarati/lohit_gu.ttf
677 usr/share/fonts/bengali/lohit_bn.ttf
678 usr/share/fonts/hindi/lohit_hi.ttf
679 usr/share/fonts/panjabi/lohit_pa.ttf
680 usr/share/fonts/punjabi/lohit_pa.ttf
681 usr/share/locale/*/LC_MESSAGES/anaconda.mo
682 usr/share/locale/*/LC_MESSAGES/system-config-date.mo
683 usr/share/locale/*/LC_MESSAGES/redhat-dist.mo
684 usr/share/locale/*/LC_MESSAGES/system-config-keyboard.mo
685 usr/share/locale/*/LC_MESSAGES/gtk20.mo
686 usr/share/locale/*/LC_MESSAGES/libc.mo
687 usr/share/locale/*/LC_MESSAGES/rhpl.mo
688 usr/share/locale/*/LC_MESSAGES/parted.mo
689 usr/share/pixmaps/comps/*.png
690 usr/share/pixmaps/gnome-default-dlg.png
691 usr/share/pixmaps/gnome-error.png
692 usr/share/pixmaps/gnome-info.png
693 usr/share/pixmaps/gnome-question.png
694 usr/share/pixmaps/gnome-warning.png
695 usr/share/pixmaps/no.xpm
696 usr/share/pixmaps/yes.xpm
697 usr/share/ppc64-utils/zImage.lds
698 usr/share/system-config-keyboard/*
699 usr/share/terminfo/l/linux
700 usr/share/terminfo/x/xterm
701 usr/share/terminfo/v/vt100
702 usr/share/terminfo/v/vt100-nav
703 usr/share/themes/Clearlooks/gtk-2.0/*
704 usr/share/themes/Clearlooks/index.theme
705 usr/share/vte/termcap/xterm
706 usr/share/zoneinfo/zone.tab
710 usr/share/zoneinfo/Africa
711 usr/share/zoneinfo/America
712 usr/share/zoneinfo/Antarctica
713 usr/share/zoneinfo/Arctic
714 usr/share/zoneinfo/Asia
715 usr/share/zoneinfo/Atlantic
716 usr/share/zoneinfo/Australia
717 usr/share/zoneinfo/Canada
718 usr/share/zoneinfo/Europe
719 usr/share/zoneinfo/Indian
720 usr/share/zoneinfo/Japan
721 usr/share/zoneinfo/Mideast
722 usr/share/zoneinfo/Pacific
723 usr/share/zoneinfo/US
726 # sparc needs 100dpi fonts as well, otherwise
729 if [ $ARCH = sparc ]; then
730 cat >> $KEEPFILEGR <<-EOF
731 usr/X11R6/lib/X11/fonts/100dpi/cour*
732 usr/X11R6/lib/X11/fonts/100dpi/helv*
733 usr/X11R6/lib/X11/fonts/100dpi/tim*
734 usr/X11R6/lib/X11/fonts/100dpi/fonts*
735 usr/share/fonts/ISO8859-2/100dpi/cour*
736 usr/share/fonts/ISO8859-2/100dpi/helv*
737 usr/share/fonts/ISO8859-2/100dpi/tim*
738 usr/share/fonts/ISO8859-2/100dpi/fonts*
743 # KEEPFILERESCUE is all files to keep from the packages in PACKAGESRESCUE
745 # This defines the files in addition to KEEPFILE and KEEPFILEGR that make up
746 # the install images for NFS and CD/DVD based rescue mode installs. This
747 # image is not loaded into memory so it can be considerably larger.
749 # NOTE: hd, ftp, and http rescue mode use and image based on KEEPFILE since
750 # it has to be much smaller due to memory usage.
752 KEEPFILERESCUE=/tmp/keepfilerescue.$$
753 cat > $KEEPFILERESCUE <<EOF
818 usr/kerberos/$LIBDIR/libgssapi*
819 usr/kerberos/$LIBDIR/libkrb5*
820 usr/kerberos/$LIBDIR/libk5crypto*
821 usr/kerberos/$LIBDIR/libcom_err*
826 echo "Assembling package list..."
827 RPMS=$(prunePackageList $PACKAGEDIR "$PACKAGES")
828 [ -n "$DEBUG" ] && echo "RPMS are $RPMS"
829 RPMSGR=$(prunePackageList $PACKAGEDIR "$PACKAGESGR $PACKAGESRESCUE")
830 [ -n "$DEBUG" ] && echo "RPMSGR are $RPMSGR"
832 rm -rf $DEST; mkdir -p $DEST/usr/sbin
833 rm -rf $DESTGR; mkdir -p $DESTGR/usr/sbin $DESTGR/var/lib $DESTGR/boot
834 ln -s /tmp $DESTGR/var/lib/xkb
837 # concat KEEPFILEGR and KEEPFILERESCUE lists
839 cat $KEEPFILERESCUE >> $KEEPFILEGR
842 # filter paths in keepfile lists for use by cpio
844 for file in $KEEPFILE $KEEPFILEGR; do
845 cat $file | awk '{print $1 "\n./" $1}' > $file-
849 echo "Expanding text packages..."
850 expandPackageSet "$RPMS" $DEST $KEEPFILE
852 (cd $DEST; tar cSpf - .) | (cd $DESTGR; tar xSpf -)
854 echo "Expanding graphical packages..."
855 expandPackageSet "$RPMSGR" $DESTGR $KEEPFILEGR
857 echo "retrieving timezones"
858 TZDIR=/tmp/glibc-timezone-$$
859 mkdir -p $TZDIR/usr/share/zoneinfo
860 rpm2cpio $TZDATA | (cd $TZDIR; cpio --quiet -iumd usr/share/zoneinfo ./usr/share/zoneinfo ./usr/share/zoneinfo/* usr/share/zoneinfo/*)
861 [ $? = 0 ] || die "ERROR: Unable to expand timezone data ($TZDATA)"
862 (cd $TZDIR; tar cSpf - $TIMEZONES) | (cd $DEST; tar xSpf -)
863 (cd $TZDIR; tar cSpf - $TIMEZONES) | (cd $DESTGR; tar xSpf -)
865 chown -R root:root $DEST $DESTGR
866 chmod -R a+rX-w $DEST $DESTGR
867 if [ $ARCH = s390 -o $ARCH = s390x ]; then
868 for i in $DEST $DESTGR; do
869 mv $i/bin/sed $i/bin/sed_save
870 mv $i/bin/sort $i/bin/sort_save
874 # change mtimes to 0 (to match what happens on the cramfs)
875 for p in $DEST $DESTGR; do
876 if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then
877 runroot $COMPONENT --onlyone --arch $ARCH "cd $p\; usr/lib/anaconda-runtime/fixmtime.py $DEBUG $p"
879 $p/usr/lib/anaconda-runtime/fixmtime.py $DEBUG $p
883 # Remove locales unused during the install
884 cat $DESTGR/usr/lib/anaconda/lang-table* | gawk '
887 print gensub(/\..*$/,"","",$4);
888 print gensub(/_.*$/,"","",$4);
889 if (split ($4, a, ".") > 1) {
890 print gensub(/\..*$/,tolower("." a[2]),"",$4);
894 print gensub(/\..*$/,"","",$7);
895 print gensub(/_.*$/,"","",$7);
896 if (split ($7, a, ".") > 1) {
897 print gensub(/\..*$/,tolower("." a[2]),"",$7);
900 ' | LC_ALL=C sort -u > $DESTGR/locales
903 cd $DESTGR/usr/$p/locale && {
904 ls | grep -v locale.alias | LC_ALL=C sort > $DESTGR/locales.list
905 LC_ALL=C comm -13 $DESTGR/locales $DESTGR/locales.list | xargs rm -rf
908 rm -f $DESTGR/locales $DESTGR/locales.list
910 # now, create a locale archive and nuke the locale dirs since
911 # that ends up taking less space
912 #for p in $DEST $DESTGR; do
913 # echo "Building locale archive"
914 # if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then
915 # runroot $COMPONENT --onlyone --arch $ARCH "/usr/sbin/chroot $p /usr/sbin/build-locale-archive"
917 # /usr/sbin/chroot $p /usr/sbin/build-locale-archive
919 # mv $p/usr/lib/locale/locale-archive $p/usr/lib/locale-archive
920 # rm -rf $p/usr/lib/locale/*
921 # rm -f $p/usr/sbin/build-locale-archive
922 # mv $p/usr/lib/locale-archive $p/usr/lib/locale/locale-archive
925 # Remove unneeded XFree86 modules
926 rm -rf $DESTGR/usr/X11R6/$LIBDIR/modules/dri
927 rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/libscanpci.a
928 rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/libxf1bpp.a
929 rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/fonts/libspeedo.a
930 rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/drivers/linux/v4l_drv.o
931 rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/extensions/libdri.a
932 rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/extensions/libxtrap.a
933 rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/extensions/librecord.a
935 rm -f $DESTGR/usr/X11R6/$LIBDIR/modules/extensions/lib{GLcore,glx,pex5}*
938 ln -fs jpicorc $DESTGR/etc/joe/picorc
939 ln -fs jmacsrc $DESTGR/etc/joe/emacsrc
940 ln -fs jmacs $DESTGR/usr/bin/emacs
941 ln -fs jpico $DESTGR/usr/bin/pico
943 echo "Creating nsswitch.conf"
944 cat > $DEST/etc/nsswitch.conf <<EOF
945 # munged nsswitch.conf with just what anaconda needs
946 # created by upd-instroot
963 cp $DEST/etc/nsswitch.conf $DESTGR/etc/nsswitch.conf
965 # fixup man.config to point into /mnt/sysimage for rescue
966 echo "Fixing up /etc/man.config to point into /mnt/sysimage"
967 if [ -n "$NEEDGR" ]; then
968 mv $DESTGR/etc/man.config $DESTGR/etc/man.config-old
969 cat $DESTGR/etc/man.config-old | sed 's^/usr/bin^/mnt/sysimage/usr/bin^' | sed 's^/bin/cat^/mnt/sysimage/usr/bin/cat^' > $DESTGR/etc/man.config
970 rm -f $DESTGR/etc/man.config-old
973 echo "Creating bogl font..."
975 export LANG=en_US.UTF-8
976 zcat $DESTGR/usr/lib/bogl/font.bdf.gz > $DESTGR/usr/lib/bogl/font.bdf
977 (cat $DESTGR/usr/lib/anaconda-runtime/loader/unicode-linedraw-chars.txt ; for i in $(find $DESTGR/usr/share/locale -name '*.mo'); do msgunfmt $i 2>/dev/null | msgconv -t utf-8 -o - - ; done) | $DESTGR/usr/bin/reduce-font $DESTGR/usr/lib/bogl/font.bdf > $DESTGR/usr/lib/anaconda-runtime/loader/font-reduced.bdf
978 $DESTGR/usr/bin/bdftobogl -b $DESTGR/usr/lib/anaconda-runtime/loader/font-reduced.bdf > $DESTGR/usr/lib/anaconda-runtime/loader/font.bgf
979 rm -f $DESTGR/usr/lib/anaconda-runtime/loader/font-reduced.bdf $DESTGR/usr/lib/bogl/font.bdf $DESTGR/usr/bin/reduce-font $DESTGR/usr/bin/bdftobogl $DESTGR/usr/lib/bogl/font.bdf.gz
980 gzip -9 -f $DESTGR/usr/lib/anaconda-runtime/loader/font.bgf
983 echo "Running mkfontdir..."
984 if [ -n "$NEEDGR" ]; then
985 /usr/X11R6/bin/mkfontdir $DESTGR/usr/X11R6/lib/X11/fonts/*
986 rm -f $DESTGR/usr/X11R6/bin/mkfontdir
989 echo "Getting pango modules"
990 if [ -n "$NEEDGR" ]; then
991 # sick sick sick hack for pango-querymodules being -32 or -64
992 mv $DESTGR/usr/bin/pango-querymodules* $DESTGR/usr/bin/pango-querymodules
993 if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then
994 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"
996 LD_LIBRARY_PATH=/usr/X11R6/$LIBDIR:$LD_LIBRARY_PATH /usr/sbin/chroot $DESTGR /usr/bin/pango-querymodules > $DESTGR/etc/pango/pango.modules
998 rm -f $DESTGR/usr/bin/pango-querymodules
999 # more sick hackery since it doesn't fall back to this like owen thought
1000 cat > $DESTGR/etc/pango/pangorc <<EOF
1002 ModuleFiles=/etc/pango/pango.modules
1006 host=`rpm --nodigest --nosignature -qp --qf "%{POSTIN}\n" $PACKAGEDIR/gtk2*.$ARCH.rpm |grep update-gdk-pixbuf |awk {'print $2;'}`
1009 *linux) canonhost="$host-gnu"
1015 # autoconf uses powerpc not ppc
1016 HOSTTRIPLET=`echo $canonhost | sed "s/^ppc/powerpc/"`
1019 mkdir -p $DESTGR/etc/gtk-2.0/$HOSTTRIPLET
1021 echo "Getting gtk2 input method modules"
1022 if [ -n "$NEEDGR" ]; then
1023 mv $DESTGR/usr/bin/gtk-query-immodules-2.0* $DESTGR/usr/bin/gtk-query-immodules-2.0
1024 if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then
1025 runroot $COMPONENT --onlyone --arch $ARCH "LD_LIBRARY_PATH=/usr/X11R6/$LIBDIR:$LD_LIBRARY_PATH /usr/sbin/chroot $DESTGR /usr/bin/gtk-query-immodules-2.0 2> $DESTGR/etc/gtk-2.0/$HOSTTRIPLET/gtk.immodules"
1027 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
1029 rm -f $DESTGR/usr/bin/gtk-query-immodules-2.0
1032 echo "Getting gtk2 gdk-pixbuf loaders"
1033 if [ -n "$NEEDGR" ]; then
1034 mv $DESTGR/usr/bin/gdk-pixbuf-query-loaders* $DESTGR/usr/bin/gdk-pixbuf-query-loaders
1035 if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then
1036 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"
1038 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
1040 rm -f $DESTGR/usr/bin/gdk-pixbuf-query-loaders
1043 rm -f $KEEPFILE $KEEPFILEGR $KEEPFILERESCUE
1045 for p in $DEST $DESTGR; do
1046 echo "Scrubbing trees..." "$p"
1047 cp $p/usr/lib/anaconda/raidstart-stub $p/usr/bin/raidstart
1048 cp $p/usr/lib/anaconda/raidstop-stub $p/usr/bin/raidstop
1049 cp $p/usr/lib/anaconda/losetup-stub $p/usr/bin/losetup
1050 cp $p/usr/lib/anaconda/pump-stub $p/usr/bin/pump
1051 cp $p/usr/lib/anaconda/list-harddrives-stub $p/usr/bin/list-harddrives
1052 cp $p/usr/lib/anaconda/kudzu-probe-stub $p/usr/bin/kudzu-probe
1053 cp $p/usr/lib/anaconda/loadkeys-stub $p/usr/bin/loadkeys
1054 cp $p/usr/lib/anaconda/mknod-stub $p/usr/bin/mknod
1055 cp $p/usr/lib/anaconda/rescue-startx-stub $p/usr/bin/rescue-startx
1056 mv $p/usr/sbin/anaconda $p/usr/bin/anaconda
1057 mv $p/usr/lib/anaconda-runtime/lib* $p/usr/$LIBDIR
1059 # we only want the libunicode-lite stuff on the minimal image
1060 if [ $p = $DESTGR ]; then
1061 rm -f $p/usr/$LIBDIR/libunicode-lite*
1064 find $p -type d | xargs chmod 755
1066 if [ -f $p/bin/bash ]; then
1068 ln -s bash $p/bin/sh
1070 ln -sf busybox $p/bin/sh
1073 [ -d $p/bin ] || die "ERROR: directory missing: $p/bin"
1074 [ -d $p/sbin ] || die "ERROR: directory missing: $p/sbin"
1075 (cd $p/bin; find) | (cd $p/bin; /bin/cpio --quiet -pdmu $p/usr/bin)
1076 (cd $p/sbin; find) | (cd $p/sbin; /bin/cpio --quiet -pdmu $p/usr/sbin)
1080 # copy bootloader files for sparc
1081 if [ $ARCH = sparc -a $p = $DESTGR ]; then
1082 mkdir -p $p/usr/lib/anaconda-runtime/boot
1083 [ -d $p/boot ] || die "ERROR: directory missing: $p/boot"
1084 (cd $p/boot; find -name "*.b") | (cd $p/boot; /bin/cpio --quiet -pdmu $p/usr/lib/anaconda-runtime/boot)
1087 # copy bootloader file for alpha
1088 if [ $ARCH = alpha -a $p = $DESTGR ]; then
1089 mkdir -p $p/usr/lib/anaconda-runtime/boot
1090 cp -af $p/boot/bootlx $p/usr/lib/anaconda-runtime/boot
1093 # copy bootloader files for ia64
1094 if [ $ARCH = ia64 -a $p = $DESTGR ]; then
1095 mkdir -p $p/usr/lib/anaconda-runtime/boot
1096 cp -af $p/boot/efi/EFI/redhat//* $p/usr/lib/anaconda-runtime/boot
1099 # copy bootloader files for i386/x86_64
1100 if [ $ARCH = i386 -o $ARCH = i686 -o $ARCH = x86_64 ]; then
1101 if [ $p = $DESTGR ]; then
1102 mkdir -p $p/usr/lib/anaconda-runtime/boot
1103 cp -af $p/boot/memtest* $p/usr/lib/anaconda-runtime/boot
1107 rm -rf $p/boot $p/home $p/root $p/tmp
1109 find $p -name "*.a" | grep -v "usr/X11R6/$LIBDIR/modules" | xargs rm -rf
1110 find $p -name "lib*.la" |grep -v "usr/$LIBDIR/gtk-2.0" | xargs rm -rf
1111 for f in newt popt rpm rpmio; do
1112 rm -f $p/usr/$LIBDIR/lib$f.so
1115 # nuke some python stuff we don't need
1116 for d in idle distutils email bsddb lib-old hotshot doctest.py pydoc.py site-packages/japanese site-packages/japanese.pth ; do
1120 if [ "$ARCH" != "s390" -a "$ARCH" != "s390x" ]; then
1121 (cd $p/lib && rm -f libnss_files.so.1 libnss_dns.so.1)
1124 if [ -d $DEST/usr/share/zoneinfo ]; then
1125 (cd $DEST/usr/share/zoneinfo; find . -type f -or -type l |
1126 grep '^./[A-Z]' | sort | sed 's/^..//' |
1127 gzip -9) > $p/usr/lib/timezones.gz
1129 echo "ERROR: unable to explode tzdata for small images"
1132 if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then
1133 runroot $COMPONENT --onlyone --arch $ARCH "cd $p\; usr/lib/anaconda-runtime/scrubtree $DEBUG $p"
1135 $p/usr/lib/anaconda-runtime/scrubtree $p
1139 echo "Compressing .mo files in stage2 images..."
1140 if [ -d $DEST/usr/share/locale ]; then
1141 for i in `find $DEST/usr/share/locale -name anaconda.mo`; do
1147 echo "Creating fontconfig cache"
1148 if [ -n "$NEEDGR" ]; then
1149 if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then
1150 runroot $COMPONENT --onlyone --arch $ARCH "LD_LIBRARY_PATH=/usr/X11R6/$LIBDIR:$LD_LIBRARY_PATH /usr/sbin/chroot $DESTGR /usr/bin/fc-cache"
1152 LD_LIBRARY_PATH=/usr/X11R6/$LIBDIR:$LD_LIBRARY_PATH /usr/sbin/chroot $DESTGR /usr/bin/fc-cache
1154 rm -f $DESTGR/usr/bin/fc-cache
1157 echo "Creating debug dir"
1158 for p in $DEST $DESTGR ; do
1159 mkdir -p $p/usr/lib/debug
1162 if [ $ARCH = "alpha" ]; then
1163 rm -rf $DEST/usr/share/locale
1164 rm -rf $DEST/usr/$LIBDIR/locale
1167 echo "Patching python library..."
1169 # always use passive mode for ftp installs
1170 cd $DEST/usr/$LIBDIR/python2.4
1171 patch -p0 > /dev/null <<EOF
1172 --- urllib.py.orig Thu Oct 25 17:05:06 2001
1173 +++ urllib.py Thu Oct 25 17:05:34 2001
1175 path, attrs = splitattr(path)
1176 path = unquote(path)
1177 dirs = path.split('/')
1178 + dirs[0] = '/' + dirs[0]
1179 dirs, file = dirs[:-1], dirs[-1]
1180 if dirs and not dirs[0]: dirs = dirs[1:]
1181 if dirs and not dirs[0]: dirs[0] = '/'
1183 self.ftp = ftplib.FTP()
1184 self.ftp.connect(self.host, self.port)
1185 self.ftp.login(self.user, self.passwd)
1186 + self.ftp.set_pasv(1)
1187 for dir in self.dirs:
1192 echo -n -e "Removing unused python files in hdimage... "
1194 if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then
1195 runroot $COMPONENT --onlyone --arch $ARCH "cd $DEST\; usr/lib/anaconda-runtime/pythondeps $DEST"
1197 $DEST/usr/lib/anaconda-runtime/pythondeps $DEST
1201 for p in $DEST $DESTGR; do
1202 find $p -name "*.py" | while read fn; do
1205 ln -sf /dev/null ${fn}c
1209 # do some stripping of debugging symbols
1210 if [ -x /usr/bin/runroot -a -n "$COMPONENT" ]; then
1211 runroot $COMPONENT --onlyone --arch $ARCH "\"find $DEST -type f -name '*.so' -exec strip -g '{}' ';'\""
1212 runroot $COMPONENT --onlyone --arch $ARCH "\"find $DESTGR -type f -name '*.so' -exec strip -g '{}' ';'\""
1214 find $DEST -type f -name '*.so' |xargs strip -g
1215 find $DESTGR -type f -name '*.so' |xargs strip -g
1218 # some python stuff we don't need for stage2
1219 rm -f $DESTGR/usr/$LIBDIR/python?.?/site-packages/distutils/
1220 rm -f $DESTGR/usr/$LIBDIR/python?.?/site-packages/lib-dynload/japanese
1221 rm -f $DESTGR/usr/$LIBDIR/python?.?/site-packages/encodings/
1222 rm -f $DESTGR/usr/$LIBDIR/python?.?/site-packages/compiler/
1223 rm -f $DESTGR/usr/$LIBDIR/python?.?/site-packages/email/
1224 rm -f $DESTGR/usr/$LIBDIR/python?.?/site-packages/curses/
1225 rm -f $DESTGR/usr/$LIBDIR/python?.?/site-packages/pydoc.py
1230 # this is only for the minimal second stage
1231 echo "Cleaning ramdisk install images..."
1232 rm -rf $DEST/usr/lib/anaconda-runtime
1234 if [ "$ARCH" != "s390" -a "$ARCH" != "s390x" ]; then
1235 if [ $NEEDGR ]; then
1236 # Xserver needs a place to put the compiled xkb maps.
1237 rm -rf $DESTGR/usr/X11R6/lib/X11/xkb/compiled
1238 ln -s /tmp $DESTGR/usr/X11R6/lib/X11/xkb/compiled
1241 if [ -n "$NEEDGR" ]; then
1243 $DESTGR/usr/lib/anaconda-runtime/checkcards.py $DESTGR/usr/share/hwdata/pcitable $DESTGR/usr/share/hwdata/Cards