#!/bin/bash # # Product setup script - Loki Entertainment Software # # Modifications by Borland/Inprise Corp.: # 02/24/2000: added functions CheckKernel, CheckLibc, CheckX and enabling code in MAIN # 01/24/2002: added FindLibrary function. Changed CheckJpeg and CheckGtk detection logic. # # Version constants to check against KERNEL_MAJOR=2 KERNEL_MINOR=2 KERNEL_BUILD=0 X_MAJOR=11 X_MINOR=0 LIBC_MAJOR=6 GLIBC_MAJOR=2 GLIBC_MINOR=1 GLIBC_BUILD=2 QT_MAJOR=2 JPEG_MAJOR=6 JPEG_MINOR=2 JPEG_BUILD=0 GTK_MAJOR=1 GTK_MINOR=2 GTK_BUILD=0 NCURSES_MAJOR=4
# Go to the proper setup directory (if not already there) cd `dirname $0`
# BEGIN STRING TABLE # These constants should be translated for international use # CHECK_DEP="Checking dependencies" KERNEL_VER="Kernel version" FAILED="FAILED" OK="OK" LIBC_VER="Glibc version" X_VER="X11 Server" QT_VER="Qt version" LIBJPEG_VER="Libjpeg version" LIBGTK_VER="Libgtk version" CANNOT_FIND="Setup cannot locate" X_SERVER="X Server" X_FAILURE="Setup could not detect a suitable X11 server." CONTINUE="Do you want to install Kylix 3 (default Y) ? " EXIST_INSTALL="Setup has detected an existing installation at this location:" NO_RELOCATE1="If you wish to reinstall, you will not be able to choose a" NO_RELOCATE2="different installation location." LIBNCURSES="Libncurses version" LOADER_ERR1="Setup has determined that your system needs an updated version of glibc" LOADER_ERR2="(C runtime library). The version of glibc that is required varies by" LOADER_ERR3="distribution. Please read the document \"PREINSTALL\" on this disc." FATAL_ERR1="Your system does not meet the minimum system requirements." FATAL_ERR2="Setup cannot continue." KYLIX_RUNNING="Kylix 3 is currently running. Please shut down Kylix and run the installer again." VERS_ERR1="Setup has detected another edition of Kylix is already installed on this system." VERS_ERR2="You must remove the other edition before installing this one." CANNOT_LOAD_CHKLIBC="cannot load chklibc" LESS_THAN="less than" LOADER_TEST_NOT_FOUND="Test program not found" COULD_NOT_FIND="could not find" COULD_NOT_LOCATE="could not locate" CANNOT_LOAD="cannot load" FOUND_VIA_RPM="found via RPM query" UNKNOWN="unknown" NOT_ROOT_NO_CHECK="non-root install...check not performed" DETECTED_RPM="Detected RPM" FORCING_NON_RPM_INSTALL="forcing non-RPM install" SETUP_FAILED="The setup program seems to have failed on" CONTACT_TECH_SUPPORT="Please contact Technical Support." UNSUPPORTED_LIBC_ARCH1="This installation does not support" UNSUPPORTED_LIBC_ARCH2="on" NOT_COREL_LINUX="Not Corel Linux" INSTALL_LOG_HEAD="Borland Kylix install log" KERNEL_VERSION="kernel version" COREL_LINUX_CHECK="Corel Linux check" LOADER_TEST_RESULT="loader test result code" LIBC_VERSION="libc version" LIBJPEG_VERSION="libjpeg version" COULD_NOT_OBTAIN_LIBC_VER="Unable to obtain libc version." COULD_NOT_COPY_CHKLIBC="Unable to copy chklibc." EXISTS_NOT_DIR="exists but is not a directory" WARNING="WARNING:"
# END STRING TABLE
#START OF FUNCTIONS
#Look in /etc/ld.so.conf and search each directory for a pattern in $1. #Caller should capture the output from stdout. function FindLibrary() {
pattern="$1"
#Try default paths first ls /usr/lib/${pattern} 2>/dev/null ls /lib/${pattern} 2>/dev/null
#Look in /etc/ld.so.conf paths if [ -e /etc/ld.so.conf ] then for path in `cat /etc/ld.so.conf` do spath=$path/ has_slash=`expr "$spath" : '\(.*//\)'` if [ -n "$has_slash" ] then spath=$path else spath=$path/ fi ls ${spath}${pattern} 2>/dev/null done fi }
function CheckKernel {
major=`uname -r | awk -F. '{printf $1}'` minor=`uname -r | awk -F. '{printf $2}'` kernelOK=1 if test $major -gt $KERNEL_MAJOR; then kernelOK=0 elif test $major -eq $KERNEL_MAJOR; then if test $minor -ge $KERNEL_MINOR; then kernelOK=0 fi fi kernel_version="$major.$minor" return $kernelOK; }
function CheckLibc { major=0 minor=0 build=0
# copy the chklibc file to someplace where we know it can be executed chklibc="$HOME/.chklibc$$" if [ -e setup.data/chklibc ]; then cp "setup.data/chklibc" "$chklibc" if [ $? -ne 0 ]; then echo "$COULD_NOT_COPY_CHKLIBC" 1>&2 libc_version="$CANNOT_LOAD_CHKLIBC" return 1 fi chmod 700 "$chklibc" libcver=`$chklibc` else libc_version="$CANNOT_LOAD_CHKLIBC" return 1 fi
if [ -e $chklibc ]; then rm -f $chklibc fi
if [ -z "$libcver" ]; then echo "$COULD_NOT_OBTAIN_LIBC_VER" 2>&1 libc_version="$CANNOT_LOAD_CHKLIBC" return 1 fi
major=`echo $libcver |awk -F. '{printf $1}'` minor=`echo $libcver |awk -F. '{printf $2}'` build=`echo $libcver |awk -F. '{printf $3}'` libc_version="$major.$minor.$build" if [ $major -ge $GLIBC_MAJOR ]; then if [ $minor -gt $GLIBC_MINOR ]; then return 0; elif [ $minor -eq $GLIBC_MINOR ]; then if [ $build -ge $GLIBC_BUILD ]; then return 0; else return 1; fi else return 1; fi else libc_version="$LESS_THAN 2.0" return 1; fi }
function CheckLoader { if [ -n "`expr "$args" : '\(.*-g\)'`" ]; then ldresult=0 return 0; else ldresult=1 # copy the borpretest file to someplace where we know it can be executed chkldpath="$HOME/.borchkld$$" if [ -d borpretest ]; then mkdir "$chkldpath" cp borpretest/* "$chkldpath" &>/dev/null chmod 700 "$chkldpath/borpretest" if [ -n "$LD_LIBRARY_PATH" ]; then oldldpath=`echo $LD_LIBRARY_PATH` export LD_LIBRARY_PATH="$chkldpath":$LD_LIBRARY_PATH `$chkldpath/borpretest -q` ldresult=$? export LD_LIBRARY_PATH=$oldldpath else export LD_LIBRARY_PATH="$chkldpath" `$chkldpath/borpretest -q` ldresult=$? unset LD_LIBRARY_PATH fi
if [ -d "$chkldpath" ]; then rm -rf "$chkldpath" fi
loader_result="$ldresult" return $ldresult else loader_result="$LOADER_TEST_NOT_FOUND" return 1 fi fi }
function CheckX { xOK=1 major=0 minor=0 build=0 # Since X may not be in their path, we have to find it #findx=`whereis xdpyinfo` findx=`whereis X | awk '{printf $2}'` if [ -n "$findx" ]; then xOK=0 x_server="$findx" else x_server="$COULD_NOT_FIND" fi return $xOK; }
function CheckJpeg { jpegOK=1 major=0 minor=0 build=0 jpeg_version= fname=
if [ -e /usr/lib/libjpeg.so.62.0.0 ]; then jpegOK=0 jpeg_version="6.2.0" else for fname in `FindLibrary "libjpeg.so.6.*"` do jpeg=`basename "$fname"` major=`echo $jpeg |awk -F. '{print $3}'` minor=`echo $jpeg |awk -F. '{print $4}'` if [ -z "$minor" ]; then minor=0 fi build=`echo $jpeg |awk -F. '{print $5}'` if [ -z "$build" ]; then build=0 fi if [ $major -gt $JPEG_MAJOR ]; then jpegOK=0 elif [ $major -eq $JPEG_MAJOR -a $minor -gt $JPEG_MINOR ]; then jpegOK=0 elif [ $major -eq $JPEG_MAJOR -a $minor -eq $JPEG_MINOR -a $build -ge $JPEG_BUILD ]; then jpegOK=0 fi jpeg_version="$major.$minor.$build" echo $jpeg_version if [ $jpegOK -eq 0 ]; then return $jpegOK #return if found suitable version. else keep looking. fi done fi
return $jpegOK
# if [ -e /usr/lib/libjpeg.so.62.0.0 ]; then # jpegOK=0 # jpeg_version="6.2.0" # elif [ -L /usr/lib/libjpeg.so.6 ]; then # jpeg=`ls /usr/lib/libjpeg.so.6.* 2>/dev/null` # major=`echo $jpeg |awk -F. '{print $3}'` # minor=`echo $jpeg |awk -F. '{print $4}'` # build=`echo $jpeg |awk -F. '{print $5}'` # if [ $major -gt $JPEG_MAJOR ]; then # jpegOK=0 # elif [ $major -eq $JPEG_MAJOR -a $minor -gt $JPEG_MINOR ]; then # jpegOK=0 # elif [ $major -eq $JPEG_MAJOR -a $minor -eq $JPEG_MINOR -a $build -ge $JPEG_BUILD ]; then # jpegOK=0 # fi # jpeg_version="$major.$minor.$build" # fi # # return $jpegOK }
# gtkfiles=`ls /usr/lib/libgtk-*.so.* 2>/dev/null` # if [ $? -ne 0 ]; then # gtkfiles=`ls /usr/X11R6/lib/libgtk-*.so.* 2>/dev/null` # if [ $? -ne 0 ]; then # gtkfiles= # fi # fi
for gtkso in $gtkfiles; do gtkso=`basename $gtkso` gtksolist="$gtksolist `echo $gtkso | awk -F\ '{print $NF}' | sed s/-/./1`" done
for gtkso in $gtksolist; do gtkOK=1 major=`echo $gtkso | awk -F. '{print $2}'` minor=`echo $gtkso | awk -F. '{print $3}'` build=`echo $gtkso | awk -F. '{print $5}'`
if [ $major -gt $GTK_MAJOR ]; then gtkOK=0 elif [ $major -eq $GTK_MAJOR -a $minor -gt $GTK_MINOR ]; then gtkOK=0 elif [ $major -eq $GTK_MAJOR -a $minor -eq $GTK_MINOR -a $build -ge $GTK_BUILD ]; then gtkOK=0 fi
if [ $gtkOK -eq 0 ]; then gtk_version="$major.$minor.$build" return $gtkOK fi done
return $gtkOK }
function CheckCurses {
result=1
# first copy chkcurses to someplace that is executable. chkcurses="$HOME/.chkcurses$$" if [ -e setup.data/chkcurses ]; then cp "setup.data/chkcurses" "$chkcurses" chmod 700 "$chkcurses" ncurses=`$chkcurses 2>/dev/null` else found_ncurses="$CANNOT_LOAD chkcurses" return 1 fi
if [ $? -eq 0 ]; then found_ncurses="$FOUND_VIA_RPM" result=0 elif [ $? -eq 1 ]; then for fname in `FindLibrary "libncurses.so.4"` do found_ncurses="$fname" result=0 break done
# if [ -e /usr/lib/libncurses.so.4 ]; then # found_ncurses="/usr/lib/libncurses.so.4" # result=0 # elif [ -e /usr/local/lib/libncurses.so.4 ]; then # found_ncurses="/usr/local/lib/libncurses.so.4" # result=0 # elif [ -e /lib/libncurses.so.4 ]; then # found_ncurses="/lib/libncurses.so.4" # result=0 # fi fi
if [ -e "$chkcurses" ]; then rm -f "$chkcurses" fi return $result }
# Return the appropriate architecture string function DetectARCH { status=1 case `uname -m` in i?86) echo "x86" status=0;; *) echo "`uname -m`" status=0;; esac return $status }
# Return the appropriate version string function DetectLIBC { status=1 if [ -f `echo /lib/libc.so.6* | tail -1` ]; then if fgrep GLIBC_2.1 /lib/libc.so.6* 2>&1 >/dev/null; then echo "glibc-2.1" status=0 else echo "glibc-2.0" status=0 fi elif [ -f /lib/libc.so.5 ]; then echo "libc5" status=0 else echo "$UNKNOWN" fi return $status }
# Find the installation program function try_run { setup=$1 shift fatal=$1 if [ "$1" != "" ]; then shift fi
# First find the binary we want to run failed=0 setup_bin="setup.data/bin/$arch/$libc/$setup" if [ ! -f "$setup_bin" ]; then setup_bin="setup.data/bin/$arch/$setup" if [ ! -f "$setup_bin" ]; then failed=1 fi fi if [ $failed -eq 1 ]; then if [ "$fatal" != "" ]; then cat <<__EOF__ $UNSUPPORTED_LIBC_ARCH1 $libc $UNSUPPORTED_LIBC_ARCH2 $arch
$CONTACT_TECH_SUPPORT __EOF__ exit 1 fi return $failed fi
# Try to run the binary # The executable is here but we can't execute it from CD setup="$HOME/.setup$$" cp "$setup_bin" "$setup" chmod 700 "$setup" if [ "$fatal" != "" ]; then # User has already been prompted if there is an existing install. # if [ -n "$pathargs" ]; then # cat <<EOF # #$EXIST_INSTALL # #$pathargs # #$NO_RELOCATE1 #$NO_RELOCATE2 # #EOF # echo -n "$CONTINUE " # read response # case $response in # n|N|no|No|NO ) # fatal_error=1 # ;; # * ) # "$setup" $installargs -i$pathargs $* # ;; # esac # else "$setup" $installargs $* # fi failed=$? else if [ -n "$pathargs" ]; then cat <<EOF
$EXIST_INSTALL
$pathargs
$NO_RELOCATE1 $NO_RELOCATE2
EOF echo -n "$CONTINUE " read response case $response in n|N|no|No|NO ) fatal_error=1 ;; * ) "$setup" $installargs -i$pathargs $* 2>/dev/null ;; esac else "$setup" $installargs $* 2>/dev/null fi failed=$? fi rm -f "$setup" return $failed }
function DirInPath() { apath="$1"
if [ -n "$apath" -a -n "$PATH" ]; then for dpath in `echo $PATH | sed s/:/\ /g`; do if [ "$apath" = "$dpath" ]; then return 0 fi done fi return 1 }
function ShowWarnings { # check for stdint.h if [ ! -e /usr/include/stdint.h ] then echo "$WARNING $COULD_NOT_FIND stdint.h" fi
# check for libX11.so libx11files=`FindLibrary "libX11.so"` if [ -z "$libx11files" ] then echo "$WARNING $COULD_NOT_LOCATE libX11.so" fi }
function CheckSystem {
fatal_error=0 error=""
ShowWarnings
if [ -e ~/.borland -a ! -d ~/.borland ]; then fatal_error=1 echo "$HOME/.borland $EXISTS_NOT_DIR....$FAILED" fi
# if DirInPath "$HOME/bin"; then # if [ ! -d "$HOME/bin" ]; then # mkdir "$HOME/bin" 2>/dev/null # fi # fi
if ! CheckKernel; then fatal_error=1 echo "$KERNEL_VER >= $KERNEL_MAJOR.$KERNEL_MINOR.$KERNEL_BUILD....$FAILED" else echo "$KERNEL_VER >= $KERNEL_MAJOR.$KERNEL_MINOR.$KERNEL_BUILD....$OK" fi
if ! CheckLoader; then fatal_error=1 echo "$LIBC_VER....$FAILED" cat <<EOF
$LOADER_ERR1 $LOADER_ERR2 $LOADER_ERR3
EOF elif ! CheckLibc; then fatal_error=1 echo "$LIBC_VER >= $GLIBC_MAJOR.$GLIBC_MINOR.$GLIBC_BUILD....$FAILED" else echo "$LIBC_VER >= $GLIBC_MAJOR.$GLIBC_MINOR.$GLIBC_BUILD....$OK" fi
if ! CheckX; then echo "$X_VER....$FAILED" cat <<EOF
$X_FAILURE
EOF echo -n "$CONTINUE " read response case $response in n|N|no|No|NO ) fatal_error=1 ;; * ) ;; esac else echo "$X_VER....$OK" fi
if ! CheckJpeg; then fatal_error=1 echo "$LIBJPEG_VER >= $JPEG_MAJOR.$JPEG_MINOR.$JPEG_BUILD....$FAILED" else echo "$LIBJPEG_VER >= $JPEG_MAJOR.$JPEG_MINOR.$JPEG_BUILD....$OK" fi
if ! CheckGtk; then fatal_error=1 echo "$LIBGTK_VER >= $GTK_MAJOR.$GTK_MINOR.$GTK_BUILD....$FAILED" else echo "$LIBGTK_VER >= $GTK_MAJOR.$GTK_MINOR.$GTK_BUILD....$OK" fi
# if ! CheckCurses; then # fatal_error=1 # echo "$LIBNCURSES = $NCURSES_MAJOR....$FAILED" # else # echo "$LIBNCURSES = $NCURSES_MAJOR....$OK" # fi
if test $fatal_error -eq 1; then cat <<EOF
$FATAL_ERR1 $FATAL_ERR2
EOF return 1 fi echo echo return 0 }
function CheckPreviousInstall { uid=`id -u` if [ "$uid" = "0" ]; then sh setup.data/chkprevvers.sh if [ $? -eq 0 ]; then chkprev="$HOME/.chkprev$$" cp "setup.data/borcheckprev" "$chkprev" chmod 700 "$chkprev" pathargs=`$chkprev 2>/dev/null` if [ -e "$chkprev" ]; then rm -f "$chkprev" fi else cat <<EOF
$VERS_ERR1 $VERS_ERR2
$FATAL_ERR2 EOF exit 1 fi fi return 0 }
function CheckForCorel { uid=`id -u` if [ "$uid" = "0" ]; then dist=`grep -i "corel" /etc/issue` if [ -n "$dist" ]; then found_corel="Corel Linux: $dist" installargs="-m $installargs" else found_corel="$NOT_COREL_LINUX" fi else found_corel="$NOT_ROOT_NO_CHECK" fi }
if [ -n "`expr "$args" : '\(.*-m\)'`" ]; then #non-rpm install forced installargs="-m" else installargs="" #check rpm version and force -m if relocation bug if [ $UID -eq 0 ]; then if GetRpmVersion; then if [ "$rpmver" = "4.0.2" ]; then echo "$DETECTED_RPM 4.0.2; $FORCING_NON_RPM_INSTALL." installargs="-m" fi fi fi fi CheckForCorel WriteLog if CheckPreviousInstall; then # Try to run the setup program status=0 rm -f "$setup" if ! try_run setup.gtk; then if [ $fatal_error -eq 0 ]; then if ! try_run setup -fatal; then echo "$SETUP_FAILED $arch/$libc" echo echo "$CONTACT_TECH_SUPPORT" status=1 fi fi fi fi exit $status
Jeg har prøvet at køre den på en trustix linux. Jeg fik også fejl ved findlibrary (samme som din) men det skyldes at mit script var med dos linje skift (\r\n) - efter at scriptet blev kørt igennem dos2unix kunne det sagtens eksekvere .. lidt mere. På min kasser fejler det nu ved linje 350 hvor der under- søges om gtk er installeret. Der tages ikke højde for, at gtk2 (som regel) hedder gtk-x11-2 ..
Men prøv at køre dit script igennem dos2unix og kør den modificeret udgave ...
jeg fandt ud at at scriptet skulle køres med bash setup.sh -m i stedet, så virker det hele :)
nu sidder jeg så bare med et andet problem som jeg ikke helt kan greje. under opstarten af endten delphi eller c++ builder efter nogle shared objects, som faktisk ligge rpå sin plads.
... viser om systemet rent faktisk kan finde .so filen.
Enten tilføjes stien i /etc/ld.so.conf (kør /sbin/ldconfig som root bagefter, verificer med /sbin/ldconfig -p ..) eller også sæt LD_LIBRARY_PATH= til stien før du kører scriptet.
P.S: er i tvivl om det er -p eller -P der bruges til ldconfig - prøv dig frem ...
resultatet af: # /sbin/ldconfig -p | grep libpthread libpthread.so.0 (libc6, hwcap: 0x8008000000008000, OS ABI: Linux 2.6.0) => /lib/tls/i686/cmov/libpthread.so.0 libpthread.so.0 (libc6, OS ABI: Linux 2.6.0) => /lib/libpthread.so.0
nu har jeg prøvet at tilføje symbolske links, tilføje ld_library_path i start scriptet og i ld.so.conf. men lige meget hjælper det. den bliver ved med at sige at den ikke kan finde overstående shared objects
den eneste fejlmeddelelse jeg kan finde på mit system er den overnævnte med at libpthread ikke kunne findes på systemet...
kan det have noget at sige at libpthread er nyere en på et 2.4 system? tænker mere på om der nogle funktioner kylix skal bruge der eksistere i v2.4 men måske er ændret/fjernet i v2.6?
Det kender jeg godt! :-) Har selv lige været på en (Albufeira i Portugal - i forrige uge ...)
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.