Embedded NSIS Problem

Discussion in 'Skins and Plugins Installer (MPEI)' started by fforde, February 10, 2013.

  1. fforde

    fforde Community Plugin Dev

    Joined:
    June 7, 2007
    Messages:
    2,666
    Likes Received:
    1,690
    Occupation:
    Software Engineer
    Location:
    Texas
    Ratings:
    +1,696 / 0
    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?


     
    • Like Like x 2
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. jameson_uk
    • Premium Supporter

    jameson_uk Retired Team Member

    Joined:
    January 27, 2005
    Messages:
    7,258
    Likes Received:
    2,228
    Gender:
    Male
    Occupation:
    Data Warehousing Consultant
    Location:
    Birmingham
    Ratings:
    +2,405 / 0
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    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?
     
  4. fforde

    fforde Community Plugin Dev

    Joined:
    June 7, 2007
    Messages:
    2,666
    Likes Received:
    1,690
    Occupation:
    Software Engineer
    Location:
    Texas
    Ratings:
    +1,696 / 0
    Home Country:
    United States of America United States of America
    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.
     
  5. Holzi
    • Team MediaPortal

    Holzi Super Moderator

    Joined:
    April 21, 2010
    Messages:
    7,928
    Likes Received:
    1,591
    Gender:
    Male
    Location:
    Ba-Wü
    Ratings:
    +2,228 / 8
    Home Country:
    Germany Germany
    Show System Specs
    Fair enough.
    Thanks for investigating and trying!

    Maybe some of our Devs are willing to help you then.
     
    Last edited: February 23, 2013
  6. volumia

    volumia Portal Pro

    Joined:
    November 23, 2011
    Messages:
    99
    Likes Received:
    21
    Gender:
    Male
    Location:
    whereever my feet take me...
    Ratings:
    +44 / 0
    Home Country:
    Netherlands Netherlands
    As soon as you move the moving-pictures-setup.exe outside C:\Program Files (x86)\Team MediaPortal\MediaPortal (like the desktop) and run it, it sets up just fine?
     
  7. fforde

    fforde Community Plugin Dev

    Joined:
    June 7, 2007
    Messages:
    2,666
    Likes Received:
    1,690
    Occupation:
    Software Engineer
    Location:
    Texas
    Ratings:
    +1,696 / 0
    Home Country:
    United States of America United States of America
    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: February 25, 2013
  8. jameson_uk
    • Premium Supporter

    jameson_uk Retired Team Member

    Joined:
    January 27, 2005
    Messages:
    7,258
    Likes Received:
    2,228
    Gender:
    Male
    Occupation:
    Data Warehousing Consultant
    Location:
    Birmingham
    Ratings:
    +2,405 / 0
    Home Country:
    United Kingdom United Kingdom
    Show System Specs
    @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?
     
  9. offbyone
    • Team MediaPortal

    offbyone Development Group

    Joined:
    April 26, 2008
    Messages:
    3,981
    Likes Received:
    2,704
    Gender:
    Male
    Location:
    Stuttgart
    Ratings:
    +3,303 / 3
    Home Country:
    Germany Germany
    Show System Specs
    @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.
     
  10. fforde

    fforde Community Plugin Dev

    Joined:
    June 7, 2007
    Messages:
    2,666
    Likes Received:
    1,690
    Occupation:
    Software Engineer
    Location:
    Texas
    Ratings:
    +1,696 / 0
    Home Country:
    United States of America United States of America
    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.
     
    • Like Like x 1
  11. offbyone
    • Team MediaPortal

    offbyone Development Group

    Joined:
    April 26, 2008
    Messages:
    3,981
    Likes Received:
    2,704
    Gender:
    Male
    Location:
    Stuttgart
    Ratings:
    +3,303 / 3
    Home Country:
    Germany Germany
    Show System Specs
    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.
     
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!