Home Forums Software InstaDMG chroot and $0, $1, $2, $3 in postflight scripts.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #371843
    benfeea1
    Participant

    I may just have this totally wrong in my head.

    I want to use the $2 variable to chroot at the very beginning of a script.
    That way any path I use in the script will work anywhere I tell the installer to install to.

    For instance If I am booted from drive A, but run the installer against drive B…

    #!/bin/bash
    # postflight script
    # Installer.app Environmental Variables
    # $0 = Path to package being installed
    # $1 = Destination path of where package is being installed
    # $2 = Mountpoint of the destination volume
    # $3 = Path to the directory containing the System folder that contains the active Installation framework.
    #
    # set working directory.
    chroot “$2”
    touch /test1
    #
    # rest of script…

    This should create a file called “test1” at the root of drive B.
    However, the Installer hangs at the chroot command. and gives the following error.
    postflight[858]: sh: no job control in this shell

    #371845
    Patrick Fergus
    Participant

    I think you’ll have to prepend the variable to whatever path you’re using. I [i]think[/i] your shell variables are incorrect. Per “Some information is passed by the installer to these scripts when they are launched”:

    [url]http://s.sudre.free.fr/Stuff/PackageMaker_Howto.html[/url]

    The variables are as follows in the shell:

    $0 Script path
    $1 Package path
    $2 Default location
    $3 Target volume

    So if you want to touch test1 at the root of the target installation volume, you’d do this:

    [code]touch $3/test1[/code]

    – Patrick

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Comments are closed