I've been playing around with pnet, and there's a little problem. 

Both pnet and wine can handle MZ (Microsoft's extended version of their PE 
format, which handles both native Windows binaries and ICS/.net portable 
apps), but you can't register two handlers for the same binfmt.

Fortunately, pnet's interpreter forwards to wine if it finds a Windows native 
file, so you want to register that as the handler if you're using both wine 
and pnet. But of course you want to register wine as the handler if you're 
not using pnet.

I've modified the wine initscript to work friendlily with the pnet initscript, 
so you can use both. I'll be happy to put together updated wine and pnet 
packages if people want (once I can get into the server), but for now, here's 
how to do it yourself in three semi-easy steps.

1. Copy the pnet script supplied in the package:

  cp /usr/share/doc/pnet-0.5.2/init.d-pnet /etc/rc.d/init.d/pnet

2. Modify the wine script as follows:

  replace
    echo ':windows:M::MZ::/usr/bin/wine' >/proc/sys/fs/binfmt_misc/register
  with
    grep -qs "magic 4d5a" /proc/sys/fs/binfmt_misc/* ||
      echo ':windows:M::MZ::/usr/bin/wine' >/proc/sys/fs/binfmt_misc/register

  replace
    status)[[ -e /proc/sys/fs/binfmt_misc/windows ]] && echo Wine Registration 
enabled || [[ -e /proc/sys/fs/binfmt_misc/windowsPE ]] && echo Wine and Pnet 
Registrations enabled || echo Wine Registration disabled ;;
  with
    status)if [[ -e /proc/sys/fs/binfmt_misc/windows ]]; then echo Wine 
Registration enabled; else if [[ -e /proc/sys/fs/binfmt_misc/windowsPE ]]; 
then echo Wine and Pnet Registrations enabled; else echo Wine Registration 
disabled; fi; fi;;

3. Make sure they're both enabled:

  chkconfig --level 2345 pnet
  chkconfig --level 2345 wine

Since pnet is at 80/30 and wine is at 99/10, pnet will be installed first, and 
wine will avoid stepping all over it. If you later disable pnet, wine will 
work as it always did. 

The only issue is that if you manually start (stop) the pnet service, or 
(un)register pnet directly, you'll need to restart the wine service, but I 
don't see any easy way around this. I played around with a pnet script that 
handled this. On starting, it checked whether wine was registered for MZ, and 
if so, unregistered it; on stopping, it checked whether wine was registered 
for PE, and if so, registered it for MZ as well. But this seemed like too 
ugly of a hack for too little benefit.


Reply via email to