INSTALL.CMD - REXX

This is a discussion on INSTALL.CMD - REXX ; Using any OS/2 Rexx interpreter (so keeping an EA-size limit in mind), not using any external tool or file other than MY.EXE, what's the most effective way to create a single INSTALL.CMD with Rexx? Here's a pseudo-code example. MY.EXE contains ...

+ Reply to Thread
Results 1 to 3 of 3

INSTALL.CMD

  1. Default INSTALL.CMD


    Using any OS/2 Rexx interpreter (so keeping an EA-size limit in mind),
    not using any external tool or file other than MY.EXE, what's the most
    effective way to create a single INSTALL.CMD with Rexx?

    Here's a pseudo-code example. MY.EXE contains 52000 random byte values.

    /* MakeInstall.CMD */
    /* Read the input file */
    exe=CharIn('MY.EXE',,52000)
    /* Add the input file to INSTALL.CMD */
    CALL CharOut 'INSTALL.CMD','/**/;CALL CharOut "MY.EXE","'||exe||'";'
    /* Do whatever installers do besides copying files */
    CALL CharOut 'INSTALL.CMD','SAY "MY.EXE created in:" Directory();'
    /* Not required, leave only MY.EXE behind */
    CALL CharOut 'INSTALL.CMD','@DEL INSTALL.CMD > NUL'

    So MakeInstall.CMD creates INSTALL.CMD, which installs MY.EXE. But the
    INSTALL.CMD created this way won't always work. MY.EXE could contain a
    number of quotes. What about line lengths, or the size of INSTALL.CMD,
    and so on. Pleae note MakeInstall.CMD may be slow, it's a working and
    small, effective INSTALL.CMD that really matters.



    ---

  2. Default Re: INSTALL.CMD

    There are a simple method: encode the string which represents the
    file contents. For example: as a hexadecimal string:

    /* encode.cmd: Encode a file as a hexadecimal string */
    parse arg file

    newline = '0D0A'x

    data = charin(file, 1, chars(file))
    call charout file

    hex_data = c2x(data)

    call lineout 'decode.cmd', '/**/'
    call charout 'decode.cmd', "hex_data = ''"

    do i = 1 to length(hex_data) by 75
    call charout 'decode.cmd', "||," || newline
    str = strip(substr(hex_data, i, 75))
    call charout 'decode.cmd', "'"str"'"
    end

    call lineout 'decode.cmd', ''
    call lineout 'decode.cmd', 'data = x2c(hex_data)'
    call lineout 'decode.cmd', "call charout '"file"', data"
    exit
    /* End of encode.cmd */

    With Gzip compression:

    /* gencode.cmd: Encode a file as a GZIPed hexadecimal string */

    call RxFuncAdd 'rxGZLoadFuncs', 'rxGZlib', 'rxGZLoadFuncs'
    call rxGZLoadFuncs

    parse arg file

    newline = '0D0A'x

    data = charin(file, 1, chars(file))
    call charout file

    hex_data = c2x(data)

    call lineout 'gdecode.cmd', '/**/'
    call charout 'gdecode.cmd', "hex_data = ''"

    do i = 1 to length(hex_data) by 75
    call charout 'gdecode.cmd', "||," || newline
    str = strip(substr(hex_data, i, 75))
    call charout 'gdecode.cmd', "'"str"'"
    end

    call lineout 'gdecode.cmd', ''
    call lineout 'gdecode.cmd', 'data = x2c(hex_data)'
    call lineout 'gdecode.cmd', "call charout '"file"', data"
    call lineout 'gdecode.cmd', "call charout '"file"', data"
    exit
    /* End of gencode.cmd */

    In Hobbes you can find something similar with base64 encoding:

    http://hobbes.nmsu.edu/pub/os2/apps/misc/chir005d.zip

    Anyway, the time stamp, the extended atributes and so on ARE LOST
    when you put the EXE file inside the CMD file. WarpIN packages (WPI or
    EXE) are a better option, I think.

    Best regards:

    Salvador Parra Camacho


  3. Default Re: INSTALL.CMD


    > <cut>


    Thanks for the ideas and inspiration, I'll investigate it further.

    > Anyway, the time stamp, the extended atributes and so on ARE LOST
    > when you put the EXE file inside the CMD file.


    There are a few identified disadvantages:

    - size (<64 KB, EA-related?)
    - by default no compression
    - it's not that obvious that "INSTALL.CMD" can be deleted when done
    - occupying about twice the size of the *.EXE when INSTALL.CMD is kept
    - indeed loss of EA's, e.g. both MY.EXE and MY.ICO required
    - to be honest, no "Disk full?"-checks, et cetera

    > WarpIN packages (WPI or EXE) are a better option, I think.


    In general, yes. In this case I need customized interaction with the
    user, and there's no "the" way to install the *.EXE. I recommend to
    install it in a certain way, but it also works any other way. WarpIN
    could fullfill my needs. If so, a part of the interaction/information
    may get lost due to repetetive use of the "Next>"-button, so that's
    why I tried to embed the *.EXE in a single *.CMD first.



    ---

+ Reply to Thread

Similar Threads

  1. Error Trying to Install Net2 so I can install Net3
    By Application Development in forum DOTNET
    Replies: 2
    Last Post: 10-12-2007, 11:20 AM
  2. Replies: 5
    Last Post: 09-18-2007, 06:11 PM
  3. Install rights required to install ADOMD.NET
    By Application Development in forum ADO DAO RDO RDS
    Replies: 0
    Last Post: 02-16-2007, 03:47 PM
  4. Re: Acrobat 8.0 trial install flashes screenand then quits install
    By Application Development in forum Adobe Acrobat
    Replies: 0
    Last Post: 12-11-2006, 11:02 AM
  5. Replies: 1
    Last Post: 12-27-2005, 04:29 AM