More and more people are contributing scripts, and we're really thankful for your help!
During validation, we keep seeing some issues that creep up and annoy us a little. To ease the validation process, I decided to write this post to explain what you should avoid in your scripts.
Some of these rules are necessary for the script to function properly and are therefore mandatory. Others are recommendations. If I don't mention it, your script won't be turned down at validation even if that rule isn't followed.
Some scripts that are already validated don't obey these rules. They are being revised, but this takes some time, so we can't fix it all at once.
1 - Do not use sudo! (Mandatory)
For obvious safety concerns, you must not use the commands sudo, gksudo, kdesu, ...
If you really
need sudo in your script, you'll have to ask the user to type it in. To do so, you can use the following code:
POL_Call POL_Function_RootCommand "Command root ; exit"
2 - Use the $TITLE variable (recommended)
Choose a different title for every window. This will confuse the user.
POL_SetupWindow_message "Your message" "Random title"
The $TITLE variable is defined automatically, and it contains your script's name.
POL_SetupWindow_message "Your message" "$TITLE"
3 - Shorten headers (recommended)
Almost no one uses this anymore, but as a reminder,
if [ "$PLAYONLINUX" = "" ]then
[ "$PLAYONLINUX" = "" ] && exit 0
4 - Argument order (Mandatory)
For your script to be Mac/BSD compatible, you need to follow argument order in certain commands.
rm directory -rf
mkdir directory -p
cp directory -r
rm -rf directory
mkdir -p directory
cp -r directory
5 - Do not use wget to downlaod an external script (Mandatory)
wget http://winezeug.googlecode.com/svn/trunk/winetricks --output-document=winetricks
bash winetricks -q some_packages
6 - Do not use echo multiple times to write into a file (Mandatory)
echo "line 1" > my_file
echo "line 2" >> my file
cat << EOF > my_file
7 - Script header (recommended)
# Date : (2009-05-30 17-30)
# Last revision : (2009-05-30 17-30)
# Wine version used :
# Distribution used to test :
# Author : Your name
# Script licence :
# Program licence :
# Depend :
8 - Use exit at the end of your script (Mandatory)
The GPG signature is inserted at the end of your script. If you don't add exit, your script cannot be signed without bash trying to interpret the signature.
9 - Regarding Wine versions
You can bind your program to a Wine version it works well with if it is complex enough (all games apply). However, we advise against using this method for small applications like mp3tag.
10 - Do not download images from Wikipedia and resize them with convert (Mandatory)
wget http://www.google.com/images/logos/sketchup_logo.png --output-document="$REPERTOIRE/tmp/leftnotrotated.png"
convert "$REPERTOIRE/tmp/leftnotrotated.png" -rotate 270 "$REPERTOIRE/tmp/leftnotscaled.png"
convert "$REPERTOIRE/tmp/leftnotscaled.png" -scale 150x356\\! "$REPERTOIRE/tmp/left.png"
POL_SetupWindow_Init "" "$REPERTOIRE/tmp/left.png"
11 - Watch out for what you do after cd! (Mandatory)
# If cd fails, you don't know what will be deleted.
- Generally speaking, avoid using rm, but otherwise:
12 - PlayOnLinux v2 functions are forbidden (Mandatory)
13 - Use $REPERTOIRE (Mandatory)
14 - Use POL_SetupWindow_wait_next_signal before large commands (unzip, tar, wine, ...)
- Otherwise, the GUI freezes and the user may think it's a bug.
15 - Do not use cfg_check, it is useless
16 - Warn the user if the game requires a CD/DVD protection bypass, without encouraging them to do it! (that's a tricky one) (strongly recommended)
- Advocating piracy is forbidden
17 - Do not include the patch in the script, unless it is required for it to work (recommended, even mandatory in some cases)
- Create a separate script
18 - Do not install libraries directly in a script, use POL_Call (same as 17)
From here on, those are suggestions you can follow if you feel like it
19 - Use POL_Debug functions
- There is no documentation for now, so you can look at how the League of Legends script (Testing category) works for now if you really want to.
20 - Avoid weird stuff if you can...
- If we're having trouble following what's going on in your script, it will be rejected. You should therefore avoid awk and sed lines that go on forever (and could fail on a different system such as Mac).
21 - Use POL_SetupWindow_auto_shortcut, instead of POL_SetupWindow_make_shortcut
22 - No need to use POL_LoadVar_PROGRAMFILES
23 - Comment your script
24 - Enter a description, and send in the icons, miniatures...
- The Description box allows you to enter a description of the software (not of the script itself). BBCode is allowed
- The install icon is 22x22
- The game icon is 32x32 or more
- The miniature is 200x150
25 - Provide the script at least in English and/or French
- It's always best to get an English version for the international crowds
26 - Regarding signatures
- Even if you don't want your script to be available to all PlayOnLinux users, you can ask us for a signature so that PlayOnLinux doesn't complain when you launch it. (If you want to deploy a custom program on a large number of computers.)
27 - Generally speaking, small programs work on Mac. So if your script is built well, you can tick the PlayOnMac box
- Be careful with games.
28 - Avoid detecting the application's latest version...
... unless there is a file specifically made for this on the official site.
See note 20.
Translated for Tinou
Aangepast door Salvatos
Disclaimer: I'm a noob, not a dev; my advice is only a guess.
Attention : Je suis aussi noob que vous, prenez mes suggestions avec un grain de sel ;)