fr

Create a script for PlayOnLinux - Chapter 1: Getting to know Bash

Introduction

You would like to create your own scripts for PlayOnMac but you don't know squat about programming? This tutorial will explain the basics and you'll soon be a pro in playonlinuxian Bash.

Bash?

Bash is a command interpretor (or "shell") in GNU/Linux and Mac OS X. It's the one appearing when you launch a terminal. It also allows you to make scripts. A script is a list of commands that your shell will execute one after the other.

PlayOnMac has advanced functions in Bash to make the scripting process easier. Let's get acquainted with them.

Requirements of every script

Every PlayOnMac script must contain this boilerplate code:

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

POL_SetupWindow_Init

POL_SetupWindow_Close
exit

Above code may not make sense to you yet. We will explain what it does as we go.

During this tutorial, I will not repeat this code over and over in the examples, as it is necessary. Remember to include it otherwise your script won't work.

Executing your script

Ask your favorite text editor to save your script, then use the function Run a local script from the Tools menu of PlayOnMac.

Scripts signing

PlayOnMac uses digital signing (authentication) on scripts to certify that scripts have been validated by PlayOnMac scripters. All the scripts available from the Install window of PlayOnMac are validated.

Each time you will try to run a script that has not been validated by PlayOnMac scripters, you will get a warning message telling you that the script has no valid signature (see screenshot below).

You must click on Next button to get PlayOnMac to show you the script source, then click on the I Agree checkbox, before you can (finally) run the script (see screeshot below).

Next chapter

Il n'y a rien à voir ici