Scripts in PackageMaker

Hello,
I'm having a hard time figuring out how to work with scripts (postinstall and choice requirements) in PackageMaker and can't find the answer, so I'll just shoot:
1. Should I place the script manually inside the installer, if so, where? or PackageMaker will do it automagically for me?
2. How should I write the path to the scripts in PackageMaker? Absolute paths using the variables, like $1 (if they can be used there) or is there a way to use relative paths? if so, relative to where?
Thanks in advance for any help!
Israel

Hello,
I also get headaches, figuring out how PackageMaker works. I use Version 3.03. In the scripts pane you can simply add the absolute path to your script for postinstall. PackageMaker will automagically include the script in you package and rename it properly. If your postinstall script need to call additional scripts or other ressources, put them all in one folder and add this folder to "Scripts directory". All files in this folder will be available at install time.
Be aware that the Postinstall script is only called once. (Only, when you run the installer the first time, even if you change the script later). For test purposes, it may be better to use Postflight.
Until now, I don't use the "requirements tests".

Similar Messages

  • Run Preinstall Script in PackageMaker

    I'm using PackageMaker to install an app update and want to add a preinstall script to delete some files in the /Applications/ folder. The script is simply:
    #!/bin/bash rm /Applications/...
    etc.
    If I run this script with Terminal using
    bash preinstall.sh
    it works fine.
    However, when I add it to PackageMaker and run the .mpkg file the script opens in Text Edit but does not run. How do I get it to run but not open?

    Please don't crosspost
    http://forum.java.sun.com/thread.jspa?threadID=703918

  • Trying to create install script in PackageMaker...help for newbie

    Hello,
    I am trying to deploy a solution as an install package. Currently, there are 3 items inside the folder that needs to be installed in the /Applications folder. This in itself is easy. However, when I create upgrades to the solution, I want to carry over one file from the previous installation to the new one. Is there a way to have this upgraded version install and instead of removing all of the earlier files, can it install the new files (which are 3) and carry over 1 of the other files.
    I hope this makes sense. Thanks for any input or sample scripts that I may be able to modify to accomplish this.
    Thanks,
    Stephen

    Thanks for your time!
    Perhaps it would help if I explain a little further my situation and what I am trying to accomplish.
    I have a database runtime solution that I want to distribute. I have all of the necessary files in a single folder, let's say, named "Progam 1.2". Since whenever I upgrade this version, I need to have the old data file from the previous version on hand to import into the new file, I create a new folder called "Program 1.3" So after the installation, I would have both folders. The user then opens the new version and the program then will import the previous versions data. At that point the user may delete the previous version folder entirely.
    My question is how can accomplish an install so that the new version will not overwrite the previous folder "Program 1.2" when installing the upgrade to "Program 1.3" since I need the data file for updating the data. Ideally, I would love to have the new folder installed and the single data file in the previous version folder be copied to the new versions folder and be renamed to "Previous Data" so that the new version can update the data.
    Again, I am a complete newbie in this arena and have simply been doing DMG files where the user copies the new version to the applications folder. But if there was a way to automate this installation more, I would like to do that.
    Thanks again for your help!
    Stephen

  • PackageMaker scripts issue

    I have an installer that needs to drop a file within an already installed bundle. Using the GUI PackageMaker I drop the file at the level of the bundle. I then use a script to move my file within the bundle and assign the proper rights. If I run the installer as an admin everything is fine. As a standard user, the file is zero bytes once moved within the bundle. PackageMaker is set to require admin authorization. I also have a preinstall/preupgrade script removing the file if it already is in the bundle. This fails as the standard user. The weird thing is the PackageMaker claims the install was successful even though the scripts have issues.
    I am assuming that PackageMaker cannot have a destination be within a bundle. Is there another install product that would be better suited for this without the need for scripting?
    Message was edited by: Aikidokatech
    Message was edited by: Aikidokatech

    andyboutte wrote:
    packagemacker has been very inconsistent for me with owner and group.
    PackageMaker is very consistent with owner and group. It is always root:admin.
    I have had to start setting the owner and group in my post flight script. Is anybody else having these problems? are we doing something wrong or is it packagemaker?
    PackageMaker is certainly a pain, but if you are setting your own permissions, then you probably aren't doing something correctly.

  • PackageMaker postflight script to reindex Spotlight?

    Hello,
    I've put together a PackageMaker installer that installs a Spotlight plugin, and runs a postflight script that includes a command based on this one:
    /usr/bin/mdimport -r /Library/Spotlight/Yourplug-in
    which is taken from Apple's support page here:
    http://www.apple.com/downloads/macosx/submit/installers.html
    The trouble is that the installer log tells me this:
    ./postflight: mdimport will not import on behalf of root user. Exiting.
    How can I fix this so that the mdimport command runs without problems?
    Thanks for any help

    That was exactly right. I changed the command so that it reads
    sudo -u $USER /usr/bin/mdimport -r /Library/Spotlight/Yourplug-in
    and the problem didn't occur. Thank you!

  • Packagemaker: need to run applescript from postflight script

    Does anybody makes packages using Packagemaker? I need to run applescript from postflight shell script. Generally, when we need to run applescript or any application from shell script we write:
    #!/bin/sh
    open /Path/to/applscrpt.app
    But what to do if all scripts (shell, app's) placed in MyPackage.pkg/Contents/Resources? What path I need to specify? This way:
    #!/bin/sh
    open ./Contents/Resources/applscrpt.app
    doesn't work...

    The $1 argument that gets passed to your postflight script by the Installer should contain the full path to the package that's currently being installed. So something like this should work...
    #!/bin/sh
    open "$1/Contents/Resources/applscrpt.app"
    Here is some additional info about args and environment variables available to your scripts.
    Steve

  • Packagemaker with shell-script?

    I pulling my hair here. Trying to make a package with a shell-script, postinstall. When i try to choose it its greyed out so i cant select it at all. permissions are root:admin and 0555, i have no clue whats wrong anymore and i have searched the whole internet!
    Using Tiger with Xtools 2.1.
    Happy for all suggestions.
    thx

    1) If you have access to a Windows machine , run the problematic query in windows 'rwrun' and see whether there is any output That way we can find out whether this a 'shell' related problem . [ ie the way cmd lines are passed ]
    2) Backup and Edit the rwrun.sh script . There you can see
    rwrun $* # or something to this effect
    Instead of '$*' , put your command line args inside directly .
    Then just simply run using rwrun.sh < no args >
    Again , this is to see whether this problem is due to the way shell handles parameters
    3) You can even try setting env variables [ as in reports.sh ] and trying 'rwrun' in shell prompt itself
    rwrun <.....> # no .sh
    4) Please consult SuSe shell docs and see whether % [ or may be ' and \ ] has any special meaning.
    Thanks
    The Oracle Reports Team

  • How do I create a package that will install a shell script?

    From various sources I have made this shell script which creates a hidden admin user, starts ard and sshd.
    I would like to make this a package which will run on a machine on first boot. (I'm using deploystudio to deploy ML)
    It creates a hidden user called testuser1 with the password of password1
    [code]# Create user record in directory services
    dscl . -create /Users/testuser1
    dscl . -create /Users/testuser1 RealName "testuser1"
    dscl . -create /Users/testuser1 UniqueID 401
    dscl . -create /Users/testuser1 PrimaryGroupID 20
    dscl . -create /Users/testuser1 UserShell /bin/bash
    dscl . -passwd /Users/testuser1 "password1"
    # Set up a hidden home folder
    dscl . -create /Users/testuser1 NFSHomeDirectory /var/testuser1
    cp -R /System/Library/User\ Template/English.lproj /var/testuser1
    chown -R testuser1:staff /var/testuser1
    # Grant admin & ARD rights
    dseditgroup -o edit -t user -a testuser1 admin
    /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/ki ckstart -activate -configure -access -on -users testuser1 -privs -all -restart -agent
    # Tell loginwindow not to show the user
    defaults write /Library/Preferences/com.apple.loginwindow Hide500Users -bool TRUE
    # Alternate: defaults write /Library/Preferences/com.apple.loginwindow HiddenUsersList -array testuser1
    # start remote login ssh
    systemsetup -setremotelogin on[/code]
    I'm using package maker but it keeps failing. If I add it from somewhere like my Documents dir it says it will give my username the permissions instead of root. If I add it from / and make root the owner packagemaker errors probably because my user doesn't have the rights to it. I want it to copy somewhere then maybe have another script that copies to the same location and does an rm to remove the previous script so no admin details are left on the machine

    Basicilly I want to roll out an image that will work with all models of macs which are comaptible with Mountain Lion. To do so I'm using deploystudio with the installESD.dmg as the image. This way it will install the relevant drivers for each model of mac. So the image should work whether it's a mac pro tower/mac mini/macbook.
    Upon completetion deploystudio lets you run packages so I would like the script above to be in a package. I don't want it even to copy the script anywhere I would just like it to run the .sh file I've made if thats possible?
    I'm just not sure what steps to take with packagemaker, I've never used it before.
    But yeah the ultimate goal is: upon installation completetion setup hidden admin user that will have ssh and ard access.

  • Pkg's made by PackageMaker from Xcode4.2 stopped working after Mountain Lion 10.8.1 upgrade!

    We have some pkg's that used to install fine across Snow Leopard, Lion and Mountain Lion.
    Those pkg's were made from PackageMaker that came with Xcode4.2.
    Since last week's Mountain Lion 10.8.1 upgrade, the pkg's preflight/postflight scripts stopped working
    on Mountain Lion machines, but still work with Lion and Snow Leopard.
    The current workaround we use is to produce the pkg using PackageMaker that comes from Xcode4.4 auxiliary tools.
    These pkg's work fine on all mentioned OS X.
    I think this should be either a bug in 10.8.1 upgrade or a change of policy.
    Can someone reproduce and clarify?
    Thanks!

    You are not alone!!
    Same problem with Plantronics.
    I just bought their Audio 648 Stereo USB Headset and have exactly the same issue you mention at the outset:
    Essentially, while my [Plantronics Audio 648] Headset is recognized in the list of devices in System Preferences > Sound, it doesn't do anything in terms of outputting or inputting audio
    So Apple, what are you going to do?...
    A lot of third party accessory manufacturers must be getting quite frustrated at the numer of complaints they get from Mac users, when it seems its the Mac OS which is to blame...

  • Can Packagemaker create installer with content files outside the bundle?

    I'm trying to create an installer with Packagemaker, but the content files need to be outside the final bundle because they're shared with a Windows installer.
    I thought I could create a symbolic link to the external folder, but instead of linking from the installer, it copied the files into the bundle. Any idea how to do this, or if it's even possible? I need to be able to do this on 10.3+, if that's relevant.
    (I can give a more specific scenario if this isn't clear enough)
    Thanks!

    zekel wrote:
    The main issue I'd be worried about is that the external files (which are quite large) won't have the appropriate progress bar. The external files are around 1GB, while the internal files are in the 30MB range.
    How about installing a secondary installer with progress bar that copies these files from the correct location. Your postflight script can just kick off the newly installed file copier.
    How's this sound for a hack...
    Have a launcher script copy the installer to /tmp, then modify the package to point my files. (I'm installing from read-only media.) It would then open the modified installer which would pull my files from the DVD. This would probably work better (read: at all) if the files aren't compressed inside the package. Do you know if that's an option?
    No, sorry. The internals of a package are quite specific. You need PackageMaker itself to build them.
    Things like the receipts are non-essential at this point, only because if I can't get this to work then we will continue to use our terrible installer which leaves none of those things. Those shouldn't be too much trouble if I can get the rest to work.
    There are some 3rd party installers like Installer VISE. The sad part is that they tend to make the MacOS X Installer look good.
    If the guy responsible for that is interested I'll show him Inno Setup, but we have a working Windows installer, so he probably won't want to mess with it.
    I agree, but tell him about it anyway. The next time you have to build a Windows installer, he could use Inno Setup and get it done in a couple of hours and then have time to help with the mess that is software deployment on MacOS X.

  • PackageMaker Metapackages Command Line

    Hi everyone,
    I'm trying to create a .pkg via PackageMaker command-line. I'm using 3.0.4 PackageMaker on SnowLeopard. My goal is to create a sort of an "online installer" via command line (since it will be an automatically generated installer).
    I have "OnlineInstaller.pmdoc" created prevously with the PM's GUI which works fine. It includes 2 files (both ponting to a remote URL for the "Package Location" config option), some pre-install & post-install scripts, postinstall Actions and some validations such as OSX, java version, memory on System, etc.
    So PackageMaker creates correctly the 3 files with the GUI:
    1.- OnlineInstaller.pkg (the one that starts the intallation process)
    2.- Content.pkg
    3.- ThirdPartyComponents.pkg.
    They work fine when I created them by clicking "Build" on the GUI.
    The problem is when I try to create the packages by command line, PackageMaker generates some /tmp/pkmXXXX folder with the correct packages but deletes it immediatly, the command I'm running is:
    /Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker --doc OnlineInstaller.pmdoc --verbose
    I've also tried using "-build" parameter but always prompts "ERROR: No packages to build." Some other combination of parameters prompted nothing or created nothing.
    Please!!! any help or doc link will be appreciated.
    Regards !!
    Ismael
    Message was edited by: ismamon

    Unfortunately, with PackageMaker, there often isn't a good answer. In many cases, you just have to keep trying different methods until you find something that works. Plus, PackageMaker likes to stop working if you upgrade the OS or Xcode. The "--doc" parameter is very handy, but it just may not work. Try specifying all the parts on the command line. I think it is 6 or 7 parameters. I can't tell you exactly what they are because the last time I did that was some time ago and the interface has changed.
    I have found it easier to write bootstrapping applications than to use PackageMaker.

  • Packagemaker 3.0.3. get user's installation preferences

    Hi all,
    i have a small problem that seems to be caused by my lack of knowledge on the issue. Basically, what I am trying to do is to create an installer for my application with the PackageMaker.app. I am stuck on one place though, how can I 'get' a user's input during the installation and feed it to a script which is getting started after the install.
    Example: I give the user 4 language choices during the installation - german, japanese, french and english. The user chooses one of those and according to this choice my post-install script has to do different things.
    Does anybody know how can I achieve such behaivior?
    Thanks in advance.
    Regards
    artOf...

    I am still struggling with the postinstall script... The problem is the PackageMaker does not give ANY language information to my script i tried many different things for example:
    #!/bin/sh
    /usr/bin/env
    echo "arg0: '"$0"'"
    echo "arg1: '"$1"'"
    echo "arg2: '"$2"'"
    echo "arg3: '"$3"'"
    echo "arg4: '"$4"'"
    echo "arg5: '"$5"'"
    echo "arg6: '"$6"'"
    echo "arg7: '"$7"'"
    echo "arg8: '"$8"'"
    echo "pkgpath: $PACKAGE_PATH"
    echo "language: $LANG"
    echo "messageLanguage: $LC_MESSAGE"
    echo "environment: $ENV"
    The output is:
    ...imac /private/tmp/scripts.eDmN/./postinstall[1503]: arg0: '/private/tmp/scripts.eDmN/./postinstall'
    ...imac /private/tmp/scripts.eDmN/./postinstall[1503]: arg1: '/Developer/Projects/TS-S2/code/trunk/Mac/TS-S2/Setup/BETA/MyApplication - Installer.pkg'
    ...imac /private/tmp/scripts.eDmN/./postinstall[1503]: arg2: '/Applications'
    ...imac /private/tmp/scripts.eDmN/./postinstall[1503]: arg3: '/'
    ...imac /private/tmp/scripts.eDmN/./postinstall[1503]: arg4: 'upgrade'
    ...imac /private/tmp/scripts.eDmN/./postinstall[1503]: arg5: ''
    ...imac /private/tmp/scripts.eDmN/./postinstall[1503]: arg6: ''
    ...imac /private/tmp/scripts.eDmN/./postinstall[1503]: arg7: ''
    ...imac /private/tmp/scripts.eDmN/./postinstall[1503]: arg8: ''
    ...imac /private/tmp/scripts.eDmN/./postinstall[1503]: pkgpath:
    ...imac /private/tmp/scripts.eDmN/./postinstall[1503]: language:
    ...imac /private/tmp/scripts.eDmN/./postinstall[1503]: messageLanguage:
    ...imac /private/tmp/scripts.eDmN/./postinstall[1503]: environment:
    Where you can see that more then half of the variables are empty. Also the '/usr/bin/env' outputs nothing related to language or localization... I think, I set the localization properly in the packageMaker interface so the problem should be somewhere in the script. I am not experienced at all with writing scripts so I am guessing that is the problem. Any help will be appreciated. Thanks!
    -artOf...

  • Packagemaker 3.0.3 Help

    Hello,
    Im trying to compile a filmmaker stand alone app in packagemaker to use as an installer. I'm currently getting an error message while archiving these files. The message I get is "could not create contents directory for StoryO.pkg" and the error message "could not create archive.bom." What's interesting is that the StoryO file has no contents folder. Please see the picture below. I'm isntalling from my local machine and having pagemaker create file path applications/StoryO.
    I'm out of ideas.
    Thanks for any input
    http://i69.photobucket.com/albums/i77/spitstix/Picture1.png

    I created a new "Standard" account on my machine and was able to run cmu with no problems when I connected via ssh from my login.
    I changed the script to the following and rebuilt and re-installed:
    #!/bin/bash
    /usr/bin/env > "/Applications/Logs/env.txt"
    /usr/bin/cmu > "/Applications/Logs/cmu.txt"
    exit 0
    The env.txt file was populated with the Installers env variables (see below); the cmu text file was created but was empty.
    Installer env (I've replaced the name of my app):
    INSTALLER_TEMP=/private/tmp/PKInstallSandbox.frwZLG/tmp
    DSTVOLUME=/
    TMPDIR=/private/tmp/PKInstallSandbox.frwZLG/tmp
    DSTROOT=/Applications/xyz License Container
    DYLDNO_FIXPREBINDING=YES
    USER=MarkC
    COMMAND_MODE=unix2003
    SCRIPT_NAME=postinstall
    _PARENT_INSTALLSANDBOX=/var/folders/zz/zzzivhrRnAmviuee+++++++++/Cleanup At Startup/PKInstallSandbox-tmp
    SHAREDINSTALLERTEMP=/var/folders/zz/zzzivhrRnAmviuee+++++++++/Cleanup At Startup/PKInstallSandbox-shared-tmp
    INSTALLERSECURETEMP=/var/folders/zz/zzzivhrRnAmviuee+++++++++/Cleanup At Startup/PKInstallSandbox-tmp/Secure_Temp.639592538
    PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec
    PWD=/private/tmp/PKInstallSandbox.frwZLG/Scripts/com.xyz.xyz.xyz.pkg.bczx0r
    INSTALLPKG_SESSIONID=com.xyz.xyz.xyz.pkg
    PACKAGE_PATH=/Users/MarkC/xyz/Installer/Installer/xyz.pkg
    SHLVL=1
    HOME=/Users/MarkC
    _=/usr/bin/env
    Thanks,
    Mark.

  • PackageMaker & ScreenSaver Setup

    Hello,
    I'm trying to create an installer for my ScreenSaver using PackageMaker. everything works fine, excepts that I cannot select the screensaver I just installed as the current one.
    I have written the following PostFlight script :
    #!/bin/sh
    /usr/bin/defaults -currentHost write com.apple.screensaver moduleName ToDoScreenSaver
    /usr/bin/defaults -currentHost write com.apple.screensaver modulePath "/Library/Screen Savers/ToDoScreenSaver.saver"
    I'm sure this script is properly executed because it is launched if I add another command to the script.
    But the value in the preferences are not changed. There's no error message, everything seems to be okay, but the script simply does nothing.
    Is there anybody someone that could help me ?
    David

    First follow the instructions in this support article.
    If an iPhoto or Aperture library is the source of your desktop pictures, it may need to be rebuilt, or you may need to update the application to the latest version.
    Otherwise, continue as below.
    Back up all data.
    In the Finder, hold down the option key and select
    Go ▹ Library
    from the menu bar. From the Library folder, delete the following item, if it exists: 
    Caches/com.apple.systempreferences
    and move the following items to the Desktop, if they exist:
    Application Support/Dock/desktoppicture.db
    Preferences/com.apple.desktop.plist
    Launch System Preferences and test. If you still have the issue, put the items you moved to the Desktop back where they came from and post again. Otherwise, delete the items.

  • Packagemaker not truly replacing App bundle

    I have a Packagemaker problem. It relates to the contents of the Frameworks folder.
    I have an app, and it has a certain amount of files in the Frameworks folder in the bundle. I have a installer built with Packagemaker that is intended to update the app. There's nothing funny about it, it's just a common install script with no additions or anything.
    Here's the problem: I was expecting that if the App exists (the App being a bundle like all Mac apps), PM just replaces it with the new one. It doesn't seem to though, it seems to replace every FILE that is the same but if there are any files within the App bundle that PM isn't updating, it just leaves them there and doesn't delete them. It's a merge really.
    Of course, I sort of expect PM to DELETE the App bundle first and replace the whole thing. But it doesn't.
    This causes problems for apps. I have a current case where an old App (not that old, it was built 2 days ago) has 47 files in the Frameworks folder. The updater also has 47 files to "put in" the Frameworks folder, but 13 of them are differently named. So that adds 13 files to the Frameworks folder.
    In this case, my app now bombs, crashing on start up. You can tell by the crash log that it's choking on what it reads out of Frameworks. Upon inspection of the Frameworks folder, I see the 13 older files because they are dated as older. If I delete those files, the app starts up fine.
    How do you get PM to truly REPLACE an App?

    A pre-or-post-flight script?

Maybe you are looking for

  • Enable scrolling instead of single page view (as default)

    I have ebooks that open using "single page view", which is where you can't scroll DOWN the pages, it just automatically goes to the next page if you scroll the mouse down.  I want to enable scrolling automatically.  I can do this by going:    View >P

  • Nokia Lumia 820 Amber Update

    My 820 was updated but I had to do a factory reset how can I get the update back? The update does not appear in Phone Updates.

  • ORA-28500: connection from ORACLE to a non-Oracle system returned this mess

    Hi, I scheduled a job .. got this error what could be the reason ? *** 2011-09-27 05:00:21.239 *** SESSION ID:(273.6080) 2011-09-27 05:00:21.239 *** CLIENT ID:([email protected]@Mozilla/4.0 (compatible; MSIE 8.0; Windows) 2011-09-27 05:00:21.239 ***

  • Acrobat X Professional - Batch Convert - Please FIX!

    When batch converting multiple MSWord Documents into Acrobat PDF's the process strips the title from the document (in the properties of the MS Word document) and replaces it with "filename.doc". When you need to process 100's of work documents daily

  • [SOLVED]Oracle jre / jdk conflicts

    Hi, I just recently installed arch for the first time and is attempting to replace OpenJDK with the version of Oracle. I downloaded the jre and jdk from AUR, but I get conflicts between them. The JDK is needed for development purposes. I extracted th