Files
oldlinux-files/Linux-0.98/Yggdrasil-0.98.3/usr/install/gcc2/install.generi
2024-02-19 00:21:16 -05:00

192 lines
2.7 KiB
Bash
Executable File

#!/bin/sh
# installation script
VERBOSE=no
MATH=soft
prog=
rootdir=/
checkfpu ()
{
echo "Do you have a 387? [y/n] "
read MATH
if [ x${MATH}x = "xyx" ]
then
MATH=hard
else
MATH=soft
fi
}
checkreturn ()
{
if [ $? != 0 ]
then
echo Failed to $1.
exit 1
fi
}
fixfiles ()
{
BINS=$1
if [ $VERBOSE = yes ]; then set -x; fi
if [ x${BINS}x != xx ]; then
cd /usr/bin
chown bin:bin $BINS
chmod 755 $BINS
fi
chown -R bin:bin /usr/include /usr/g++-include /lib /usr/lib/gcc-lib
chmod -R 755 /lib /usr/lib/gcc-lib
# this is for the header files
chmod 755 /usr/include /usr/g++-include
# Yes, 'find' would be cleaner and faster, but it is not on rootdisk
cd /usr/include
chmod 775 *
chmod 664 *.h
chmod 664 */*
cd /usr/g++-include
chmod 775 *
chmod 664 *.h
chmod 664 */*
chmod 664 /usr/lib/gcc-lib/i386-linux/*/*.?
chmod 664 /usr/lib/gcc-lib/i386-linux/*/shared/*.?
for f in in /usr/lib/gcc-lib/i386-linux/*/jump/*.?
do
if [ -f $f ]; then
chmod 664 $f
else
break
fi
done
}
# check if it is a directory.
checkdir ()
{
if [ x${1}x = xx ]
then
echo No directory to check.
return 1
fi
for f in $*
do
if [ ! -d $f ]; then
echo There is no such a directory, $f.
echo Please make sure there is one and it has right stuffs in it.
exit 1
fi
done
return 0
}
checkbinfile ()
{
for f in $*
do
if [ ! -f /bin/$f -a ! -f /usr/bin/$f ]; then
echo There is no such a file, $f.
return 1
fi
done
return 0
}
checkfile ()
{
if [ x${1}x = xx ]
then
echo No file to check.
return 1
fi
for f in $*
do
if [ ! -f $f ]; then
echo There is no such a file, $f.
echo Please make sure there is one and it has right stuffs in it.
exit 1
fi
done
return 0
}
checkroot ()
{
uid=`id | sed -e 's/uid=\([0-9]*\)/\1/' -e 's/[^a-z0-9=].*//'`
if [ $? != 0 ]
then
echo Fail to get \"root\" id. You may need a working \"id\" and
echo \"sed\".
exit 1
fi
if [ x${uid}x != x0x ]
then
echo You have to be root to run this script.
exit 1
fi
}
usage ()
{
echo Usage: sh $prog [-v] [$filename]
echo Note: \"sh\" must be zsh or bash.
exit 1
}
checkroot
prog=$0
if [ $# != 2 -a $# != 3 ]
then
usage
fi
case $1 in
-v)
shift
set -x
VERBOSE=yes
;;
esac
case $# in
1)
filename=`basename $0 .sh`.T.Z
;;
2)
filename=$1
;;
*)
usage
;;
easc
checkfile $filename
echo Installing \"$filename\" .....
working=`pwd`
cd $rootdir
if [ $VERBOSE = yes ];
then
zcat $working/$file | tar xvvof -
else
zcat $working/$file | tar xof -
fi
checkreturn "unpack $filename"
fixfiles