Create install script with multiple tasks?

Apologies if this is really simple but I’m trying to make an install script. I want to do the following:

files:
- officialpatch: http://foo/bar/officialpatch.exe
- communitypatch: http://foo/bar/communitypatch.exe
- nocd: http://foo/bar/nocd.exe

- insert-disc:
    requires: SETUP.EXE

- task:
	name: wineexec
	prefix: $GAMEDIR
	executable: officialpatch

- task:
	name: wineexec
	prefix: $GAMEDIR
	executable: communitypatch

- move:
	description: Copying no-cd
	dst: $GAMEDIR/drive_c/Games/gamename/original.exe
	src: nocd

is it possible to have two tasks like this? If YAML is like JSON then the second task will override the first.

You can have more than 1 task, if that’s what you’re asking.

Yes, thanks. Is that syntax correct? Both entries starting with task:?

Yes, I think it is. Just take a look at almost any wine installer and you’ll be able to see how things work in practice.

Yes but you want to fix your spacing and add the tasks under the installer section.

files:
- officialpatch: http://foo/bar/officialpatch.exe
- communitypatch: http://foo/bar/communitypatch.exe
- nocd: http://foo/bar/nocd.exe
game:
  exe: drive_c/path/to/game.exe
  prefix: $GAMEDIR
installer:
- insert-disc:
    requires: SETUP.EXE
- task:
    name: wineexec
    prefix: $GAMEDIR
    executable: officialpatch
- task:
    name: wineexec
    prefix: $GAMEDIR
    executable: communitypatch
- move:
    description: Copying no-cd
    dst: $GAMEDIR/drive_c/Games/gamename/original.exe
    src: nocd

Thanks. I’ve uploaded an installer here: https://lutris.net/games/freelancer/ (currently unpublished).

Can anyone tell me why it’s not working?

I’m not sure I understand why lutris -i file.yaml requires a different format than is uploaded to the website as this makes it difficult to test what actually happens when the installer is live.

Here’s my original script, working fine using lutris -i:

runner: wine
version: 1.0
slug: Freelancer
game_slug: Freelancer
name: Freelancer

script:
  files:
  - officialpatch: https://r.je/freelancer/flpatch.exe
  - jflp: https://r.je/freelancer/jflp.exe
  - nocd: https://r.je/freelancer/Freelancer.exe
  - perfoptions: https://r.je/freelancer/PerfOptions.ini
  - hidpifontsfix: https://r.je/freelancer/hidpi_fonts.ini
  game:
    arch: win32
    exe: $GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/EXE/Freelancer.exe
    prefix: $GAMEDIR
    prefix: $GAMEDIR

  system:
    env:
      __GL_FSAA_MODE: '10'

  wine:
    # Backbuffer is required for antialiasing
    OffscreenRenderingMode: backbuffer

  installer:
  - task:
      arch: win32
      description: Creating Wine prefix
      name: create_prefix
      prefix: $GAMEDIR
  - insert-disc:
      requires: setup.exe
  - task:
      description: Installing Freelancer. Please choose "Express install".
      executable: $DISC/setup.exe
      name: wineexec
      prefix: $GAMEDIR
  - task:
      description: Installing 1.1 patch...
      executable: officialpatch
      name: wineexec
      prefix: $GAMEDIR
  - move:
      description: Installing no-cd
      src: nocd
      dst: $GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/EXE/Freelancer.exe
  - task:
      description: Installing Jason's Freelancer Patch for widescreen support...
      executable: jflp
      name: wineexec
      prefix: $GAMEDIR
  - execute:
      description: Creating configuration directory
      command: mkdir -p '$GAMEDIR/drive_c/users/$USER/My Documents/My Games/Freelancer/'
  - move:
      description: Creating confiugration file
      src: perfoptions
      dst: $GAMEDIR/drive_c/users/$USER/My Documents/My Games/Freelancer/PerfOptions.ini
  #
  # The in-game resolution selector does not list widescreen resolutions
  # Save the user a step and write the configuration file to have their
  # native resolution set by default
  #
  # 1. Create the config directory
  # 2. Write PerfOptions.ini
  # 3. Read resolution from xrandr to the file
  # 4. Write to the config file
  # 5. If screen height > 1500 pixels, freelancer does not calculate font sizes correctly
  #    and some text is missing entirely. Update fonts.ini to work with HiDPI resolution
  #

  # Does lutris provide an existing variable for screen resolutions? 
  - execute:
      description: Setting game resolution your screen's native resolution
      command: |
                RESX=`xrandr | grep primary | grep -oP "primary \K[^x]+"`
                RESY=`xrandr | grep primary | grep -oP "primary.+x\K[0-9]+"`
                echo "Setting in game resolution to $RESX x $RESY..."

                sed "s/size\s*=.*/size=$RESX, $RESY/" "$GAMEDIR/drive_c/users/$USER/My Documents/My Games/Freelancer/PerfOptions.ini" -i
                sed "s/color_bpp\s*=.*/color_bpp=32/" "$GAMEDIR/drive_c/users/$USER/My Documents/My Games/Freelancer/PerfOptions.ini" -i
                sed "s/depth_bpp\s*=.*/depth_bpp=32/" "$GAMEDIR/drive_c/users/$USER/My Documents/My Games/Freelancer/PerfOptions.ini" -i
                echo "...done"

                if [ $RESY -gt 1500 ]
                then
                  echo "Your resolution's height is larger than 1500 pixels, this causes Freelancer to render fonts incorrectly on both windows and linux"
                  echo "Applying font patch..."
                  cp $CACHE/hidpi_fonts.ini "$GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/DATA/FONTS/fonts.ini"
                  echo "...done"
                fi
                echo "Complete!"

  - input_menu:
      description: "Increase draw distances?"
      id: DRAWDISTANCE
      options:
      - y: "Yes"
      - n: "No"
      preselect: "y"

  - execute:
      description: Draw distance patch
      command: |
                if [ $INPUT = 'n' ]
                then
                  echo "...skipping"
                fi
                if [ $INPUT = 'y' ]
                then
                  echo "Increasing game draw distance..."
                  sed "s/LODranges.*/LODranges = 0, 1000, 99999/" "$GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/DATA/SHIPS/shiparch.ini" -i
                  sed "s/LODranges.*/LODranges = 0, 1000, 99999/" "$GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/DATA/SHIPS/rtc_shiparch.ini" -i
                  sed "s/LODranges.*/LODranges = 0, 99999/" "$GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/DATA/SOLAR/solararch.ini" -i
                  sed "s/LODranges.*/LODranges = 0, 1000, 99999/" "$GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/DATA/EQUIPMENT/select_equip.ini" -i
                  sed "s/LODranges.*/LODranges = 0, 1000, 99999/" "$GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/DATA/EQUIPMENT/weapon_equip.ini" -i

                  echo "...done"
                fi
                echo "Complete!"

  # Disable CSMT it causes much worse performance in this game (At least in Wine 3.21 and earlier)
  # Is there a lutris config option for this? There's nothing here: https://github.com/lutris/lutris/blob/master/docs/installers.rst
  - task:
      name: set_regedit
      prefix: $GAMEDIR
      path: HKEY_CURRENT_USER\Software\Wine\Direct3D
      key: csmt
      value: '00000000'
      type: REG_DWORD

To upload it, I had to remove the top section and change it to:


files:
- officialpatch: https://r.je/freelancer/flpatch.exe
- jflp: https://r.je/freelancer/jflp.exe
- nocd: https://r.je/freelancer/Freelancer.exe
- perfoptions: https://r.je/freelancer/PerfOptions.ini
- hidpifontsfix: https://r.je/freelancer/hidpi_fonts.ini
game:
  arch: win32
  exe: $GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/EXE/Freelancer.exe
  prefix: $GAMEDIR
  prefix: $GAMEDIR

system:
  env:
    __GL_FSAA_MODE: '10'

wine:
  # Backbuffer is required for antialiasing
  OffscreenRenderingMode: backbuffer

installer:
- task:
    arch: win32
    description: Creating Wine prefix
    name: create_prefix
    prefix: $GAMEDIR
- insert-disc:
    requires: setup.exe
- task:
    description: Installing Freelancer. Please choose "Express install".
    executable: $DISC/setup.exe
    name: wineexec
    prefix: $GAMEDIR
- task:
    description: Installing 1.1 patch...
    executable: officialpatch
    name: wineexec
    prefix: $GAMEDIR
- move:
    description: Installing no-cd
    src: nocd
    dst: $GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/EXE/Freelancer.exe
- task:
    description: Installing Jason's Freelancer Patch for widescreen support...
    executable: jflp
    name: wineexec
    prefix: $GAMEDIR
- execute:
    description: Creating configuration directory
    command: mkdir -p '$GAMEDIR/drive_c/users/$USER/My Documents/My Games/Freelancer/'
- move:
    description: Creating confiugration file
    src: perfoptions
    dst: $GAMEDIR/drive_c/users/$USER/My Documents/My Games/Freelancer/PerfOptions.ini
#
# The in-game resolution selector does not list widescreen resolutions
# Save the user a step and write the configuration file to have their
# native resolution set by default
#
# 1. Create the config directory
# 2. Write PerfOptions.ini
# 3. Read resolution from xrandr to the file
# 4. Write to the config file
# 5. If screen height > 1500 pixels, freelancer does not calculate font sizes correctly
#    and some text is missing entirely. Update fonts.ini to work with HiDPI resolution
#

# Does lutris provide an existing variable for screen resolutions? 
- execute:
    description: Setting game resolution your screen's native resolution
    command: |
              RESX=`xrandr | grep primary | grep -oP "primary \K[^x]+"`
              RESY=`xrandr | grep primary | grep -oP "primary.+x\K[0-9]+"`
              echo "Setting in game resolution to $RESX x $RESY..."

              sed "s/size\s*=.*/size=$RESX, $RESY/" "$GAMEDIR/drive_c/users/$USER/My Documents/My Games/Freelancer/PerfOptions.ini" -i
              sed "s/color_bpp\s*=.*/color_bpp=32/" "$GAMEDIR/drive_c/users/$USER/My Documents/My Games/Freelancer/PerfOptions.ini" -i
              sed "s/depth_bpp\s*=.*/depth_bpp=32/" "$GAMEDIR/drive_c/users/$USER/My Documents/My Games/Freelancer/PerfOptions.ini" -i
              echo "...done"

              if [ $RESY -gt 1500 ]
              then
                echo "Your resolution's height is larger than 1500 pixels, this causes Freelancer to render fonts incorrectly on both windows and linux"
                echo "Applying font patch..."
                cp $CACHE/hidpi_fonts.ini "$GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/DATA/FONTS/fonts.ini"
                echo "...done"
              fi
              echo "Complete!"

- input_menu:
    description: "Increase draw distances?"
    id: DRAWDISTANCE
    options:
    - y: "Yes"
    - n: "No"
    preselect: "y"

- execute:
    description: Draw distance patch
    command: |
              if [ $INPUT = 'n' ]
              then
                echo "...skipping"
              fi
              if [ $INPUT = 'y' ]
              then
                echo "Increasing game draw distance..."
                sed "s/LODranges.*/LODranges = 0, 1000, 99999/" "$GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/DATA/SHIPS/shiparch.ini" -i
                sed "s/LODranges.*/LODranges = 0, 1000, 99999/" "$GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/DATA/SHIPS/rtc_shiparch.ini" -i
                sed "s/LODranges.*/LODranges = 0, 99999/" "$GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/DATA/SOLAR/solararch.ini" -i
                sed "s/LODranges.*/LODranges = 0, 1000, 99999/" "$GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/DATA/EQUIPMENT/select_equip.ini" -i
                sed "s/LODranges.*/LODranges = 0, 1000, 99999/" "$GAMEDIR/drive_c/Program Files/Microsoft Games/Freelancer/DATA/EQUIPMENT/weapon_equip.ini" -i

                echo "...done"
              fi
              echo "Complete!"

# Disable CSMT it causes much worse performance in this game (At least in Wine 3.21 and earlier)
# Is there a lutris config option for this? There's nothing here: https://github.com/lutris/lutris/blob/master/docs/installers.rst
- task:
    name: set_regedit
    prefix: $GAMEDIR
    path: HKEY_CURRENT_USER\Software\Wine\Direct3D
    key: csmt
    value: '00000000'
    type: REG_DWORD


But clicking “install” on the website does not trigger any of the installer steps. It works offline, why doesn’t the uploaded script work correctly?

edit: never mind, it looks like once it was moderated it worked fine. Not sure if the the moderator fixed it or it just had to be live.