Jump to content
the bigg

Porting WeiDU mods to Linux - initial thoughts

Recommended Posts

> OS X: ships with sox, .sh files saved with Mac CR

 

MacOSX uses \n like Linux.

 

 

> rm -f override a!ra01.wav

> rm -f override a!ra02.wav

> rm -f override a!ra03.wav

> rm -f override a!ra04.wav

 

Missing the / .

 

 

>It seems like the special character escape was applying in mid word in that above scripts - even though it is not in the first position, should that last be

>

> rm -f override a\!ra01.wav

>

> or could be

>

> rm -f override "a!ra01.wav"

 

Either one will work, but ! has no special meaning (at least in bash) when run in a shell script. Are you typing on a shell command line?

Share this post


Link to post

Files called from a variant of

// scripts to compress/decompress sounds
ACTION_IF (~%WEIDU_OS%~ STRING_EQUAL_CASE ~win32~) THEN BEGIN
 AT_NOW				   ~bg1npcmusic/allaudio_win.bat~
 AT_INTERACTIVE_UNINSTALL ~bg1npcmusic/allaudio_win.bat~
END ELSE BEGIN
 ACTION_IF (~%WEIDU_OS%~ STRING_EQUAL_CASE ~osx~) THEN BEGIN
AT_NOW				   ~sh bg1npcmusic/allaudio_osx.sh~
AT_INTERACTIVE_UNINSTALL ~sh bg1npcmusic/allaudio_osx.sh~
 END ELSE BEGIN
AT_NOW				   ~bash bg1npcmusic/allaudio_lin.sh~
AT_INTERACTIVE_UNINSTALL ~bash bg1npcmusic/allaudio_lin.sh~
 END
END

 

so the shell script is run from a WeiDU call:

 

bash mydirectory/myfile_lin.sh

 

For the others, revised script:

 

#!/bin/sh

 

rm -f override/a!ra01.wav

rm -f override/a!ra02.wav

rm -f override/a!ra03.wav

rm -f override/a!ra04.wav

 

i am gong back and revising my post above to see if I have it at a workacble format (And thank you very much for your patience leading me through this).

Share this post


Link to post

> (And thank you very much for your patience leading me through this).

 

No problem. I like helping people get me free stuff.

Share this post


Link to post

I know you folks have said "it is ok in a shell" several times, but I am just going to quntuple check before finalizing. The following is the most extensive in terms of added nonstandard characters - is there anything in here that would break the script when this is run on Linux, placed in myscript.sh, and run from WeiDU with the command ~bash mymod/myscript.sh~ -

 

#!/bin/sh

rm -f override/k#saram1.wav
rm -f override/k#saram2.wav
rm -f override/k#saram3.wav
rm -f override/k#sarag1.wav
rm -f override/k#sarag2.wav
rm -f override/k#sarag3.wav
rm -f override/k#sarag4.wav
rm -f override/k#sarag5.wav
rm -f override/k#sarag6.wav
rm -f override/k#sarag7.wav
rm -f override/k#sarag8.wav
rm -f override/k#sarag9.wav
rm -f override/k#saraga.wav
rm -f override/k#saragb.wav
rm -f override/k#saragc.wav
rm -f override/k#saragd.wav
rm -f override/k#sarage.wav
rm -f override/k#saragf.wav
rm -f override/k#saragg.wav
rm -f override/k#saragh.wav
rm -f override/k#saragi.wav
rm -f override/k#saragj.wav
rm -f override/k#saragk.wav
rm -f override/k#saragl.wav
rm -f override/k#saraa%.wav
rm -f override/k#saraa1.wav
rm -f override/k#saraa2.wav
rm -f override/k#saraa3.wav
rm -f override/k#saraa4.wav
rm -f override/k#saraa5.wav
rm -f override/k#saraa6.wav
rm -f override/k#saraa7.wav
rm -f override/k#saraa8.wav
rm -f override/k#saraa9.wav
rm -f override/k#saraaa.wav
rm -f override/k#saraab.wav
rm -f override/k#saraac.wav
rm -f override/k#saraad.wav
rm -f override/k#saraae.wav
rm -f override/k#saraaf.wav
rm -f override/k#saraag.wav
rm -f override/k#saraah.wav
rm -f override/k#saraai.wav
rm -f override/k#saraaj.wav
rm -f override/k#saraak.wav
rm -f override/k#saraal.wav
rm -f override/k#saraam.wav
rm -f override/k#saraan.wav
rm -f override/k#saraao.wav
rm -f override/k#saraap.wav
rm -f override/k#sara00.wav
rm -f override/k#sara01.wav
rm -f override/k#sara02.wav
rm -f override/k#sara03.wav
rm -f override/k#sara04.wav
rm -f override/k#sara05.wav
rm -f override/k#sara06.wav
rm -f override/k#sara07.wav
rm -f override/k#sara08.wav
rm -f override/k#sara09.wav
rm -f override/k#sara10.wav
rm -f override/k#sara11.wav
rm -f override/k#sara12.wav
rm -f override/k#sara13.wav
rm -f override/k#sara14.wav
rm -f override/k#sara15.wav
rm -f override/k#sara16.wav
rm -f override/k#sara17.wav
rm -f override/k#sara18.wav
rm -f override/k#sara19.wav
rm -f override/k#sara20.wav
rm -f override/k#sara21.wav
rm -f override/k#sara22.wav
rm -f override/k#sara23.wav
rm -f override/k#sara24.wav
rm -f override/k#sara25.wav
rm -f override/k#sara26.wav
rm -f override/k#sara27.wav
rm -f override/k#sara28.wav
rm -f override/k#sara29.wav
rm -f override/k#sara30.wav
rm -f override/k#sara31.wav
rm -f override/k#sara32.wav
rm -f override/k#sara33.wav
rm -f override/k#sara34.wav
rm -f override/k#sara35.wav
rm -f override/k#sara36.wav
rm -f override/k#sara37.wav
rm -f override/k#sara38.wav
rm -f override/k#sara39.wav
rm -f override/k#sara40.wav
rm -f override/k#sara41.wav
rm -f override/k#sara42.wav
rm -f override/k#sara43.wav
rm -f override/k#sara44.wav
rm -f override/k#sara45.wav
rm -f override/k#sara46.wav
rm -f override/k#sara47.wav
rm -f override/k#sara48.wav
rm -f override/k#sara49.wav
rm -f override/k#sara50.wav
rm -f override/k#sara51.wav
rm -f override/k#sara52.wav
rm -f override/k#sara53.wav
rm -f override/k#sara54.wav
rm -f override/k#sara55.wav
rm -f override/k#sara5^.wav
rm -f override/k#sara5%.wav
rm -f override/k#sara56.wav
rm -f override/k#sara57.wav
rm -f override/k#sara58.wav
rm -f override/k#sara59.wav
rm -f override/k#sara60.wav
rm -f override/k#sara61.wav
rm -f override/k#sara62.wav
rm -f override/k#sara6#.wav
rm -f override/k#sara6$.wav
rm -f override/k#sara6%.wav
rm -f override/k#sara6^.wav
rm -f override/k#sara63.wav
rm -f override/k#sara64.wav
rm -f override/k#sara65.wav
rm -f override/k#sara66.wav
rm -f override/k#sara67.wav
rm -f override/k#sara68.wav
rm -f override/k#sara69.wav
rm -f override/k#sara70.wav
rm -f override/k#sara71.wav
rm -f override/k#sara72.wav
rm -f override/k#sara73.wav
rm -f override/k#sara74.wav
rm -f override/k#sara75.wav
rm -f override/k#sara76.wav
rm -f override/k#sara77.wav
rm -f override/k#sara78.wav
rm -f override/k#sara79.wav
rm -f override/k#sara80.wav
rm -f override/k#sara81.wav
rm -f override/k#sara82.wav
rm -f override/k#sara83.wav
rm -f override/k#sara84.wav
rm -f override/k#sara85.wav
rm -f override/k#sara86.wav
rm -f override/k#sara87.wav
rm -f override/k#sara88.wav
rm -f override/k#sara89.wav
rm -f override/k#sara90.wav
rm -f override/k#sara91.wav
rm -f override/k#sara92.wav
rm -f override/k#sara93.wav
rm -f override/k#sara94.wav
rm -f override/k#sara95.wav
rm -f override/k#sara96.wav
rm -f override/k#sara97.wav
rm -f override/k#sara98.wav
rm -f override/k#sara99.wav
rm -f override/k#sara1a.wav
rm -f override/k#sara2a.wav
rm -f override/k#sara3a.wav
rm -f override/k#sara4a.wav
rm -f override/k#sara5a.wav
rm -f override/k#sara6a.wav
rm -f override/k#sara7a.wav
rm -f override/k#sara8a.wav
rm -f override/k#sara9a.wav
rm -f override/k#sara1b.wav
rm -f override/k#sara2b.wav
rm -f override/k#sara3b.wav
rm -f override/k#sara4b.wav
rm -f override/k#sara5b.wav
rm -f override/k#sara6b.wav
rm -f override/k#sara7b.wav
rm -f override/k#sara8b.wav
rm -f override/k#sara9b.wav
rm -f override/k#sara1c.wav
rm -f override/k#sara2c.wav
rm -f override/k#sara3c.wav
rm -f override/k#sara4c.wav
rm -f override/k#sara5c.wav
rm -f override/k#sara6c.wav
rm -f override/k#sara7c.wav
rm -f override/k#sara8c.wav
rm -f override/k#sara9c.wav
rm -f override/k#sara0c.wav
rm -f override/k#sara1d.wav
rm -f override/k#sara2d.wav
rm -f override/k#sara3d.wav
rm -f override/k#sara4d.wav
rm -f override/k#sara5d.wav
rm -f override/k#sara6d.wav
rm -f override/k#sara1e.wav
rm -f override/k#sara2e.wav
rm -f override/k#sara3e.wav[/size]

 

Is this one good to go?

Share this post


Link to post

Should work!

But why not simply use

#!/bin/sh
rm -f override/k#sara*.wav

or are there any k#sara files you don't want to delete?

Share this post


Link to post

rm -f override/k#sara6#.wav

rm -f override/k#sara6$.wav

rm -f override/k#sara6%.wav

rm -f override/k#sara6^.wav

 

if these puppys work, I am one happy, happy dude, and you folks have given me a darned good education, for which i am greatly appreciative!

 

@Taimon - Well, good question.

 

Technically, it should be fine to make sure that the prefix code is there, and then delete away enmasse, but then technically doesn't seem to apply to all cases...

 

based on what I have seen reading through a ton of really old mods from many different forums, some folks (especially folks predating the community prefixes now hosted at BWL) have filenames that can be picked up by accident. Some dumped the .oggs to override, then decompressed, then left both .ogg and .wav there - some even dumped the oggdec there and never deleted it - you can go on and on about it. basically, the override is a pretty wild and woolly place for folks who use older mods (especially all those mega mod folks with 200 mods Morrownid style on the BG2 engine) and not all mods clean up after themselves.

 

The cool thing about what these folks are leading me through is we can have

 

1. a single standard "tp2 block" that works on all three platforms, so a modder doesn't have to ever comment or change code, even to rename - the most they will have to do is change the directory name to match thier mod.

 

2. a single set of six audio files (two per platform), easily customized with directory and filename, so that as long as the modder follows the format they don't need to be a linuxite to make the package work on linux.

 

3. the ability to have a single master package, built in lowercase, that can be packed up in each of the three platforms from the same pack, and then the "extra" stuff deleted. Kind of a 'crossplatform' thing for mod packaging, so that only one set of code/readme/whatever can work from the same thing (yes, i know - I watch too much Discovery TV about modern weapons systems, picaninni rails, and modular design :()

 

For the install, .ogging them in place and mass moving the .wav files is ok to set up as precedent, as it is simple. But the safest thing for a mod to do is call on exactly what it needs, then delete exactly what it installed, and keep all the decompression/compression routines out of harms way.

 

OK, I am rolling on the big G3 mods with sound, starting with the spring updates for Sarah, Gavin, and BG1NPCMusic - I will ask Camdawg to recheck my work, and as always, if you run into something I have messed up, come let me know. I want to get this right. It may take a bit, but we should be in operation (in modder-time, not real-time) shortly.

Share this post


Link to post

I've got a question, and I hope it doesn't make me sound like too much of an imbecile.

 

My modder prefix is b!. So far, I've been avoiding using my prefix in sound files, using bxxx### instead, for fear of osx/linux incompatibilities, but how much of a concern is this? Should I continue on as I have done, using a parital prefix, or is the ! OK in this context?

Share this post


Link to post
My modder prefix is b!. So far, I've been avoiding using my prefix in sound files, using bxxx### instead, for fear of osx/linux incompatibilities, but how much of a concern is this? Should I continue on as I have done, using a parital prefix, or is the ! OK in this context?

When the shell is run in non-interactive mode, the '!' is no problem, because history expansion is turned off. You can generally assume that the shell is non-interactive if it is run from a script.

So it's okay to use it in a script. (But if someone fires up a terminal and wants to mess with your b!-prefixed files manually [interactively], he has to quote the exclamation mark.)

Share this post


Link to post

> rm -f override/k#sara6#.wav

> rm -f override/k#sara6$.wav

> rm -f override/k#sara6%.wav

> rm -f override/k#sara6^.wav

 

All of these worked in a shell script.

 

I downloaded the songandsilence-test.zip and it installed OK. My only problem with the scripts is that you're using wildcards inconsistently. If you use them in one platform's script, you should use them for all platforms. For example, audio-install uses wildcards for Windows and Linux, but uses a list of files for Macs. A corresponding Audio-install-osx.sh would read:

 

#!/bin/bash

for file in `cd song_and_silence/Items; echo a!ra0*.ogg`; do

song_and_silence/audio/sox song_and_silence/Items/$file override/${file%.ogg}.wav

done

 

Similarly for uninstall, to be consistent with Windows both Linux and Mac would read:

 

#/bin/sh

rm -f override/a!ra0*.wav

 

P.S.- Are you going to include WeiDU with the mod download?

Share this post


Link to post
P.S.- Are you going to include WeiDU with the mod download?

For Linux? you can copy the WeiDU executable and rename it setup-mymod so that users can already double click it, but then you'll still have to download tolower (or do other stupid stuff like having ten mods overwrite each other's tolower).

 

Actually, I can make it so that weidu-linux includes tolower and runs it every time, and mods can be shipped with the various executables and setup-mymod (a la OSX).

Share this post


Link to post

Well, the Linux packages are not shipped yet, as CawDawg has to recheck the ReadMes and such - if you want to do that, the bigg, I can set it up pretty rapidly for these to ship that way.

 

The current packages are lowercase minus WeiDU with your instructions to get the new package from WeiDU.org and install it to usr/bin.

 

Steve, I can do that for some of the mods with no problem, making the usage consistent. Certainly I will do that for Song and Silence, no problem!! There is a challenge, here, though - most mods are extracting all sounds, but not all are using filenames that can be picked up for uninstall that way. It seems safest (especially given the goal of setting up a template that will "open up" Linux distribution with audio to the regular modder, who does not have either OS X or lLinux of any flavor around) to build templates that ask for each individual file so that we don't have accidental deletions and overlaps.

 

Or do you folks think I am just being paranoid?

Edited by cmorgan

Share this post


Link to post
Guest erik
Actually, I can make it so that weidu-linux includes tolower and runs it every time, and mods can be shipped with the various executables and setup-mymod (a la OSX).

 

Nng. No auto-tolower, please. That would break SCSII installation by accident. And it would feel like a strange side-effect.

 

There are valid mixed-case filenames in davidw's perl and ssl scripts, I work around it by tolower + some rounds of symlinking, auto-tolower would break my workaround...

Share this post


Link to post

Well then, let's go with a non-exe distribution, then. I will set up the sample package and leave it for CamDawg to follow as modders request linux distributions. Unfortunately, I am out of time for several weeks, so as RL beckons, I can try to set this up so CamDawg can follow up.

Share this post


Link to post
My only problem with the scripts is that you're using wildcards inconsistently. If you use them in one platform's script, you should use them for all platforms.

 

Audio-install-osx.sh would read:

 

#!/bin/bash

for file in `cd song_and_silence/Items; echo a!ra0*.ogg`; do

song_and_silence/audio/sox song_and_silence/Items/$file override/${file%.ogg}.wav

done

 

Similarly for uninstall,

#/bin/sh

rm -f override/a!ra0*.wav

 

P.S.- Are you going to include WeiDU with the mod download?

 

OK, finalizing Song and Silence to use these commands for the OS X distribution! G3 lin-mymod-v#.zip packages are beig distributed as tolower-ed with no .exe and instructions in the readme-mymod.html to follow the (given) links and download the newest WeiDU to /usr/bin/ and proceed from there.

 

to confirm, final audio format that works across all three OS without any problems:

 

// scripts to compress/decompress sounds
ACTION_IF (~%WEIDU_OS%~ STRING_EQUAL_CASE ~win32~) THEN BEGIN
 AT_NOW                   ~song_and_silence/audio/audio-install.bat~
 AT_INTERACTIVE_UNINSTALL ~song_and_silence/audio/audio-uninstall.bat~
END ELSE BEGIN
 ACTION_IF (~%WEIDU_OS%~ STRING_EQUAL_CASE ~osx~) THEN BEGIN
   AT_NOW                   ~sh song_and_silence/audio/audio-install-osx.sh~
   AT_INTERACTIVE_UNINSTALL ~sh song_and_silence/audio/audio-uninstall-osx.sh~
 END ELSE BEGIN
   AT_NOW                   ~bash song_and_silence/audio/audio-install-lin.sh~
   AT_INTERACTIVE_UNINSTALL ~bash song_and_silence/audio/audio-uninstall-lin.sh~
 END
END

 

with files created for each platform and both sox and oggdec placed with the distributable.

 

Amber remains the flagship distro, though, as the bigg has managed to incorporate compression of the files in override and all sorts of fancy stuff - folks who know what they are doing can follow his template and create the three distributions with tisunpack, snd2acm, etc. I am only using this format for mods that didn't have existing Linux distributions.

 

 

Steve, or anyone - just a quick check - if the call is

 

AT_NOW ~sh song_and_silence/audio/audio-install-osx.sh~

 

and the file has #!/bin/bash

#!/bin/bash
for file in `cd song_and_silence/Items; echo a!ra0*.ogg`; do
song_and_silence/audio/sox song_and_silence/items/$file override/${file%.ogg}.wav
done

 

does this work? I am assuming that the OS/WeiDU sees "shell file - run this with whatever is on the first line" so this is ok.

Share this post


Link to post
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...