http://bugzilla.wpkg.org/show_bug.cgi?id=202

           Summary: Expand environment variables in download urls
           Product: WPKG
           Version: other
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: wpkg.js
        AssignedTo: man...@wpkg.org
        ReportedBy: mbac...@googlemail.com
         QAContact: wpkg-users@lists.wpkg.org


Created attachment 183
  --> http://bugzilla.wpkg.org/attachment.cgi?id=183
Patched wpkg.js

I think it would be great if environment variables could be expanded in
download urls. This could be enabled by setting the attribute expand of the
download node to true.

Here is a quick working example of a getDownloadUrl function:

function getDownloadUrl(downloadNode) {
    var downloadUrl = downloadNode.getAttribute("url");
    var downloadExpand = downloadNode.getAttribute("expand");
    if (downloadExpand != null && downloadExpand == "true") {
        var shell = new ActiveXObject("WScript.Shell");
        var downloadUrlExpanded = shell.ExpandEnvironmentStrings(downloadUrl);
        info(downloadUrlExpanded)
        return downloadUrlExpanded;
    }
    return downloadUrl;
}

Any thoughts? I am using this to install Firefox versions like this:

  <package id="firefox" name="Mozilla Firefox" revision="10" reboot="false"
priority="0">
    <variable name="version" value="3.6.13" />

    <check type="uninstall" condition="exists" path="Mozilla Firefox
(%version%)" />

    <install cmd='"%TEMP%\firefox.exe" -ms'>
      <download expand="true"
url="http://mirror.leaseweb.com/software/mozilla/firefox/releases/%version%/win32/de/Firefox%20Setup%20%version%.exe";
target="firefox.exe" />
    </install>
    <install cmd='%COMSPEC% /C del "%PUBLIC%\Desktop\Mozilla Firefox.lnk"' />

    <upgrade cmd="taskkill /F /IM firefox.exe">
      <exit code="0" />
      <exit code="128" />
      <exit code="-1073741515" />
    </upgrade>
    <upgrade cmd='"%TEMP%\firefox.exe" -ms'>
      <download expand="true"
url="http://mirror.leaseweb.com/software/mozilla/firefox/releases/%version%/win32/de/Firefox%20Setup%20%version%.exe";
target="firefox.exe" />
    </upgrade>
    <upgrade cmd='%COMSPEC% /C del "%PUBLIC%\Desktop\Mozilla Firefox.lnk"' />

    <remove cmd="taskkill /F /IM firefox.exe">
      <exit code="0" />
      <exit code="128" />
      <exit code="-1073741515" />
    </remove>
    <remove cmd='"%PROGRAMFILES(x86)%\Mozilla Firefox\uninstall\helper.exe"
/s'>
      <exit code="0" />
      <exit code="-1" />
    </remove>
    <remove cmd='"%PROGRAMFILES%\Mozilla Firefox\uninstall\helper.exe" /s'>
      <exit code="0" />
      <exit code="-1" />
    </remove>
  </package>

-- 
Configure bugmail: http://bugzilla.wpkg.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
-------------------------------------------------------------------------
wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-users/
_______________________________________________
wpkg-users mailing list
wpkg-users@lists.wpkg.org
http://lists.wpkg.org/mailman/listinfo/wpkg-users

Reply via email to