Script: how to modify or write a dosbox config file? [resolved]

this is one of the dosbox config file “Alone in the dark” GOG version:


# Lines in this section will be run at startup.
@echo off
mount C ".."
mount C "..\cloud_saves" -t overlay
imgmount D "..\GAME.INS" -t iso
goto launcher

ECHO º --------------------------------------- º
ECHO º Alone in the Dark Launcher              º
ECHO º --------------------------------------- º
ECHO º  1) Alone in the Dark                   º
ECHO º  2) Jack in the Dark                    º
ECHO º  3) AitD DOS Settings (inc. Language)   º
ECHO º  4) JitD DOS Settings (inc. Language)   º
ECHO º --------------------------------------- º
ECHO º  5) exit program                        º
ECHO º --------------------------------------- º

choice /c12345 /s Which program do you want to run? [1-5]: /n 
if errorlevel 5 goto exit
if errorlevel 4 goto jsetup
if errorlevel 3 goto asetup
if errorlevel 2 goto jack
if errorlevel 1 goto alone

goto exit

indark2 16 1
cleardrv >NUL
goto exit

cd ".."
goto launcher

cd ".."
goto launcher


Could you tell me how to erase this line:
mount C “…\cloud_saves” -t overlay
and modify this one:
imgmount D “…\GAME.INS” -t iso
imgmount D “…/GAME.INS” -t iso
because Linux dosbox does not find “…\GAME.INS”

Thank you for your help.

No one know how to do this?

If I was to respond specifically to the question you stated, my answer would be “using a text editor”. And since the answer is blatantly obvious, I can only guess you actually meant to ask something else.
Is the problem in finding the file? I don’t think I have a DOS game installed ATM, but my best guess is it would be a file named dosbox.conf and located somewhere in the game folder (most likely at the root).

more details to understand my question: I try to write Lutris scripts to install easily Dos games from Gog, But I need to know how to modify Dosbox config file with Lutris script language.

You can use the - write_config: task to edit config files.

I’ve done it by essentially re-writing the file using - write_file:

It’s kind of a pain in the ass to do, and you lose the fancy blue background from the ECHO e[1;33me[42mÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» part of the file. I think it has to do with the way the characters are encoded when the files are generated by the script. Maybe there’s a way to get it to still work, but I don’t know enough about how to do it.

Here’s an example of one I did for Quest for Glory:

Theoretically you could try running sed (- execute: command:) to replace text in the DOSBox config file.

Thank you for your answers.

" You can use the - write_config: task to edit config files."
If I understood correctly, I already used “write_config” in others Lutris scripts and with this function you can only write :
But you can not write “imgmount D “…/GAME.INS” -t iso” with this function, aren’t you?

I tested “write_file” function too, but like Ugly said, It’s kind of a pain in the ass to do and the content is regularly not accepted (YAML errors), I think there are too much special characters in this config file for the Lutris web script validator.

I tried running this sed command:
sed -i ‘s+/GAME.INS+\GAME.INS+g’ dosboxAlone1_single.conf
it works in a terminal but not accepted by Lutris web script validator.

this Lutris script line:

- execute:
    command: sed -i 's+/GAME.INS+\GAME.INS+g' $GAMEDIR/GOG Games/Alone in the Dark/config/dosboxAlone1_single.conf

is not accepted by the Lutris script web validator, do you know why?

Are you using the Windows installers?. I know most of GOG’s Dosbox games comes with a linux install these days.

And if you use the windows installed dosbox.cfg you need to edit it to make it compattible with Linux. Almost every path in [autoexec] needs to be linuxfied.

You still can use GOG’s menus if you want (and you could even use them as templates to launch other games that way)

  • You may need to put quotes around the whole string.
  • You can try adding working_dir to execute parameters.
  • …Come to think about it, this is not the command you ran from terminal. Did you know that whitespace is used to separate command line arguments? That is to say, if argument includes spaces, you need to put quotes around it (or at least around places with whitespaces… placing single quotes around $GAMEDIR will probably prevent it from being interpolated). Alternatively, whitespaces may be escaped like this: GOG\ Games

Finally works with this command line:

- execute:
    command: sed -i 's+..\GAME.INS+./GAME.INS+g' "$GAMEDIR/GOG Games/Alone in the

Thank you all for your help and inspiration.