Du är här > Les forums > Your creations. > Rules to write script
| Nytt ämne - Svara |
| Författare | Svar |
| Quentin PÂRIS | Söndag 28 Februari 2010 at 12:12 - [Citat] |
Admin![]() ![]() |
Hi everybody,
This post is not a compulsory list to follow, but some suggestions to make your scripts better. I recommend you to follow these tips whenever possible. 1 - PlayOnLinux detectionInstead of:if [ "$PLAYONLINUX" = "" ]then exit 0 fi You can use [ "$PLAYONLINUX" = "" ] && exit 0 It's a bit clearer. Use the following heading to recognize your script#!/bin/bash # Date: (2009-06-25 11-00) # Last revision: (2009-10-17 20-00) # Wine version used: # Distribution used to test: # Author: # Licence: # Depend: You can add all comments you like, if you think it could help the scriptors understand your script. Post some screenshots on the forumIt will convince the scriptor that your script works."Freeze" your scriptIf your script works well, you can "freeze" it. That is to say, minimize the risk of change in the future by external factors. For instance, you can:- Set a specific Wine version - Set a version for your program - Avoid using winetricks WinetricksIf you can avoid using winetricks, all the better.Here is a list of functions. If one of these works for your script, use it instead of winetricks. You can use both winetricks and these functions if you need to. If a function doesn't work for you, or doesn't have the same behavior as winetricks, please report it to the scriptor. You can't use these functions in a single line. For example, if you want to install msxml3 and riched20, use: POL_Call POL_Install_msxml3 POL_Call POL_Install_riched20 Use a silent install if possibleIf the user does not see a Wine window during the installation process, it's cleaner.There are several possibilities to make a silent install, depending on the installation file. Examples: wine setup.exe /s wine setup.exe /q wine setup.exe /silent # Works for innosetup files, but shows the progress bar wine setup.exe /quiet wine setup.exe /verysilent # The best for innosetup files If these lines don't work, try capital letters. For zip self-extracting files, you can try unzip your_file.exe You can also try, but it doesn't seem to respect directories (could be good for some libraries): cabextract your_file.exe For a .msi file: wine msiexec /i setup.msi /q Recopy the licence fileIf you use a silent install, the licence file is no longer visible. The developer of the software would appreciate to see the licence. Example:POL_SetupWindow_licence "Please read this carefully" "Licence" "$REPERTOIRE/tmp/ie_license.txt" When you need to make a filePlease don't use the following code:echo "Line 1" > your_file.txt echo "Line 2" >> your_file.txt echo "Line 3" >> your_file.txt Use: cat << _EOF_ > your_file.txt Line 1 Line 2 Line 3 _EOF_ If you need to make several files, change _EOF_ string for the second. About multiple versionsTwo possibilities:1 - Your program has a lot of different minor versions (case of Notepad++) In that case, we will not make a script for each version, it would be nonsensical. Few possibilities: - Ask the user what version they want to download and install. - Try to detect automatically the latest version (it's the best solution if it works well, but be careful, if you get the name of the latest version from the official website of the program, don't forget that the website can change in the future, and it could cause bugs). - Make a variable that contains the name of the latest version. This way it will be very easy to change it in the future (a good solution, that avoids a lot of bugs, in my opinion). - If you think a version works or will work better than the others, you can keep it (cf. "Freeze your script" section). 2 - Your software has different branches of development, for different major versions That is the case of Windows Media Player, Internet Explorer, Firefox, etc. - Please make a different script for each version. Do not put all the versions in a single script. The user will be able to find easily the right version by using the search bar. About the patches and the extensionsI strongly recommend you to make a different script for the patch, to avoid the same problem: we want your script to be findable in the search bar. In the future version of PlayOnLinux, maybe we could separate them from the other games.TranslationPlease write your script in English first, additional translations are very appreciated.Testing your scriptDon't hesitate to use "Magic Numbers". Before sending your script to validation, you can type in PlayOnLinux's search bar: get:magic_number to run your script.For example, get:269 will let you test the Inno Setup script, even if it's not validated. About the voteDon't give five stars to your script right after validation, it's not very fair-play.About v2 functionsDo not use them (message, question, attendre, creer_prefixe, etc...).About free softwareExamples of Windows Live Messenger 2008, iTunes 7 scriptsYou can mention that free software is available, and mention its name. You can inform the user that the application might not work as it works on Windows, and it could be a better solution to install a free program. About No-CD patchesSome games need a No-CD patch to work with Wine. In some countries, it's not illegal to crack protection if it is obligatory to run the software on a different operating system.In that case, please tell the user that they need to patch the game at their own risk, and that PlayOnLinux will not do it for them, nor take any responsibility for it. About Program Files variablePlease use the following code:PROGRAMFILES="Program Files" POL_LoadVar_PROGRAMFILES Thank your for reading this, if I have something else to add, I will reply to this post. Ändrat av Salvatos |
| lil_stenly | Söndag 28 Februari 2010 at 13:40 - [Citat] |
Membre![]() ![]() |
Silent installation for MSI:
wine msiexec /i setup.msi /q |
| Quentin PÂRIS | Söndag 28 Februari 2010 at 14:47 - [Citat] |
Admin![]() ![]() |
Thank's
|
| Dr Phil | Söndag 28 Februari 2010 at 21:26 - [Citat] |
Membre![]() ![]() |
Great Tinou! =)
I think scripts will be much cleaner in the future. =) BTW: The link in the winetricks-section is wrong. http://www.playonlinux.com/repository/admin.php?cat=100 should be changed to: http://www.playonlinux.com/repository/?cat=100 |
| Berillions | Måndag 1 Mars 2010 at 19:36 - [Citat] |
Membre![]() ![]() |
Also, if you need more than 1 CD or DVD to install your game and Wine doesn't want to eject your CD/DVD when the installation asks for the 2nd/3rd... CD/DVD, you can use this function to solve the problem:
Instead of: wine "$CDROM/setup.exe" Use this: wine start /unix "$CDROM/setup.exe" Tested with Mass Effect and Mass Effect 2. Enjoy Ändrat av Salvatos |
148 användare online






