#2008 MSYS should use mingw-get's post-install scripting capability

MSYS
assigned
Cesar Strauss
None
Feature
none
Unknown
False
2014-05-06
2013-07-31
Keith Marshall
No

mingw-get has supported a post-install scripting capability since version 0.5. MSYS should exploit this capability to install its desktop or start-menu shortcuts, (there's a JScript helper installed with mingw-get, to facilitate this), and to invoke it's own post-install script.

Related

Issues: #2036
Issues: #2109

Discussion

1 2 > >> (Page 1 of 2)
  • Cesar Strauss
    Cesar Strauss
    2013-09-07

    • status: unread --> assigned
     
  • Cesar Strauss
    Cesar Strauss
    2013-09-07

    I attach my first try for the shortcut handling in the post-install hook. I was inspired on the post-install hooks of mingw-get-gui.

    However, this line seems a bit "hackish":

    msys_root = os.getenv( "APPROOT" ).."msys\\1.0\\"
    

    Ideally, there should be an API to retrieve the root from the profile.xml. Something like:

    msys_root = setup.sysroot_path("MSYS")
    
     
  • Keith Marshall
    Keith Marshall
    2013-09-08

    Thanks, Cesar.

    I'll take a look at your scripts, when I have a bit more time. I do somewhat disagree on the "hackish" use of Lua's os.getenv -- an established and tested API -- over a bespoke (currently undeveloped and untested) setup.sysroot_path API. It is possible, in this case however, that $APPROOT may not be the most appropriate of the environment variables defined by mingw-get, to inspect. For reference, when it invokes any Lua script, mingw-get will always have defined:

      $APPROOT  --  mingw-get's own installation root path
      $SYSROOT  --  the sysroot path for the package being processed
    

    together with a set of additional reference paths for every subsystem declared in profile.xml's system_map:

      $<SUBSYSTEM>_SYSROOT  --  the sysroot path for named <SUBSYSTEM>
    

    where <SUBSYSTEM> is replaced by the uppercase form of each subsystem name, (so for our default profile.xml configuration, we will have $MINGW32_SYSROOT and $MSYS_SYSROOT). Maybe, in this case:

    msys_root = os.getenv( "MSYS_SYSROOT" )
    

    would be the appropriate API choice?

     
  • Keith Marshall
    Keith Marshall
    2013-09-15

    I'm wondering if msys-core is the most appropriate attachment point for the post-install hooks? Surely, since its purpose is to start up a shell session, msys-bash would be more logical for the shortcut creation hook? Maybe also, although less obviously so, for the fstab setup hook?

     
    • Earnie Boyd
      Earnie Boyd
      2013-09-15

      IMO, the creation of the shortcut belongs in the msys-base package and the creation of fstab belongs with msys-bash.

      Another possibility is to create packages msys-shortcut and msys-fstab that other packages require to do the post-install and post-uninstall steps.

       
      • Keith Marshall
        Keith Marshall
        2013-09-15

        IMO, the creation of the shortcut belongs in the msys-base package ...

        The problem with that would be that msys-tiny would then need to replicate that same script, whereas attaching it to msys-bash would allow both msys-tiny and msys-base to benefit from a single instance, while removing the burden from msys-core, for a feature that, IMO, logically belongs to msys-bash alone.

        Another possibility is to create packages msys-shortcut and msys-fstab ...

        That's certainly a possibility which may be worthy of consideration; it does mean two additional (mostly redundant) meta-packages, but a potential advantage would be that users could then select either one of those to add the shortcut or the fstab to an existing installation which was previously lacking them, without reinstalling the underlying real package.

         
      • Keith Marshall
        Keith Marshall
        2013-10-16

        I'd like to push out an implementation for the shortcuts, based on the code I showed previously, but...

        IMO, the creation of the shortcut belongs in the msys-base package and the creation of fstab belongs with msys-bash.

        surely this is the wrong way round; the shortcut belongs with bash/sh, (because that's what it invokes), and the fstab creation really belongs with msys-core, (because it relates to core infrastructure), which is a fundamental requirement of msys-base, (and msys-tiny), along with everything else related to MSYS.

        Anyway, my proposed implementation for shortcuts consists of a separate .lnk component, which requires msys-bash; each of msys-tiny and msys-base require the .lnk component, (in addition to msys-bash anyway, and msys-core).

         
  • Keith Marshall
    Keith Marshall
    2013-09-21

    I added this:

          <component class="lnk">
            <release tarname="bash-3.1.17-4-msys-1.0.16-lnk.tar.lzma">
              <download tarname="none" />
            </release>
            <action class="post-install">
              setup = require "setup"
              sysroot_prefix = os.getenv( "MSYS_SYSROOT" )
              if sysroot_prefix then
                 setup.create_shortcuts(
                   '--description="Start MinGW Shell"',
                   '--icon="'..sysroot_prefix..'\\msys.ico"',
                    sysroot_prefix..'\\msys.bat', '"MinGW Shell"'
                 )
              end
            </action>
            <action class="pre-remove">
              setup = require "setup"
              sysroot_prefix = os.getenv( "MSYS_SYSROOT" )
              if sysroot_prefix then
                 setup.delete_shortcuts(
                   "--if-linked="..sysroot_prefix.."\\msys.bat",
                   "--force", '"MinGW Shell"'
                 )
              end
            </action>
          </component>
    

    to my local copy of msys-bash.xml; with the changes I've committed to mingw-get master over the last few days, and these preferences for the gui client added into my profile.xml:

      <preferences client="gui">
        <!--
          The preceding "preferences" section applies exclusively to the
          CLI client, (where command line options may be used); here, we
          specify defaults for the GUI client, (which provides no support
          for command line options), such that shortcuts will be created
          on the desktop, and in the start menu, for the current user.
    
          Note that matching of the "client" attribute will be performed
          case-insensitively, against a keyword defined by the respective
          client; any "preferences" section with no "client" assignment
          will be matched for ALL clients.
        -->
    
        <option name="desktop" />
        <option name="start-menu" />
      </preferences>
    

    (with the existing preferences designated as client="cli"), it WJFFM from both CLI and GUI.

     
  • Keith Marshall
    Keith Marshall
    2014-05-06

    Finally got around to looking at the fstab element; FWIW, I think it should be associated with msys-core-bin itself, (rather than msys-core-ext), whereas I do still think that the shortcuts element belongs with msys-bash-bin.

    What do you think of the attached adaptation of msys-core, to deliver the fstab element, and to initialize /etc/fstab? Delivered in the form of a minor upgrade from msys-core-1.0.18-1 to msys-core-1.0.18-2, it offers:

    1. /etc/fstab.sample delivered with the package, but adjusted at installation time, to reflect actual installation choice for /mingw mount point association.

    2. /etc/fstab created if necessary, with correct mapping of /mingw mount point.

    3. Any pre-existing /etc/fstab content preserved, but with /mingw mount point adjusted to match installation choice in mingw-get's profile.xml.

     
1 2 > >> (Page 1 of 2)