The forum
[script] The Darkmod
Author | Replies | ||||||||||||
b1k3rdude | Friday 29 May 2015 at 14:38 | ||||||||||||
b1k3rdude![]()
|
Evening One of forum members over on the darkmod forums has got a new script code for me to try out and he will have an updated version over the week once I have some feedback for him from the test run tomoz - #!/bin/bash # Date : 2015-05-28 # Last revision : 2015-05-28 # Wine version used : 1.7.16 # Distribution used to test : Mac OS 10.9.5 # Author : Freek 'Freyk' Borgerink # Licence : GPL [ "$PLAYONLINUX" = "" ] && exit 0 source "$PLAYONLINUX/lib/sources" TITLE="The Dark Mod" PREFIX="TheDarkMod" EDITOR="Broken Glass Studios" GAME_URL="http://www.thedarkmod.com" AUTHOR="Freek 'Freyk' Borgerink" WORKING_WINE_VERSION="1.7.16" # Starting the script POL_SetupWindow_Init # Starting debugging API POL_Debug_Init POL_SetupWindow_presentation "$TITLE" "$EDITOR" "$GAME_URL" "$AUTHOR" "$PREFIX" # Setting prefix POL_Wine_SelectPrefix "$PREFIX" POL_Wine_PrefixCreate #"$WORKING_WINE_VERSION" POL_SetupWindow_InstallMethod "DOWNLOAD,LOCAL" if [ "$INSTALL_METHOD" = "LOCAL" ] then #create prefix folder mkdir -p "$WINEPREFIX/drive_c/games/thedarkmod" cd "$WINEPREFIX/drive_c/games/thedarkmod" POL_SetupWindow_message "Please download the darkmod updater executable from www.thedarkmod.com" "$TITLE installation" POL_SetupWindow_browse "Please select the darkmod updater executable to run." "$TITLE installation" POL_Wine start /unix "$APP_ANSWER" cp "$APP_ANSWER" "$WINEPREFIX/drive_c/games/thedarkmod/tdm_update.exe" #Create the shortcut for the updater POL_Shortcut "tdm_update.exe" "The Dark Mod Updater" touch "$WINEPREFIX/drive_c/games/thedarkmod/tdm.exe" POL_Shortcut "tdm.exe" "The Dark Mod" fi if [ "$INSTALL_METHOD" = "DOWNLOAD" ] then #create prefix folder #Download tdm updater mkdir -p "$WINEPREFIX/drive_c/games/thedarkmod" cd "$WINEPREFIX/drive_c/games/thedarkmod" #Download tdm updater POL_Download "http://www.fidcal.com/darkuser/tdm_update_win.zip" "ff1b6d10c65970422206133e923cf36d" #Unpack the zipfile POL_System_ExtractSingleFile "$WINEPREFIX/drive_c/games/thedarkmod/tdm_update_win.zip" "tdm_update.exe" "$WINEPREFIX/drive_c/games/thedarkmod/tdm_update.exe" rm "$WINEPREFIX/drive_c/games/thedarkmod/tdm_update_win.zip" #Create shortcut for updater POL_Shortcut "tdm_update.exe" "The Dark Mod Updater" touch "$WINEPREFIX/drive_c/games/thedarkmod/tdm.exe" POL_Shortcut "tdm.exe" "The Dark Mod" fi #Run the updater INSTALLER="$WINEPREFIX/drive_c/games/thedarkmod/tdm_update.exe" POL_SetupWindow_wait "Installation in progress." "The Dark Mod installation" POL_Wine start /unix "$INSTALLER" POL_Wine_WaitExit "The Dark Mod Updater" POL_SetupWindow_message "Hello World!" "My first message" POL_SetupWindow_Close exit 0 |
||||||||||||
petch | Saturday 30 May 2015 at 11:47 | ||||||||||||
petch![]()
|
Hi, Here's my review:
The Wine version declared is not used, if you really want to use the system installed version (not that I recommend that) remove $WORKING_WINE_VERSION declaration altogether.
All user-oriented messages must support localization (http://wiki.playonlinux.com/index.php/Scripting_-_Chapter_10:_Script_Translation)
Use standard messages for standard cases to save on translators' work (http://wiki.playonlinux.com/index.php/Scripting_-_Chapter_9:_Standardization)
"start /unix" is usually unnecessary, and also makes POL_Wine non-blocking; Since it's not followed by POL_Wine_WaitExit "$TITLE", the script will continue before above command completes, which could explain the need for the "touch" command below?
You can use POL_Wine_WaitBefore "$TITLE" instead, will save you the trouble for another message to localize.
Debugging leftover? My scripts wiki: https://github.com/petchema/playonlinux/wiki GOGmix: https://www.gog.com/en/mix/playonlinux_install_scripts |
||||||||||||
freyk | Saturday 30 May 2015 at 17:07 | ||||||||||||
freyk![]()
|
Here is a update of the code. - added some new install options #!/bin/bash # Date : 2015-05-28 # Last revision : 2015-05-30 # Wine version used : 1.7.16 # Distribution used to test : Mac OS 10.9.5 # Author : Freek 'Freyk' Borgerink # Licence : GPL [ "$PLAYONLINUX" = "" ] && exit 0 source "$PLAYONLINUX/lib/sources" TITLE="The Dark Mod" PREFIX="TheDarkMod" EDITOR="Broken Glass Studios" GAME_URL="http://www.thedarkmod.com" AUTHOR="Freek 'Freyk' Borgerink" WORKING_WINE_VERSION="1.7.16" #md5hash of tdm_update_win.zip from the thedarkmod.com site TDMWINUPDATEHASH="ff1b6d10c65970422206133e923cf36d" ################################ #clear script vars RUNUPDATER="0" # Starting the script POL_SetupWindow_Init # Starting debugging API POL_Debug_Init POL_SetupWindow_presentation "$TITLE" "$EDITOR" "$GAME_URL" "$AUTHOR" "$PREFIX" #Select the download method POL_SetupWindow_menu "How would you like to install The Dark Mod?" "Install Method" "Online|Local updater zip|Local Standonlone zip" "|" INSTALLMETHOD="$APP_ANSWER" if [ "$INSTALLMETHOD" = "Online" ] then #create prefix folder POL_Wine_SelectPrefix "$PREFIX" POL_Wine_PrefixCreate #"$WORKING_WINE_VERSION" Set_OS "win7" mkdir -p "$WINEPREFIX/drive_c/games/thedarkmod" cd "$WINEPREFIX/drive_c/games/thedarkmod" #Download tdm updater POL_Download "http://www.fidcal.com/darkuser/tdm_update_win.zip" "$TDMWINUPDATEHASH" #Unpack the zipfile POL_System_ExtractSingleFile "$WINEPREFIX/drive_c/games/thedarkmod/tdm_update_win.zip" "tdm_update.exe" "$WINEPREFIX/drive_c/games/thedarkmod/tdm_update.exe" rm "$WINEPREFIX/drive_c/games/thedarkmod/tdm_update_win.zip" #Create shortcut for updater POL_Shortcut "tdm_update.exe" "The Dark Mod Updater" RUNUPDATER="1" fi if [ "$INSTALLMETHOD" = "Local updater zip" ] then #create prefix folder POL_SetupWindow_message "Please download the darkmod updater executable from www.thedarkmod.com" "$TITLE installation" POL_SetupWindow_browse "Please select the darkmod updater executable to run." "$TITLE installation" # Setting prefix POL_Wine_SelectPrefix "$PREFIX" POL_Wine_PrefixCreate #"$WORKING_WINE_VERSION" mkdir -p "$WINEPREFIX/drive_c/games/thedarkmod" #Unpack the zipfile POL_System_ExtractSingleFile "$APP_ANSWER" "tdm_update.exe" "$WINEPREFIX/drive_c/games/thedarkmod/tdm_update.exe" #Create the shortcut for the updater POL_Shortcut "tdm_update.exe" "The Dark Mod Updater" POL_SetupWindow_message "running updater" "Going to run the updater to download the files" RUNUPDATER="1" fi if [ "$INSTALLMETHOD" = "Local Standonlone zip" ] then #create prefix folder POL_SetupWindow_message "Please download the darkmod zip from www.thedarkmod.com" "$TITLE installation" POL_SetupWindow_browse "Please select the darkmod standaonline zip file to run." "$TITLE installation" # Setting prefix POL_Wine_SelectPrefix "$PREFIX" POL_Wine_PrefixCreate #"$WORKING_WINE_VERSION" mkdir -p "$WINEPREFIX/drive_c/games/thedarkmod" #Unpack the zipfile cd "$WINEPREFIX/drive_c/games/thedarkmod/" POL_System_unzip "$APP_ANSWER" #Create the shortcuts POL_Shortcut "tdm_update.exe" "The Dark Mod Updater" POL_Shortcut "tdm.exe" "The Dark Mod" POL_SetupWindow_menu "Run the updater to update the files?" "Run Updater" "Yes|No" "|" if [ "$APP_ANSWER" = "Yes" ] then RUNUPDATER="1" else RUNUPDATER="0" fi fi #Setting wine stuff Set_OS "win7" if [ "$RUNUPDATER" = "1" ] then POL_SetupWindow_message "Going to run the updater. In the updater click only on 'continue' or 'ok'. If the updater fails, close all the windows and run the updater again with the shortcut" "running updater" #Run the updater POL_SetupWindow_wait "The Dark Mod Updater in progress." "The Dark Mod Updater" POL_Wine start /unix "$WINEPREFIX/drive_c/games/thedarkmod/tdm_update.exe" POL_Wine_WaitExit "The Dark Mod Updater" fi POL_SetupWindow_Close exit 0 Edited by freyk |
||||||||||||
b1k3rdude | Monday 1 June 2015 at 21:22 | ||||||||||||
b1k3rdude![]()
|
Right tested the latest version of your script - Part 1 - http://youtu.be/_C2etVJvfHo Part 2 - http://youtu.be/xAetSPOo5Kc
|
||||||||||||
petch | Monday 1 June 2015 at 23:11 | ||||||||||||
petch![]()
|
Most remarks apply to this second script too. I'm not too sure about hijacking $INSTALLMETHOD instead of using standard POL_SetupWindow_InstallMethod either My scripts wiki: https://github.com/petchema/playonlinux/wiki GOGmix: https://www.gog.com/en/mix/playonlinux_install_scripts |
||||||||||||
freyk | Monday 8 June 2015 at 10:17 | ||||||||||||
freyk![]()
|
Thanks for the advice, I compared lots of code of other applications and games.
|
This site allows content generated by members, and we promptly remove any content that infringes copyright according to our Terms of Service. To report copyright infringement, please send a notice to dmca@playonlinux.com