SUN package, "read" in preinstall script does not work - SUN

This is a discussion on SUN package, "read" in preinstall script does not work - SUN ; Hi all, I am trying to build a sun package. I successfully defined the files pkginfo and prototype and managed to create the package using pkgmk and pkgtrans. So far so good. I am now trying to write a preinstall ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: SUN package, "read" in preinstall script does not work

  1. SUN package, "read" in preinstall script does not work


    Hi all,

    I am trying to build a sun package. I successfully defined the files
    pkginfo and prototype and managed to create the package using pkgmk and
    pkgtrans. So far so good.

    I am now trying to write a preinstall shell script in order to
    check/install certain things prior the installation of my package.

    For some reason all the "read"'s (so read from standard input) within
    the preinstall shell script are completely ignored when installing the
    package using pkgadd. It looks like someone is pressing straight
    away. When running the preinstall script manually it works like expected
    - so the script waits until the key is pressed.

    Does anybody know why the read's are ignored when this script is
    executed via the pkgadd command? Is there maybe a stdin redirection
    somewhere? Does anybody know a solution?

    Thanks in advance for any hint, I ran out of ideas...

    kind regards, Joerg.





  2. Re: SUN package, "read" in preinstall script does not work

    On Wed, 21 May 2008 13:39:57 +0200, Joerg Morbitzer wrote:

    >
    >
    > I am trying to build a sun package. I successfully defined the files
    > pkginfo and prototype and managed to create the package using pkgmk and
    > pkgtrans. So far so good.
    > I am now trying to write a preinstall shell script in order to
    > check/install certain things prior the installation of my package.
    > For some reason all the "read"'s (so read from standard input) within
    > the preinstall shell script are completely ignored when installing the
    > package using pkgadd. It looks like someone is pressing straight
    > away. When running the preinstall script manually it works like expected
    > - so the script waits until the key is pressed.


    Without seeing what youve done its hard to comment.
    A snippet of code might help

    > Does anybody know why the read's are ignored when this script is
    > executed via the pkgadd command? Is there maybe a stdin redirection
    > somewhere? Does anybody know a solution?


    When trying something like this I first examine how Sun does it : >
    I have 1218 preinstall scripts on my patch server at present, and
    many have read statements.


  3. Re: SUN package, "read" in preinstall script does not work

    AGT wrote:
    > On Wed, 21 May 2008 13:39:57 +0200, Joerg Morbitzer wrote:
    >
    >>
    >> I am trying to build a sun package. I successfully defined the files
    >> pkginfo and prototype and managed to create the package using pkgmk and
    >> pkgtrans. So far so good.
    >> I am now trying to write a preinstall shell script in order to
    >> check/install certain things prior the installation of my package.
    >> For some reason all the "read"'s (so read from standard input) within
    >> the preinstall shell script are completely ignored when installing the
    >> package using pkgadd. It looks like someone is pressing straight
    >> away. When running the preinstall script manually it works like expected
    >> - so the script waits until the key is pressed.

    >
    > Without seeing what youve done its hard to comment.
    > A snippet of code might help


    Ok, I made a small example:

    ---------------------- pkginfo ------------------------------
    PKG="MYTESTPKG"
    NAME="This is just a test "
    ARCH="sparc"
    VERSION="20080521"
    CATEGORY="application"
    VENDOR="myself"
    EMAIL="hotline@blabla.com"
    PSTAMP="whatever"
    HOTLINE="+49 1234 5678"
    BASEDIR="/usr/local"
    CLASSES="none"
    ---------------------- pkginfo ------------------------------


    ---------------------- prototype ----------------------------
    i pkginfo=/home/jomo/scripts/sun-packaging/test/pkginfo
    i preinstall=/home/jomo/scripts/sun-packaging/test/preinstall
    d none testing 0750 root root
    f none testing/df 0750 root root
    ---------------------- prototype ----------------------------


    ---------------------- preinstall ----------------------------
    #!/bin/sh

    printf "\n Let's start, enter value and press :"
    read bla
    printf "\n You pressed \"${bla}\".\n\n"
    ---------------------- preinstall ----------------------------



    Now I just copy /usr/bin/df to /usr/local/testing/df and generate the
    sun package:


    ------------------------ cut ---------------------------------

    jomo@pan [/home/jomo/scripts/sun-packaging/test] >pkgmk -o -r /usr/local
    -d /tmp/bla
    ## Building pkgmap from package prototype file.
    ## Processing pkginfo file.
    ## Attempting to volumize 2 entries in pkgmap.
    part 1 -- 132 blocks, 7 entries
    ## Packaging one part.
    /tmp/bla/MYTESTPKG/pkgmap
    /tmp/bla/MYTESTPKG/pkginfo
    /tmp/bla/MYTESTPKG/install/preinstall
    /tmp/bla/MYTESTPKG/reloc/testing/df
    ## Validating control scripts.
    WARNING: script may require user interaction at line <4>.
    ## Packaging complete.

    jomo@pan [/home/jomo/scripts/sun-packaging/test] >pkgtrans -s /tmp/bla
    /tmp/MYTESTPKG.pkg

    The following packages are available:
    1 MYTESTPKG This is just a test
    (sparc) 20080521

    Select package(s) you wish to process (or 'all' to process
    all packages). (default: all) [?,??,q]:
    Transferring package instance
    jomo@pan [/home/jomo/scripts/sun-packaging/test] >

    ------------------------ cut ---------------------------------


    And now I am installing my new package:


    ------------------------ cut ---------------------------------
    # pkgadd -d ./MYTESTPKG.pkg

    The following packages are available:
    1 MYTESTPKG This is just a test
    (sparc) 20080521

    Select package(s) you wish to process (or 'all' to process
    all packages). (default: all) [?,??,q]:

    Processing package instance from

    This is just a test(sparc) 20080521
    myself
    Using as the package base directory.
    ## Processing package information.
    ## Processing system information.
    ## Verifying disk space requirements.
    ## Checking for conflicts with packages already installed.
    ## Checking for setuid/setgid programs.

    This package contains scripts which will be executed with super-user
    permission during the process of installing this package.

    Do you want to continue with the installation of [y,n,?] y

    Installing This is just a test as

    ## Executing preinstall script.

    Let's start, enter value and press :
    You pressed "".
    ## Installing part 1 of 1.
    /usr/local/testing/df
    [ verifying class ]

    Installation of was successful.
    #
    ------------------------ cut ---------------------------------


    The package gets installed straight away, the read command is not
    waiting for any stdin input, what am I doing wrong?

    Regards, Joerg.

  4. Re: SUN package, "read" in preinstall script does not work

    On Fri, 23 May 2008 08:01:31 +0200, Joerg Morbitzer wrote:

    > AGT wrote:
    >> On Wed, 21 May 2008 13:39:57 +0200, Joerg Morbitzer wrote:
    >>
    >>>
    >>> I am trying to build a sun package. I successfully defined the files
    >>> pkginfo and prototype and managed to create the package using pkgmk and
    >>> pkgtrans. So far so good.
    >>> I am now trying to write a preinstall shell script in order to
    >>> check/install certain things prior the installation of my package.
    >>> For some reason all the "read"'s (so read from standard input) within
    >>> the preinstall shell script are completely ignored when installing the
    >>> package using pkgadd. It looks like someone is pressing straight
    >>> away. When running the preinstall script manually it works like expected
    >>> - so the script waits until the key is pressed.

    >>
    >> Without seeing what youve done its hard to comment.
    >> A snippet of code might help

    >
    > Ok, I made a small example:
    >
    > ---------------------- pkginfo ------------------------------

    some snippage
    >


    Ok I was able to replicate what you are seeing and after trying a
    few hacks of my own and getting the same results I have to go
    back to what I said originally which was find something that WORKS
    and copy the method. We are both missing something and its probably
    undocumented.
    There are a few packages around that evoke a read interactive session.
    I just cant think of any right now.

    > ---------------------- preinstall ----------------------------
    > #!/bin/sh
    > printf "\n Let's start, enter value and press :" read bla printf
    > "\n You pressed \"${bla}\".\n\n"

    ---------------------- preinstall ----------------------------


+ Reply to Thread