[Linux] Ini-tweak migration script

Post about your mods, learn about OpenMW mod compatibility, check for problematic mods, discuss issues, and give us feedback about your experience with modded OpenMW.
Post Reply
mupf
Posts: 3
Joined: 20 Sep 2017, 17:53

[Linux] Ini-tweak migration script

Post by mupf »

Hello,
I just wrote a little tool for myself. A script to add mod-specific ini-tweaks to the openmw.cfg.
Currently supported mods:

TLM - The Lighting Mod
Monochrome user interface

Is anyone in here interested in an extensive version of this script? If yes: which mods also require ini-tweaks?
Happy testing! :)
Attachments
openmw-initweakconv.tgz
(2.53 KiB) Downloaded 155 times
User avatar
Ambrevar
Posts: 4
Joined: 21 Oct 2017, 15:39
Contact:

Re: [Linux] Ini-tweak migration script

Post by Ambrevar »

Thanks for this!

Some shell tips:

- Make it a "sh" script as this is POSIX, no need to depend on bash.

- Don't chain "echo"s, use a here-doc:

Code: Select all

cat<<EOF
Usage $0
...
EOF
- Exit early:

Code: Select all

if [ ! -e openmw.cfg ]
then
	## Redirect error messages to stderr.
	echo >&2 "openmw.cfg not found."
	## Change the exit code.
	exit 1
fi

## Your un-indented sed command here.
- "sed" runs scripts, it is not limited to a single 's' command.

Code: Select all

sed -i '
s/foo/bar/
s/qux/quux/
' openmw.cfg
This will be much faster as it will fire up one process only.

Note that the inplace option (-i) is not standard, you should use the "ex" command instead.

- Always double-quote variables and use a single "=" for comparison:

Code: Select all

elif  [ "$1" = "-tlm_undo" ]
Hope that helps :)
Post Reply