autopkg / orbsmiv-recipes

My autopkg recipes, primarily for audio-related software applications
3 stars 8 forks source link

Rewire postinstall for Reaper? #2

Open timsutton opened 7 years ago

timsutton commented 7 years ago

I've just began quickly testing the postinstall configuration steps for Reaper to avoid at least the admin prompt popup, and am testing out a script like this:

declare -r rewire_dir='/Library/Application Support/Propellerhead Software/ReWire'
if [ ! -d "${rewire_dir}" ]; then
    /bin/mkdir -p "${rewire_dir}"
fi

# copy ReWire, symlink ReWireDev
# TODO: how do we handle the situation where another audio app may have already
# copied this stuff in, and probably a slightly different version?
/bin/cp -R '/Applications/REAPER64.app/Contents/Plugins/ReWire.bundle' "${rewire_dir}"
/bin/ln -s '/Applications/REAPER64.app/Contents/Plugins/REAPERReWireDev.bundle' "${rewire_dir}"

Curious if you have any thoughts on what I mention in the TODO above? I think currently the only other app I support which explicitly installs ReWire support (besides Reason itself, which we're phasing out) is Ableton Live 9. Have you ever dealt with installing Reaper on systems which may already have the ReWire bundle installed?

orbsmiv commented 7 years ago

Hmm... to be honest we don't use ReWire for anything in our area (I use a user-login Outset script to enforce some settings in the Reaper ini file, one of which is to disable ReWire integration). However, I'm definitely for adding a post-install script to take care of this – I'll have a look on some of our older systems to determine whether any other applications have historically modified the ReWire directory. I know that MaxMSP supports ReWire but I'd need to check whether it installs anything explicitly – I don't think that it does as it only acts as a host.

It looks as though the ReWire.bundle is from Propellerhead – might a sane (perhaps overkill?) option be to check the version from the Info.plist in the incumbent vs Reaper bundles and only update if required?

I also noticed that Reaper needs to define separate symlinks for the 32/64 versions (note the names):

lrwxr-xr-x  1 root  wheel   64 28 Jul 12:55 REAPERReWireDev.plugin -> /Applications/REAPER.app/Contents/Plugins/REAPERReWireDev.bundle
lrwxr-xr-x  1 root  wheel   66  8 Dec  2016 REAPERReWireDev64.plugin -> /Applications/REAPER64.app/Contents/Plugins/REAPERReWireDev.bundle
drwxr-xr-x  3 root  wheel  102 24 Aug  2016 ReWire.bundle

(Out of interest, how did you go about ascertaining what the Reaper ReWIre script was doing? Do you have any tricks?!)

orbsmiv commented 7 years ago

Okay, here's a ReWire directory from an old machine:

-rw-r--r--@ 1 admin1      admin  106020 Apr 29  2014 Plogue Bidule Engine.bundle
lrwxr-xr-x  1 1208315482  admin      64 Oct  7  2015 REAPERReWireDev.plugin -> /Applications/REAPER.app/Contents/Plugins/REAPERReWireDev.bundle
lrwxr-xr-x  1 1208315482  admin      66 Jan 11  2017 REAPERReWireDev64.plugin -> /Applications/REAPER64.app/Contents/Plugins/REAPERReWireDev.bundle
drwxrwxr-x  3 admin1      admin     102 Sep 22  2006 ReWire.bundle

The ReWire.bundle was initially installed in 2006 (Reaper for Mac wasn't until 2008-9) but the contents are dated 2012 so there must have been a copy at some point after the initial install. Also, the version matches the one I referenced in the previous comment:

<key>CFBundleShortVersionString</key>
        <string>1.8.2 build 127</string>
timsutton commented 7 years ago

As far as I know, nobody in my environment actually uses ReWire either, although we have at least one other app (Live 9) which doesn't give us any choice but to try and set it up as a post-"install" task on first launch.

So my impetus for doing this wasn't so much to make sure that ReWire support is there, but just to prevent the initial dialog for an admin user. Does your script which disables ReWire integration have the effect of not throwing that prompt to set it up?

I just did a comparison like you did and also see that the version shipped with the two is identical:

$ /usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' /Applications/Ableton\ Live\ 9\ Standard.app/Contents/Resources/ReWire-Mach-O/ReWire.bundle/Contents/Info.plist 
1.8.2 build 127
$ /usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' /Applications/REAPER64.app/Contents/Plugins/ReWire.bundle/Contents/Info.plist 
1.8.2 build 127

I used to do ReWire stuff in Max many moons ago but I imagine that like you say, it could be possible to utilize ReWire without needing to install the framework directly.

As for how I found it, I used FSMonitor to just quickly see what was being written and wasn't surprised to see it was ReWire, based on past experience.

orbsmiv commented 7 years ago

Yes, the script stops Reaper from checking for a ReWire device as part of its initialisation and will only then throw the admin prompt if the user goes and enables on the option Check for ReWire mixer/device on startup [...]. I'm in agreement however that anything to prevent this dialog from being shown is a good idea – with a large cohort of students one can't guarantee that there won't be a ReWire fan in their midsts!

I also spotted that the Sibelius 7 pkg installs ReWire.bundle as part of its payload and then performs the symlink as a post-install. I've had these running concurrently for several years and haven't heard of any resulting issues and, again, the Sibelius ReWire version is also 1.8.2 build 127.

I'm happy to incorporate your script or do you want to submit a pull request?

Thanks for the FSMonitor tip – I was using opensnoop which, apart from being somewhat verbose, has also been stymied by SIP!

timsutton commented 7 years ago

Sure, I'll send a PR soon.

The script you have for setting other defaults, do you deploy this to user directories with a login script? Or is it possible to set defaults in a single file which sets defaults system-wide?

orbsmiv commented 7 years ago

As far as I can see there's nothing at the system level – Repear only looks to the user Reaper Resource directory for an ini file. The Python script uses a json file (I should make this into a plist) that specifies the ini keys to be enforced and then compares them against the user's ini file at each login, rewriting if necessary. If there's no file then it generates a basic ini which is fully populated when Reaper next runs. A bit of a hack but it seems to work!