home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 1999 May / pcp151c.iso / misc / src / trees / updsupp < prev   
Encoding:
Text File  |  1998-10-06  |  2.5 KB  |  114 lines

  1. #!/bin/sh
  2.  
  3. LIBS="libc"
  4. ZLIBS="libext2fs.so libnsl libnss_files libuuid libnss_compat libcom_err libe2p"
  5. BINS="bzip2 mke2fs ash badblocks rm chmod"
  6. # chmod could be a VIRTBIN, but the runinstall2 script uses it to set things up
  7. VIRTBINS="cat lsmod mkdir mknod mount rm umount ln uncpio ls"  
  8. ZBINS="install2 fdisk"
  9.  
  10. PCMCIA_SBINS="cardmgr"
  11. MODLINKS="block cdrom misc net scsi"
  12.  
  13. export PATH=$PATH:/sbin:/usr/sbin
  14.  
  15. usage () {
  16.     echo "updsupp: <imagetree> <kernel-version>" 2>&1
  17.     exit 1
  18. }
  19.  
  20. if [ -z "$1" -o -z "$2" ]; then
  21.     usage
  22. fi
  23.  
  24. if [ ! -d "$1/misc/src/install" ]; then
  25.     echo "$1 is not a valid directory" 2>&1
  26.     usage
  27. fi
  28.  
  29. if [ ! -d "/lib/modules/$2/pcmcia" ]; then
  30.     echo "$2 is not a valid modules directory" 2>&1
  31.     usage
  32. fi
  33.  
  34. PATH=$1/misc/src/install:/usr/sbin:/usr/bin:/bin:/sbin
  35.  
  36. rm -rf supp/lib/*
  37. ln -s /tmp supp/lib/modules
  38.  
  39. cp -a /lib/ld-2*.so supp/lib
  40. cp -a /lib/ld-linux.so.2* supp/lib
  41.  
  42. for n in $LIBS $ZLIBS; do
  43.     # this preserves hard links
  44.     (cd /lib; tar cSpf - ${n}[-.]*) | (cd supp/lib; tar xSpf -)
  45. done
  46.  
  47. (cd supp/lib; file * | grep 'shared object' | cut -d: -f1 | xargs strip)
  48.  
  49. cd supp/lib
  50. ZLIBLIST=""
  51. for n in $ZLIBS; do
  52.     for file in ${n}*; do
  53.     if [ -f $file -a ! -L $file ]; then
  54.         ZLIBLIST="$ZLIBLIST $file"
  55.     fi
  56.     done
  57. done
  58. ls ${ZLIBLIST} | cpio -H crc -o | bzip2 -9 > compressed_libs.cgz
  59. for file in ${ZLIBLIST}; do
  60.     rm -f $file
  61.     ln -s /tmp/$file .
  62. done
  63. cd ../..
  64.  
  65. for n in $BINS; do
  66.     rm -f supp/usr/bin/$n
  67.     cp -af `which $n` supp/usr/bin
  68. done
  69.  
  70. for n in $VIRTBINS; do
  71.     ln -sf /sbin/install2 supp/usr/bin/$n
  72. done
  73.  
  74. for n in $ZBINS; do
  75.     rm -f supp/usr/bin/$n
  76.     strip `which $n`
  77.     bzip2 -9 < `which $n` > supp/usr/bin/$n.bz2
  78.     ln -sf /tmp/$n supp/usr/bin/$n
  79. done
  80.  
  81. rm -rf supp/usr/etc
  82. mkdir supp/usr/etc
  83. cp ../install/install2.tr supp/usr/etc
  84. cp ../install/install2.tr ../../../RedHat/instimage/usr/etc
  85.  
  86. if echo $2 | grep -s -e -; then
  87.     shortname=`echo $2 | sed 's/-.*//'`
  88. else
  89.     shortname=$2
  90. fi
  91.  
  92. rm -rf pcmcia/lib/modules
  93. mkdir -p pcmcia/lib/modules/${shortname}/pcmcia
  94.  
  95. cp /lib/modules/$2/pcmcia/* pcmcia/lib/modules/${shortname}/pcmcia
  96.  
  97. rm -f pcmcia/etc/pcmcia/*
  98. cp -av /etc/pcmcia/* pcmcia/etc/pcmcia
  99.  
  100. # unfotunately, this breaks things
  101. # strip --strip-unneeded pcmcia/lib/modules/$2/pcmcia/*.o
  102.  
  103. for n in $MODLINKS; do 
  104.     ln -s /modules pcmcia/lib/modules/${shortname}/$n
  105. done
  106.  
  107. for n in $PCMCIA_SBINS; do
  108.     rm -f pcmcia/sbin/$n
  109.     cp -af /sbin/$n pcmcia/sbin/$n
  110. done
  111.  
  112. rm supp/pcmcia.cgz
  113. (cd pcmcia; find . -type f -o -type l | cpio -H crc -o) | gzip -9 > supp/pcmcia.cgz
  114.