Open smichel17 opened 4 years ago
there is currently only one way I'm comfortable embedding scripts
The way being block scalars (>
or |
), and the problem being that they're converted to double-quoted flow scalars with \n
for newlines, which results in scripts like this (truncated):
- write_file:
content: "#!/usr/bin/env sh\n\n# If abi.vsyscall32=0 is already set, no need to\
\ do anything\nif [ \"$(cat /proc/sys/abi/vsyscall32)\" -eq 0 ]; then\n exit\
\ 0\nfi\n\ndialog() {\n zenity \"$@\" --icon-name='lutris' --width=\"400\"\
\ --title=\"League of Legends anticheat compatibility check\"\n}\n\nfinal_check()\
\ {\n if [ \"$(cat /proc/sys/abi/vsyscall32)\" -ne 0 ]; then\n dialog\
\ --warning --text=\"As far as this script can detect, your system is not configured\
\ to work with League's anticheat. Please verify that you can get into the practice\
\ too before playing a multiplayer game.\"\n fi\n}\n\ntrap final_check EXIT\n\
\nif grep -E -x -q \"abi.vsyscall32( )?=( )?0\" /etc/sysctl.conf; then\n \
\ if dialog --question --text=\"It looks like you already configured your system\
\ to work with League anticheat, and saved the setting to persist across reboots.\
\ However, for some reason the persistence part did not work.\\n\\nFor now,\
\ would you like to enable the setting again until the next reboot?\"\n then\n\
\ pkexec sh -c 'sysctl -w abi.vsyscall32=0'\n fi\n exit 0\nfi\n\
Maybe instead of:
- write_file:
content: '#!/bin/sh
fullscreen() {
cd "$gamedir/game"
./NecroDancer.sh 1
}'
file: $GAMEDIR/run.sh
One should terminate the lines with commands after them with a semicolon, so they parse correctly? :thinking: Note the semicolon at the cd line, it's unneeded but harmless to add semicolons after every command-line... (See man your shell)
- write_file:
content: '#!/bin/sh
fullscreen() {
cd "$gamedir/game";
./NecroDancer.sh 1
}'
file: $GAMEDIR/run.sh
This would/should become:
- write_file:
content: '#!/bin/sh
fullscreen() { cd "$gamedir/game"; ./NecroDancer.sh 1 }'
file: $GAMEDIR/run.sh
:vulcan_salute:
Yaml multiline strings appear to incorrectly drop line breaks in some places. This is important because it limits the ability to embed scripts in a readable manner (there is currently only one way I'm comfortable embedding scripts, and it makes them completely unreadable in the installer). Minimum example:
Add to installer:
Expected: Stays the same upon save Actual: Becomes
Current workaround: Add an extra line break in problematic places (double spaced), like so: