Shell script to install many PKG

How can I script:

Install all PKG in /foldername

Maybe write log somewhere too....

Thanks
LVL 1
PeteAsked:
Who is Participating?
 
serialbandConnect With a Mentor Commented:
The target is the disk volume, not a folder.  You can't specify a folder, only a disk volume.  Specifying -tgt / basically tells it to install it on the boot volume in the default location.

If you had a 2nd disk mounted on /Volumes/Untitled/ then you could specify -tgt /Volumes/Untitled/ and it would install it on the 2nd disk, in the corresponding "default" location on that disk.  If there's no disk volume mounted there, the command will fail with an error.
0
 
serialbandCommented:
You use the installer command to install a package.  /var/log/install.log is where all package installs logs are sent to.

installer -tgt / -pkg packagename.pkg

man installer to get the manual page.

I don't believe you can't change the install destination on the drive without modifying the package.  You can only change the installation disk.
If you want to manually extract the package, you'll have to use plutil to extract it into a folder to examine the contents.  It does not install a package.
plutil --expand /path/to/package.pkg /destination/directory
0
 
PeteAuthor Commented:
Ok thanks but but I need some kind of command

For each pkg in the folder, install the pkg.
0
 
serialbandCommented:
for package  in /path/to/*.pkg ; do installer -tgt / -pkg $package; done

Open in new window

0
 
PeteAuthor Commented:
Thanks, that makes sense. Would I need to think about /tgt, I just want them to install to their default  location..?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.