Embedded NSIS Problem (1 Viewer)

fforde

Community Plugin Dev
June 7, 2007
2,667
1,702
42
Texas
Home Country
United States of America United States of America
With the latest release of Moving Pictures we are trialing an MPEI. The current implementation is just a wrapper around our existing NSIS installer. I am using the standard "launch application" action in the MPEI installer. I would like to get rid of this and implement it 100% in MPEI but due to time constraints we went with this solution for now.

Here is the problem, everything works perfectly fine if you double-click that mpe1 file and run the installer that way. But I have just realized that if you download and launch the installer from the MPEI tool itself, the NSIS installer is not able to copy files to the MediaPortal directory. My assumption is that when run this way, the installer does not have the proper permissions to write to C:\Program Files\.

Has anyone run into this problem before? Is there a known work around?
 

jameson_uk

Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    Has anyone run into this problem before? Is there a known work around?
    Noticed this earlier when trying to install moving pics.
    not sure this is an extension plugin issue as launching the package via Extension Installer program on desktop pops up with a "Please shutdown MediaPortal to continue the installation" error which is what I think causes it to hang if you attempt to install via extension plugin??

    Is there a check in the NSIS installer as to whether MP is running?
     

    fforde

    Community Plugin Dev
    June 7, 2007
    2,667
    1,702
    42
    Texas
    Home Country
    United States of America United States of America
    • Thread starter
    • Moderator
    • #3
    The error message indicates that the installer could not copy the files to their destination. When it runs stand alone the cause for this in the past to my knowledge has always been because the files are locked (i.e. MediaPortal is running and has the old DLL loaded in memory). So that is the reason for the error message, it's obviously a inaccurate in this situation though. If I were to speculate I'd say the Extension Installer is probably not elevating permissions for the NSIS installer when it executes it in some situations.

    And yes I am fairly certain this is caused by the Extension Installer. When you run the NSIS installer stand alone it works fine, this is how Moving Pictures has been distributed for years. When you run the MPEI installer by double clicking the MPE1 bundle in your file system, everything works fine. When you run the installer by beginning inside the Extension Installer UI, it fails. The one thing I know for sure is that the embedded NSIS installer can not copy the Moving Pictures DLL to it's destination. As I said I suspect this has something to do with permissions.

    I posted here and I approached the MediaPortal team in IRC and offbyone spent a little bit of time looking at the problem, but I assume he didn't figure anything out because I never heard back from him. My current plan is to just convert everything over to a proper MPEI installer and ditch the embedded NSIS installer. I meant to have this done last weekend, but honestly I have been procrastinating on this because MPEI is really a huge pain in the ass to work with.

    So bottom line is I don't know exactly what's wrong, but I think it has to do with the MediaPortal Extension Installer. Based on the response on IRC and in this thread the MediaPortal team does not seem interested in assisting. So I will get a full MPEI installer published... when I have the time and the willpower to deal with MPEI again.
     

    Holzi

    Super Moderator
  • Team MediaPortal
  • April 21, 2010
    7,934
    2,235
    Ba-Wü
    Home Country
    Germany Germany
    Fair enough.
    Thanks for investigating and trying!

    Maybe some of our Devs are willing to help you then.
     
    Last edited:

    fforde

    Community Plugin Dev
    June 7, 2007
    2,667
    1,702
    42
    Texas
    Home Country
    United States of America United States of America
    • Thread starter
    • Moderator
    • #6
    Thanks Volumia, you put me on the right track.

    When running through the Extension Installer, the Extension Installer sets the working directory for the embedded NSIS installer to the MediaPortal directory (this does not seem to happen when simply double clicking the MPE1 file). This is unrelated to where the file is copied, the Extension installer explicitly sets the working directory regardless of the location of the extracted executable, but this only happens when running through the full UI.

    The initial working path normally should be harmless, however the format of the paths in MediaPortalDirs.xml are inconsistent. Most directories in this file are specified using absolute path, however the plugin directory is sometimes specified using a relative path. I have no idea why it is setup like this, but it is something we were aware of and tested for.

    So with a MediaPortal working directory and a relative path to the plugin directory we have a problem. We are running from literally the only place in the system where that relative path would resolve. So the installer saves that to use later as the target directory. Later we change our working path to install other files. We get to the DLLs and try to change to the plugin directory which is stored as a relative path. Because we have changed directories this relative path is now invalid. The plugin can't write the DLLs so the installer fails.

    So bottom line:
    1. The Extension Installer is inconsistent about the working directory when launching embedded executable.
    2. The MediaPortalDirs.xml file for some reason sometimes uses relative paths for some directories.
    3. The Moving Pics Installer knows how to deal with #2 but there was a bug that was exposed by #1.
     
    Last edited:

    jameson_uk

    Retired Team Member
  • Premium Supporter
  • January 27, 2005
    7,258
    2,528
    Birmingham
    Home Country
    United Kingdom United Kingdom
    So bottom line:
    1. The Extension Installer is inconsistent about the working directory when launching embedded executable.
    2. The MediaPortalDirs.xml file for some reason sometimes uses relative paths for some directories.
    3. The Moving Pics Installer knows how to deal with #2 but there was a bug that was exposed by #1.
    @offbyone the LAV package is an executable so did you make any allowances for this? Is this a wiki thing or something that needs changing?
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    @jameson_uk : what "allowances" would there be required? Please don't forget the code was not done by me. :rolleyes: On another note, LAV is also an executable inside MPE.
    @fforde : I tried to find the problem for some hours, but couldn't get to the bottom of it (n)

    I will check about the working dir, maybe with that info I can find the difference.
     

    fforde

    Community Plugin Dev
    June 7, 2007
    2,667
    1,702
    42
    Texas
    Home Country
    United States of America United States of America
    • Thread starter
    • Moderator
    • #9
    It's okay offbyone, I appreciate the fact that you spent some time on it. And the actual bug turned out to be on the Moving Pictures end anyways. MPEI does seem to behave oddly with working directories but I wouldn't call this a bug really, just an inconsistency.
     

    offbyone

    Development Group
  • Team MediaPortal
  • April 26, 2008
    3,989
    3,712
    Stuttgart
    Home Country
    Germany Germany
    LAV is a very special case anyway - it does not need any info from MediaPortal and simply calls an exe with a silent switch, which will use a default install dir.
     

    Users who are viewing this thread

    Top Bottom