home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1999 November
/
VPR9911B.ISO
/
misc
/
src
/
trees
/
updpcmcia
< prev
next >
Wrap
Text File
|
1999-08-30
|
4KB
|
175 lines
#!/bin/sh
LIBS="libc"
# chmod could be a VIRTBIN, but the runinstall2 script uses it to set things up
SBINS="cardmgr"
KERNELROOT=/tmp/updpcmcia.kernel-$$
export PATH=$PATH:/sbin:/usr/sbin
usage () {
echo "updpcmcia: <imagetree> <rpm-tree> <kernel-version> [dep]" 2>&1
exit 1
}
if [ -z "$1" -o -z "$2" -o -z "$3" ]; then
usage
fi
mkdir -p $KERNELROOT
rpm2cpio $2/kernel-pcmcia-cs-$3.i386.rpm | (cd $KERNELROOT; cpio -id)
rpm2cpio $2/kernel-$3.i386.rpm | (cd $KERNELROOT; cpio -id)
if [ ! -d "$1/misc/src/install" ]; then
echo "$1 is not a valid directory" 2>&1
usage
fi
if [ ! -d "$KERNELROOT/lib/modules/$3/pcmcia" ]; then
echo "$3 is not a valid modules directory" 2>&1
usage
fi
PATH=$1/misc/src/install:/usr/sbin:/usr/bin:/bin:/sbin
cp -a /lib/ld-2*.so supp/lib
cp -a /lib/ld-linux.so.2* supp/lib
cp -a /lib/ld-2*.so ../../../LASER5/instimage/lib
cp -a /lib/ld-linux.so.2* ../../../LASER5/instimage/lib
for n in $CDLIBS; do
(cd /lib; tar cSpf - ${n}[-.]*) | (cd ../../../LASER5/instimage/lib; tar xSpf -)
done
for n in $LIBS; do
# this preserves hard links
(cd /lib; tar cSpf - ${n}[-.]*) | (cd supp/lib; tar xSpf -)
done
(cd supp/lib; file * | grep 'shared object' | cut -d: -f1 | xargs strip)
cat > supp/usr/bin/runinstall2 <<EOF
#!/bin/sh
PATH=/usr/bin:/bin
echo "" > /sbin/install
if [ -f /sbin/cardmgr ]; then
> /modules/modules.cgz
fi
> /sbin/install2
chmod 755 /sbin/install2
bunzip2 < /usr/bin/install2.bz2 > /sbin/install2
bunzip2 < /usr/bin/fdisk.bz2 > /tmp/fdisk
chmod 755 /tmp/fdisk
rm /sbin/install
ln -sf /sbin/install2 /sbin/insmod
ln -sf /sbin/install2 /sbin/rmmod
if [ -f /sbin/cardmgr ]; then
rm /modules/modules.cgz
fi
exec /sbin/install2 \$*
EOF
chmod 755 supp/usr/bin/runinstall2
cat > ../../../LASER5/instimage//usr/bin/runinstall2 <<EOF
#!/bin/sh
rm /sbin/install
ln -sf /usr/bin/install2 /sbin/insmod
ln -sf /usr/bin/install2 /sbin/rmmod
exec /usr/bin/install2 \$*
EOF
chmod 755 ../../../LASER5/instimage//usr/bin/runinstall2
for n in $BINS; do
rm -f supp/usr/bin/$n
cp -af `which $n` supp/usr/bin
done
ln -sf bzip2 supp/usr/bin/bunzip2
ln -sf ash supp/usr/bin/sh
for n in $VIRTBINS; do
ln -sf /sbin/install2 supp/usr/bin/$n
done
for n in $ZBINS; do
rm -f supp/usr/bin/$n
rm -f ../../../LASER5/instimage/usr/bin/$n
cp -af `which $n` ../../../LASER5/instimage/usr/bin
strip `which $n`
bzip2 -9 < `which $n` > supp/usr/bin/$n.bz2
ln -sf /tmp/$n supp/usr/bin/$n
done
for n in $CDBINS; do
rm -f ../../../LASER5/instimage/usr/bin/$n
cp -af `which $n` ../../../LASER5/instimage/usr/bin
done
ln -sf bash ../../../LASER5/instimage/usr/bin/sh
ln -sf gzip ../../../LASER5/instimage/usr/bin/gunzip
ln -sf vim ../../../LASER5/instimage/usr/bin/vi
for n in $CDVIRTBINS; do
ln -sf install2 ../../../LASER5/instimage/usr/bin/$n
done
cp ../install/install2.tr supp/usr/etc
cp ../install/install2.tr ../../../LASER5/instimage/usr/etc
if echo $3 | grep -s -e -; then
shortname=`echo $3 | sed 's/-.*//'`
else
shortname=$3
fi
rm -rf pcmcia/lib/modules
mkdir -p pcmcia/lib/modules/${shortname}/pcmcia
mkdir -p pcmcia/etc/pcmcia
mkdir -p pcmcia/sbin
#cp $KERNELROOT/lib/modules/$3/pcmcia/* pcmcia/lib/modules/${shortname}/pcmcia
rm -f pcmcia/etc/pcmcia/*
#cp -av $KERNELROOT/etc/pcmcia/* pcmcia/etc/pcmcia
# unfotunately, this breaks things
# strip --strip-unneeded pcmcia/lib/modules/$2/pcmcia/*.o
for n in $MODLINKS; do
ln -s /modules pcmcia/lib/modules/${shortname}/$n
done
(cd pcmcia/lib/modules; ln -s * preferred)
#for n in $PCMCIA_SBINS; do
# rm -f pcmcia/sbin/$n
# cp -af $KERNELROOT/sbin/$n pcmcia/sbin/$n
#done
rm -rf pcmcia-disk
mkdir pcmcia-disk
echo "Letting NFS settle down"
sleep 5
(cd pcmcia; find . -type f -o -type l | cpio -H crc -o) | gzip -9 > \
pcmcia-disk/pcmcia.cgz
mkdir -p pcmcia-disk/lib
cp -a /lib/ld-2*.so pcmcia-disk/lib
cp -a /lib/ld-linux.so.2* pcmcia-disk/lib
(cd /lib; tar cSpf - libc[-.]*) | (cd pcmcia-disk/lib; tar xSpf -)
(cd pcmcia-disk/lib; strip *)
(cd ../../../LASER5/instimage/; tar cSpf - modules) | (cd supp; tar xSpf -)