Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

probleme de script d'installation sh

6 réponses
Avatar
pikatxu
bonjour,

j'essaye d'installer pro-engineer sous mandrake10.1, mais j'ai un
probleme dès
le premier script d'installation :

setup: line 78: syntax error near unexpected token `elif'
setup: line 78: ` elif [ "$1" = "?" -o "$1" = "-h" -o "$1" = "-help" ]

j'utilise sh-2.05b et le script est prévu pour redhat
une idée pour débuguer ? je sais que l'installation est possible sous
debian et suse, donc c'est possible

77 shift
78 elif [ "$1" = "?" -o "$1" = "-h" -o "$1" = "-help" ]
79 then



merci

6 réponses

Avatar
tarball
bonjour,

j'essaye d'installer pro-engineer sous mandrake10.1, mais j'ai un
probleme dès
le premier script d'installation :

setup: line 78: syntax error near unexpected token `elif'
setup: line 78: ` elif [ "$1" = "?" -o "$1" = "-h" -o "$1" = "-help" ]

j'utilise sh-2.05b et le script est prévu pour redhat
une idée pour débuguer ? je sais que l'installation est possible sous
debian et suse, donc c'est possible

77 shift
78 elif [ "$1" = "?" -o "$1" = "-h" -o "$1" = "-help" ]
79 then



merci


pourrais-tu poster le script d'install en entier en pièce jointe stp ?

trois lignes ne suffisent pas à se faire une bonne idée du contexte du code.

merci.

--
tarball, le con pressé. ~8^}

Avatar
pikatxu
pourrais-tu poster le script d'install en entier en pièce jointe stp ?

trois lignes ne suffisent pas à se faire une bonne idée du contexte du
code.

merci.



ok merci !
en gros ça decompresse le contenu du cd dans un repertoire temporaire,
etablit quelques variables d'environnements pour le programme
d'installation qui doit etre lancé après, si je comprends bien, mais vu
qu'il me dit "erreur de syntaxe" plutot que de batailler à tout faire
manuellement
je me suis dit que trouver la dite erreur serait peut etre plus facile...


#!/bin/sh -f
#============================================================ # MODIFICATIONS
# ---------------------------------------------------------
# 06-Oct-97 $$1 JJE Created.
# 28-Oct-97 $$2 JJE Use -dirs
# 05-Dec-97 $$3 JJE Remove -vrdirs, set LC_NUMERIC to C
# 22-Dec-97 $$4 JJE Check DISPLAY
# 05-Jan-98 $$5 JJE ignoredddd
# 13-Jan-98 $$6 JJE Use delta lib
# 22-Jan-98 $$7 JJE Add . to path on sgi
# 23-Jan-98 $$8 JJE Add startup messages
# 27-Jan-98 $$9 JJE Add cr
# 31-Jan-98 $$10 JJE Don't echo argv
# 23-Feb-98 $$11 ZRL Added remote install
# 06-Apr-98 $$12 JJE Add sgi_mips4
# 22-Jun-98 $$13 ZRL removed galaxy library
# 29-Jun-98 ##14 ZRL use galaxy library only on sgi_elf2
# 11-Aug-98 $$14 JJE Fix remote install for mips4
# 22-Oct-98 $$15 TWH Fixed remote install
# 11-Nov-98 TWH Fixed cleanup
# 20-Nov-98 $$16 TWH Fixed Trusted login check for Sun
# 08-Sep-99 $$17 JJE Migrate to new installer
# 20-Oct-99 $$18 MYA Add DPS_DIRECTORY
# 07-Aug-00 TWH Check if hpux11_pa32 exists
# 22-Aug-00 $$19 TWH rewritten to /bin/sh for multicd
# 18-Sep-00 $$20 TWH support non c echo; -multicd iff using redirect
# 09-Oct-00 $$21 TWH Fix command-line args; fix PROSETUP_EXE bug
# 31-Oct-00 $$22 TWH Fix for $0 == "setup"
# 17-Jan-01 $$23 TWH always run sun4_solaris instead of _64 this script
# 16-May-01 $$24 TWH always run hpux11_pa32 instead of hpux_pa64
# 13-Jun-02 $$25 JJE Support -64 arg
# 16-Jul-02 $$26 TWH Set TMP & TEMP if not set
# 20-Aug-02 $$27 TWH Fix #26
# 26-Aug-02 $$28 TWH Another fix for #26
# 23-Jan-03 J-03-41 $$29 MAZ Support PROSETUP_EXE in multicd mode
#============================================================
rundir=`pwd`
fullscrname=$0
# :t
scrname=`echo $fullscrname | awk -F"/" '{ print $NF}'`
# :h
fullscrpath=`echo $fullscrname | awk -F"/" '{ ORS="/"} { n=split($0,A)}
{ for (i = 1; i < n; i++) print A[i] }'`
if [ "$fullscrpath" = "" ]
then
fullscrpath=$0
else
fullscrpath=`echo $fullscrpath | awk '{ n=length($0)} { n -= 1} {
print substr($0,1,n)}'`
fi

if [ "$fullscrpath" = "$fullscrname" ]
then
fullscrpath=`pwd`
else
cd $fullscrpath
fullscrpath=`pwd`
fi

echostr=`echo "test c"`
if [ "$echostr" = "test c" ]
then
alt_echo=true
fi

bit_mode_64úlse
other_args=""
i=1
while [ "$i" -le $# ]
do
if [ "$1" = "-display" ]
then
shift
echo "setting DISPLAY to: $1"
DISPLAY="$1"
export DISPLAY
shift
elif [ "$1" = "?" -o "$1" = "-h" -o "$1" = "-help" ]
then
echo ""
echo "Usage: $scrname [ -display unix:0 ]"
exit 0
elif [ "$1" = "-remote" ]
then
echo ""
echo "Sorry, remote installation is not supported in this release."
exit 1
elif [ "$1" = "-cdrom" ]
then
shift
echo "setting CDROM path to: $1"
fullscrpath="$1"
shift
elif [ "$1" = "-64" ]
then
shift
bit_mode_64=true
else
other_args="$other_args $1"
shift
fi
done

cd $rundir
prodir=$fullscrpath
imagedir=$fullscrpath
getpmtscr="getpmt.csh"

if [ ! -x "$imagedir/$getpmtscr" ]
then
echo ""
echo "ERROR: $imagedir/$getpmtscr - file is missing."
echo " Check the name of the CD mount directory."
exit 1
fi

mctype=`$imagedir/$getpmtscr`
if [ "$mctype" = "UNKNOWN" ]
then
echo ""
echo "ERROR: OS name unknown."
exit 1
fi

test "$TMP"
if [ $? != 0 ]
then
if [ -x "/tmp" ]
then
TMP="/tmp"
export TMP
elif [ -x "/var/tmp" ]
then
TMP="/var/tmp"
export TMP
fi
fi
test "$TEMP"
if [ $? != 0 ]
then
if [ -x "/tmp" ]
then
TEMP="/tmp"
export TEMP
elif [ -x "/var/tmp" ]
then
TEMP="/var/tmp"
export TEMP
fi
fi
test "$DISPLAY"
if [ $? != 0 ]
then
echo ""
echo 'ERROR: The DISPLAY variable is not set - '
echo ""
echo " Options:"
echo " o Press <cr> to set DISPLAY to `hostname`:0.0"
echo " o Type a value to use for the DISPLAY variable"
echo " o Enter 'q' to abort prosetup"
echo " o Specify '-display <host>:0' on the command line"
echo ""
test "$alt_echo"
if [ $? = 0 ]
then
echo -n "Set it to (`hostname`:0.0): [q to abort] "
else
echo "Set it to (`hostname`:0.0): [q to abort] c"
fi
read line
if [ "$line" = "q*" -o "$line" = "Q*" ]
then
exit -1
elif [ "$line" = "" ]
then
DISPLAY="`hostname`:0.0"
export DISPLAY
else
DISPLAY="$line"
export DISPLAY
fi
echo ""
echo " DISPLAY has been set to: $DISPLAY"
echo ""
fi

echo ""
test "$alt_echo"
if [ $? = 0 ]
then
echo -n "Starting PTC.Setup, please wait ..."
else
echo "Starting PTC.Setup, please wait ...c"
fi

if [ "$mctype" = "sun4_solaris_64" -a "$bit_mode_64" = "false" ]
then
mctype="sun4_solaris"
fi
if [ "$mctype" = "sun4_solaris" ]
then
PATH=$PATH:/usr/ucb
export PATH
fi

if [ "$mctype" = "sgi_elf2" -o "$mctype" = "sgi_mips4" ]
then
PATH=.:$PATH
export PATH
fi
if [ "$mctype" = "hpux_pa64" -a "$bit_mode_64" = "false" ]
then
mctype="hpux11_pa32"
fi
if [ "$mctype" = "hpux11_pa32" ]
then
if [ ! -d "$imagedir/dsrc/$mctype" ]
then
mctype="hp8k"
fi
fi

PTC_CDHOME=$imagedir
export PTC_CDHOME
PS_DIRECTORY=$imagedir/dsrc
export PS_DIRECTORY
DPS_DIRECTORY=$imagedir/dsrc
export DPS_DIRECTORY
PRO_MACHINE_TYPE=$mctype
export PRO_MACHINE_TYPE
LC_NUMERIC=C
export LC_NUMERIC

test "$PROSETUP_EXE"
if [ $? != 0 ]
then
PROSETUP_EXE="$imagedir/dsrc/$mctype/obj/ptcsetup"
elif [ -x "$PROSETUP_EXE" ]
then
echo ""
test "$alt_echo"
if [ $? = 0 ]
then
echo -n "Using $PROSETUP_EXE ..."
else
echo "Using $PROSETUP_EXE ...c"
fi
fi

if [ ! -x "$PROSETUP_EXE" ]
then
echo ""
echo "ERROR: $PROSETUP_EXE - file is missing."
echo " Check the name of the CD mount directory."
exit 1
fi

REDIRECT_EXE="$imagedir/dsrc/$mctype/obj/redirect"
if [ -x "$REDIRECT_EXE" ]
then
($REDIRECT_EXE $other_args -multicd ) &
else
($PROSETUP_EXE $other_args ) &
fi

echo ""
exit 0

Avatar
tarball
pourrais-tu poster le script d'install en entier en pièce jointe stp ?

trois lignes ne suffisent pas à se faire une bonne idée du contexte du
code.

merci.



ok merci !
en gros ça decompresse le contenu du cd dans un repertoire temporaire,
etablit quelques variables d'environnements pour le programme
d'installation qui doit etre lancé après, si je comprends bien, mais vu
qu'il me dit "erreur de syntaxe" plutot que de batailler à tout faire
manuellement
je me suis dit que trouver la dite erreur serait peut etre plus facile...


#!/bin/sh -f
#============================================================ > # MODIFICATIONS
# ---------------------------------------------------------
# 06-Oct-97 $$1 JJE Created.
# 28-Oct-97 $$2 JJE Use -dirs
# 05-Dec-97 $$3 JJE Remove -vrdirs, set LC_NUMERIC to C
# 22-Dec-97 $$4 JJE Check DISPLAY
# 05-Jan-98 $$5 JJE ignoredddd
# 13-Jan-98 $$6 JJE Use delta lib
# 22-Jan-98 $$7 JJE Add . to path on sgi
# 23-Jan-98 $$8 JJE Add startup messages
# 27-Jan-98 $$9 JJE Add cr
# 31-Jan-98 $$10 JJE Don't echo argv
# 23-Feb-98 $$11 ZRL Added remote install
# 06-Apr-98 $$12 JJE Add sgi_mips4
# 22-Jun-98 $$13 ZRL removed galaxy library
# 29-Jun-98 ##14 ZRL use galaxy library only on sgi_elf2
# 11-Aug-98 $$14 JJE Fix remote install for mips4
# 22-Oct-98 $$15 TWH Fixed remote install
# 11-Nov-98 TWH Fixed cleanup
# 20-Nov-98 $$16 TWH Fixed Trusted login check for Sun
# 08-Sep-99 $$17 JJE Migrate to new installer
# 20-Oct-99 $$18 MYA Add DPS_DIRECTORY
# 07-Aug-00 TWH Check if hpux11_pa32 exists
# 22-Aug-00 $$19 TWH rewritten to /bin/sh for multicd
# 18-Sep-00 $$20 TWH support non c echo; -multicd iff using redirect
# 09-Oct-00 $$21 TWH Fix command-line args; fix PROSETUP_EXE bug
# 31-Oct-00 $$22 TWH Fix for $0 == "setup"
# 17-Jan-01 $$23 TWH always run sun4_solaris instead of _64 this script
# 16-May-01 $$24 TWH always run hpux11_pa32 instead of hpux_pa64
# 13-Jun-02 $$25 JJE Support -64 arg
# 16-Jul-02 $$26 TWH Set TMP & TEMP if not set
# 20-Aug-02 $$27 TWH Fix #26
# 26-Aug-02 $$28 TWH Another fix for #26
# 23-Jan-03 J-03-41 $$29 MAZ Support PROSETUP_EXE in multicd mode
#============================================================ >
rundir=`pwd`
fullscrname=$0
# :t
scrname=`echo $fullscrname | awk -F"/" '{ print $NF}'`
# :h
fullscrpath=`echo $fullscrname | awk -F"/" '{ ORS="/"} { n=split($0,A)}
{ for (i = 1; i < n; i++) print A[i] }'`
if [ "$fullscrpath" = "" ]
then
fullscrpath=$0
else
fullscrpath=`echo $fullscrpath | awk '{ n=length($0)} { n -= 1} {
print substr($0,1,n)}'`
fi

if [ "$fullscrpath" = "$fullscrname" ]
then
fullscrpath=`pwd`
else
cd $fullscrpath
fullscrpath=`pwd`
fi

echostr=`echo "test c"`
if [ "$echostr" = "test c" ]
then
alt_echo=true
fi

bit_mode_64úlse
other_args=""
i=1
while [ "$i" -le $# ]
do
if [ "$1" = "-display" ]
then
shift
echo "setting DISPLAY to: $1"
DISPLAY="$1"
export DISPLAY
shift
elif [ "$1" = "?" -o "$1" = "-h" -o "$1" = "-help" ]
then
echo ""
echo "Usage: $scrname [ -display unix:0 ]"
exit 0
elif [ "$1" = "-remote" ]
then
echo ""
echo "Sorry, remote installation is not supported in this release."
exit 1
elif [ "$1" = "-cdrom" ]
then
shift
echo "setting CDROM path to: $1"
fullscrpath="$1"
shift
elif [ "$1" = "-64" ]
then
shift
bit_mode_64=true
else
other_args="$other_args $1"
shift
fi
done

cd $rundir
prodir=$fullscrpath
imagedir=$fullscrpath
getpmtscr="getpmt.csh"

if [ ! -x "$imagedir/$getpmtscr" ]
then
echo ""
echo "ERROR: $imagedir/$getpmtscr - file is missing."
echo " Check the name of the CD mount directory."
exit 1
fi

mctype=`$imagedir/$getpmtscr`
if [ "$mctype" = "UNKNOWN" ]
then
echo ""
echo "ERROR: OS name unknown."
exit 1
fi

test "$TMP"
if [ $? != 0 ]
then
if [ -x "/tmp" ]
then
TMP="/tmp"
export TMP
elif [ -x "/var/tmp" ]
then
TMP="/var/tmp"
export TMP
fi
fi
test "$TEMP"
if [ $? != 0 ]
then
if [ -x "/tmp" ]
then
TEMP="/tmp"
export TEMP
elif [ -x "/var/tmp" ]
then
TEMP="/var/tmp"
export TEMP
fi
fi
test "$DISPLAY"
if [ $? != 0 ]
then
echo ""
echo 'ERROR: The DISPLAY variable is not set - '
echo ""
echo " Options:"
echo " o Press <cr> to set DISPLAY to `hostname`:0.0"
echo " o Type a value to use for the DISPLAY variable"
echo " o Enter 'q' to abort prosetup"
echo " o Specify '-display <host>:0' on the command line"
echo ""
test "$alt_echo"
if [ $? = 0 ]
then
echo -n "Set it to (`hostname`:0.0): [q to abort] "
else
echo "Set it to (`hostname`:0.0): [q to abort] c"
fi
read line
if [ "$line" = "q*" -o "$line" = "Q*" ]
then
exit -1
elif [ "$line" = "" ]
then
DISPLAY="`hostname`:0.0"
export DISPLAY
else
DISPLAY="$line"
export DISPLAY
fi
echo ""
echo " DISPLAY has been set to: $DISPLAY"
echo ""
fi

echo ""
test "$alt_echo"
if [ $? = 0 ]
then
echo -n "Starting PTC.Setup, please wait ..."
else
echo "Starting PTC.Setup, please wait ...c"
fi

if [ "$mctype" = "sun4_solaris_64" -a "$bit_mode_64" = "false" ]
then
mctype="sun4_solaris"
fi
if [ "$mctype" = "sun4_solaris" ]
then
PATH=$PATH:/usr/ucb
export PATH
fi

if [ "$mctype" = "sgi_elf2" -o "$mctype" = "sgi_mips4" ]
then
PATH=.:$PATH
export PATH
fi
if [ "$mctype" = "hpux_pa64" -a "$bit_mode_64" = "false" ]
then
mctype="hpux11_pa32"
fi
if [ "$mctype" = "hpux11_pa32" ]
then
if [ ! -d "$imagedir/dsrc/$mctype" ]
then
mctype="hp8k"
fi
fi

PTC_CDHOME=$imagedir
export PTC_CDHOME
PS_DIRECTORY=$imagedir/dsrc
export PS_DIRECTORY
DPS_DIRECTORY=$imagedir/dsrc
export DPS_DIRECTORY
PRO_MACHINE_TYPE=$mctype
export PRO_MACHINE_TYPE
LC_NUMERIC=C
export LC_NUMERIC

test "$PROSETUP_EXE"
if [ $? != 0 ]
then
PROSETUP_EXE="$imagedir/dsrc/$mctype/obj/ptcsetup"
elif [ -x "$PROSETUP_EXE" ]
then
echo ""
test "$alt_echo"
if [ $? = 0 ]
then
echo -n "Using $PROSETUP_EXE ..."
else
echo "Using $PROSETUP_EXE ...c"
fi
fi

if [ ! -x "$PROSETUP_EXE" ]
then
echo ""
echo "ERROR: $PROSETUP_EXE - file is missing."
echo " Check the name of the CD mount directory."
exit 1
fi

REDIRECT_EXE="$imagedir/dsrc/$mctype/obj/redirect"
if [ -x "$REDIRECT_EXE" ]
then
($REDIRECT_EXE $other_args -multicd ) &
else
($PROSETUP_EXE $other_args ) &
fi

echo ""
exit 0





remplace

elif [ "$1" = "?" -o "$1" = "-h" -o "$1" = "-help" ]

par

elif [ "$1" = "?" || "$1" = "-h" || "$1" = "-help" ]

et ça devrait marcher, car -o a une autre signification que la clause 'OR' conditionnelle (c'est une clause d'option de
fichier me semble-t-il, si ma mémoire est bonne).

j'ai parcouru un peu rapidement le script, mais il me semble que le même "bug" se retrouve un peu partout.

en fait, il faut remplacer partout dans le script tous les -o dans les expressions conditionnelles [ expr = expr -o expr
= expr ] par des opérateurs logiques booléens de type || (clause 'OR')

tu dois avoir des erreurs dans les lignes suivantes :

ligne 78
ligne 171
ligne 206

idem pour les clauses -a qu'il faut remplacer par && dans les expressions conditionnelles

e.g. if [ "$1" = "toto" -a "$2" = "tutu" ] doit s'écrire if [ "$1" = "toto" && "$2" = "tutu" ]

il te suffit d'ouvrir le fichier script shell dans un éditeur texte et lancer l'outil remplacer "-o" par "||" (en
respectant la casse et en demandant à voir où il remplace chaque occurence) puis de remplacer "-a" par "&&" partout aussi.

après quoi, ton script devrait fonctionner :)

--
tarball, le con pressé. ~8^}


Avatar
Rakotomandimby Mihamina
tarball wrote:

après quoi, ton script devrait fonctionner :)


Bon entre nous, t'aurais pu éviter de citer tout le script hein...

Sinon pikatchu, tu peux (moi j'ai tendance à penser que c'est une bonne
idée) aussi remonter le bug à l'auteur du script.

C'est ce qui fait avancer les logiciels dont on a les sources.

Libre à l'auteur ensuite de prendre en compte ou pas ta modifiction.

--
Miroir de logiciels libres => http://www.etud-orleans.fr
Un Nokia sous Linux, "programmable" en Open Source
http://www.nokia.com/770 , http://www.maemo.org/
http://www.maemo.org/platform/docs/tutorials/Maemo_tutorial.html

Avatar
pikatxu
merci à toi tarball !

Sinon pikatchu, tu peux (moi j'ai tendance à penser que c'est une bonne
idée) aussi remonter le bug à l'auteur du script.

C'est ce qui fait avancer les logiciels dont on a les sources.



justement c'est un logiciel propriétaire et la version linux est
officiellement destinée à redhat

Avatar
tarball
tarball wrote:


après quoi, ton script devrait fonctionner :)



Bon entre nous, t'aurais pu éviter de citer tout le script hein...


ben non pkoi ? tu n'aimes pas les tartines ? :-D


Sinon pikatchu, tu peux (moi j'ai tendance à penser que c'est une bonne
idée) aussi remonter le bug à l'auteur du script.

C'est ce qui fait avancer les logiciels dont on a les sources.

Libre à l'auteur ensuite de prendre en compte ou pas ta modifiction.




--
tarball, le con pressé. ~8^}