The forum

[Script] IDA 5 Pro Free

Author Replies
ManuelV Thursday 9 May 2013 at 15:32
ManuelVAnonymous

IDA is a multi-processor disassembler and debugger.

This script works without any additional modifications

[code language=playonlinux]
#!/bin/bash
# Date : (2013-05-09 12-45)
# Last revision : (2013-05-09 20-50)
# Distribution used to test : Ubuntu 12.10 using Unity and Gnome
# Author : Manuel Vögele
# Script licence : GPLv3
[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

POL_Debug_Init
POL_SetupWindow_Init

TITLE="IDA 5 Pro Free"
WORKING_WINE_VERSION="1.5.29"
WINEPREFIX="IDA5ProFree"
DOWNLOAD_LINK="http://out7.hex-rays.com/files/idafree50.exe"

POL_System_TmpCreate "$WINEPREFIX"

POL_SetupWindow_presentation "IDA 5 Pro Free" "Hex-Rays" "http://www.hex-rays.com/" "Manuel Vögele" "$WINEPREFIX"

POL_SetupWindow_InstallMethod "LOCAL,DOWNLOAD"
if [ "$INSTALL_METHOD" = "LOCAL" ]
then
    cd "$HOME"
    POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run.')" "$TITLE"
    INSTALL_FILE=$APP_ANSWER
elif [ "$INSTALL_METHOD" = "DOWNLOAD" ]
then
    cd "$POL_System_TmpDir"
    POL_Download "$DOWNLOAD_LINK"
    INSTALL_FILE="$POL_System_TmpDir/idafree50.exe"
else
    POL_Debug_Fatal "$(eval_gettext 'Unknown install method.')"
fi

POL_Wine_SelectPrefix "$WINEPREFIX"
POL_Wine_PrefixCreate "$WORKING_WINE_VERSION"

POL_Wine start /unix "$INSTALL_FILE"
POL_Wine_WaitExit

#Apply game fixes
INSTALL_PATH=`find $WINEPREFIX -name "idag.exe" | sed s/idag.exe//g`
mv "$INSTALL_PATH/cfg/idagui.cfg" "$INSTALL_PATH/cfg/idagui_old.cfg"
# The line "BitwiseNegate" in the idagui.cfg has to be commented out
sed 's:"BitwiseNegate://"BitwiseNegate:' "$INSTALL_PATH/cfg/idagui_old.cfg" > "$INSTALL_PATH/cfg/idagui.cfg"

POL_Shortcut "idag.exe" "IDA 5 Pro Free"

POL_System_TmpDelete
POL_SetupWindow_Close
exit
[/code]








22x22 icon


Edit: I forgt to link the screenshots

Edited by ManuelV

petch Thursday 9 May 2013 at 21:49
petch

Hi ManuelV,
My review:

[ "$PLAYONLINUX" = ""] && exit 0

Typo, there's a space missing before ] (yes it matters)

    LANG_SELECT_INST_PROGRAMM="Bitte wählen Sie das Installationsprogramm aus"
...

Use eval_gettext for localization, see http://www.playonlinux.com/en/dev-documentation-10.html

else
    POL_Debug_Init
    POL_Debug_Fatal "$LANG_UNKNOWN_INSTALL_METHOD"

Use POL_Debug_Init early on the script so that an installation log of the whole script is generated, not just when "needed".

    POL_SetupWindow_browse "$LANG_SELECT_INST_PROGRAMM" "$TITLE"

Better set current directory to $HOME before calling POL_SetupWindow_browse to avoid confusing users

POL_Wine start /unix "$INSTALL_FILE"

start /unix is usually useless, and prevents PoL from killing the program automatically if the script is aborted, better avoid it if possible.

POL_SetupWindow_wait_next_signal "$LANG_APPLYING_FIXES" "$TITLE"

POL_SetupWindow_wait_next_signal is being deprecated, use POL_Wine_WaitExit "$TITLE"

Regards,
Pierre.

Edited by petch

ManuelV Thursday 9 May 2013 at 22:16
ManuelVAnonymous

Hi.

I've applied the changes you suggested.

I completely removed the POL_SetupWindow_wait_next_signal, since the bugfixing step is something happening really fast. Since Wine is not running at this point, would POL_Wine_WaitExit really be the right command to use here?
petch Thursday 9 May 2013 at 22:28
petch

POL_Wine_WaitExit may or may not be required depending on whether the POL_Wine statement above is blocking or not. start /unix makes it non blocking, so it's possible that removing it also removed the need to POL_Wine_WaitExit ;)
ManuelV Thursday 9 May 2013 at 22:54
ManuelVAnonymous

Also added the $TITLE variable here.

Regarding my question: I meant if i have longer running tasks which are not Wine-related (for example multiple sed commands), what command should i use as wait there? Also POL_Wine_WaitExit?
petch Thursday 9 May 2013 at 23:09
petch

shell scripts are sequential, unless you start putting commands in background with & suffix
so nothing is required.
petch Friday 10 May 2013 at 23:11
petch