The forum

Exécution de script bloquée

Et ce n'est pas le then Tinou... ^^

Author Replies
DjLeChuck Saturday 13 March 2010 at 23:01
DjLeChuckAnonymous

Bonsoir à toutes et à tous,

Je suis en train de réaliser des scripts d'installation pour Tales of Monkey Island mais suis confronté à un soucis.
Durant l'exécution, le script se bloque. À la fin du script j'ai ceci :
wine "$ANSWER"
POL_SetupWindow_detect_exit
POL_SetupWindow_message "$MSG_FINISH_MI"

# Si le client est fr, on propose d installer le patch FR réalisé par http://www.monkeyisland.fr
if [ "$POL_LANG" == "fr" ]	POL_SetupWindow_question "Voulez-vous installer le patch FR réalisé par la team de http://www.monkeyisland.fr ?" "Patch FR"
	if["$APP_ANSWER" == 0]
		POL_SetupWindow_wait_next_signal "Installation du patch FR en cours..." "Installation"
		cd $REPERTOIRE/tmp
		rm *.ttarch
		wget $LIEN_SITE/0.ttarch
		mv 0.ttarch "$REPERTOIRE/wineprefix/$PREFIX_MI/drive_c/Program Files/Telltale Games/Tales of Monkey Island/Rise of the Pirate God/Pack/"
		
		POL_SetupWindow_detect_exit
		POL_SetupWindow_message "Installation du patch FR terminée."
	fi
fi

POL_SetupWindow_make_shortcut "TalesMonkeyIsland" "Program Files/Telltale Games/Tales of Monkey Island/Rise of the Pirate God/" "MonkeyIsland105.exe" "" "Tales of Monkey Island - Rise of the God Pirate"

Set_WineVersion_Assign "1.1.29" "Tales of Monkey Island - Rise of the God Pirate"

L'exécution se bloque à l'arrivée sur la condition. Le script reste bloqué.
Si je commenta le if et le fi, le code à l'intérieur s'exécute puis se bloque au message indiquant la fin de l'installation du patch FR.

D'où vient se problème, ai-je fais quelque chose de travers ?

Edited by DjLeChuck

Quentin PÂRIS Saturday 13 March 2010 at 23:07
Quentin PÂRISAnonymous

T'as oublié les then

La syntaxe c'est

if [ condition ]
then
blablabla
fi
DjLeChuck Saturday 13 March 2010 at 23:09
DjLeChuckAnonymous

... *boulet inside*

Merci Tinou, j'aurais jamais cherché ici pour moi l'erreur venait d'ailleurs (like E.T.).

Shame on me quand même, c'est tout bête cette erreur. ><

EDIT :
Ah non problème non réglé.
J'ai toujours le même problème. :/

Edited by DjLeChuck

Quentin PÂRIS Saturday 13 March 2010 at 23:26
Quentin PÂRISAnonymous

Montre ton code du début à la fin du script
DjLeChuck Saturday 13 March 2010 at 23:27
DjLeChuckAnonymous

Oui bien sur, le voici :

#!/bin/bash
if [ "$PLAYONLINUX" = "" ]	then
	exit 0
fi
source "$PLAYONLINUX/lib/sources"

# Mise en place des chaînes de texte
LIEN_SITE="http://blog.djlechuck.fr/PoL/TalesMonkeyIsland/MI5"
PREFIX_MI="TalesMonkeyIsland"
if [ "$POL_LANG" == "fr" ]
then
	MSG_CLIENT_MI="Veuillez indiquer où se trouve le fichier d'installation ToMI_RiseOfThePirateGod_Setup.exe"
	MSG_INFO_WINE="Wine version 1.1.29 va être installé."
	MSG_DL_WINE="Téléchargement de Wine 1.1.29 en cours, veuillez patienter..."
	TITRE_DL_WINE="Téléchargement de Wine"
	MSG_FINISH_WINE="Installation de Wine terminée."
	MSG_INSTALL_MI="Installation de Tales of Monkey Island - Rise of the Pirate God en cours..."
	TITLE_INSTALL_MI="Installation en cours"
	MSG_INFO_MI="Durant l'installation, décochez la vérification de DirectX."
	MSG_FINISH_MI="Installation de  Tales of Monkey Island - Rise of the Pirate God terminée."
else
	MSG_CLIENT_MI="Please indicate where is the installation file ToMI_RiseOfThePirateGod_Setup.exe"
	MSG_INFO_WINE="Wine version 1.1.29 will be installed."
	MSG_DL_WINE="Downloading of Wine 1.1.29. Please wait..."
	TITRE_DL_WINE="Downloading of Wine"
	MSG_FINISH_WINE="Wine installation finished."
	MSG_INSTALL_MI="Installation of Tales of Monkey Island - Rise of the Pirate God..."
	TITLE_INSTALL_MI="Installation"
	MSG_INFO_MI="During the installation, uncheck the DirectX verification."
	MSG_FINISH_MI="Installation of  Tales of Monkey Island - Rise of the Pirate God finished."
fi

# Récupération des images
cd $REPERTOIRE/tmp
rm *.xpm
rm *.ttarch
wget $LIEN_SITE/icone.xpm

POL_SetupWindow_Init
POL_SetupWindow_presentation "Tales of Monkey Island - Rise of the God Pirate" "Telltale Games" "http://www.telltalegames.com" "DjLeChuck" "$PREFIX_MI"

select_prefixe "$REPERTOIRE/wineprefix/$PREFIX_MI"
POL_SetupWindow_prefixcreate 

Set_OS "winxp"

# Installation de Wine 1.1.29
POL_SetupWindow_message "$MSG_INFO_WINE" "Information" 1 3
POL_SetupWindow_wait_next_signal "$MSG_DL_WINE" "$TITRE_DL_WINE"
POL_SetupWindow_install_wine "1.1.29"
POL_SetupWindow_detect_exit
POL_SetupWindow_message "$MSG_FINISH_WINE"

# Installation du jeu
POL_SetupWindow_browse "$MSG_CLIENT_MI" ""
ANSWER="$APP_ANSWER"
POL_SetupWindow_message "$MSG_INFO_MI"
POL_SetupWindow_wait_next_signal "$MSG_INSTALL_MI" "$TITLE_INSTALL_MI" 3 3
wine "$ANSWER"
POL_SetupWindow_detect_exit
POL_SetupWindow_message "$MSG_FINISH_MI"

# Si le client est fr, on propose d installer le patch FR réalisé par http://www.monkeyisland.fr
if [ "$POL_LANG" == "fr" ]
then
	POL_SetupWindow_question "Voulez-vous installer le patch FR réalisé par la team de http://www.monkeyisland.fr ?" "Patch FR"
	if["$APP_ANSWER" == 0]
	then
		POL_SetupWindow_wait_next_signal "Installation du patch FR en cours..." "Installation"
		cd $REPERTOIRE/tmp
		rm *.ttarch
		wget $LIEN_SITE/0.ttarch
		cp 0.ttarch "$REPERTOIRE/wineprefix/$PREFIX_MI/drive_c/Program Files/Telltale Games/Tales of Monkey Island/Rise of the Pirate God/Pack/"
		
		POL_SetupWindow_detect_exit
		POL_SetupWindow_message "Installation du patch FR terminée."
	fi
fi

POL_SetupWindow_make_shortcut "TalesMonkeyIsland" "Program Files/Telltale Games/Tales of Monkey Island/Rise of the Pirate God/" "MonkeyIsland105.exe" "$REPERTOIRE/tmp/icone.xpm" "Tales of Monkey Island - Rise of the God Pirate"

Set_WineVersion_Assign "1.1.29" "Tales of Monkey Island - Rise of the God Pirate"

# Clean du répertoire tmp
cd $REPERTOIRE/tmp
rm *.xpm
rm *.ttarch

POL_SetupWindow_reboot
POL_SetupWindow_Close

exit

Edited by DjLeChuck

Quentin PÂRIS Saturday 13 March 2010 at 23:40
Quentin PÂRISAnonymous

il faut mettre un espace dans les crochets du if

if [ condition ] et non if [condition]
DjLeChuck Saturday 13 March 2010 at 23:45
DjLeChuckAnonymous

Cela ne change rien.
Le script bloque toujours quand je clic sur Suivant au moment du if [ "$POL_LANG" == "fr" ]. :/
Si je clic sur annuler, l'exécution se stop.

Edited by DjLeChuck

Compte supprimé Sunday 14 March 2010 at 10:13
Compte suppriméAnonymous

Mets des points-virgules avant tes then mon Bibieuw !

if [ "$POL_LANG" == "fr" ]; then
Quentin PÂRIS Sunday 14 March 2010 at 12:22
Quentin PÂRISAnonymous

Exécute ton script grâce a un terminal, et regardes si tu ne trouves pas d'erreurs.

Pour éxécuter un script POL dans un terminal (POL n'est pas obligé d'être lancé)

export PLAYONLINUX="/usr/share/playonlinux/"
bash ton_script
DjLeChuck Sunday 14 March 2010 at 17:07
DjLeChuckAnonymous

Bon, il y avait un soucis de syntaxe avec ma condition ainsi qu'une erreur de retour de variable.
La doc indiqué un retour en 0 - 1 alors que c'était en FALSE - TRUE.
Le problème est réglé. =)

Merci à vous deux.

P.S. : Le ; au if se fait seulement si le then est sur la même ligne.
Si le then est à la ligne suivante, le ; n'a pas à être mit.