Install pkg in user context

New Contributor III

We have an issue with Polycom RPD PKG 3.9, since it has to install in user context and not as root. User does not need admin permissions since it will install into ~/Applications. Anyone installed a package in user context already and has some idea on how to go about it?



Honored Contributor

You could put the package in a .dmg that places the .pkg in /tmp, then use a script to run (set as AFTER) as the current user to install the pkg. Something like this:

currentuser=`stat -f "%Su" /dev/console`
sudo -u $currentuser installer -pkg  /tmp/Polycomblahblah.pkg -allowUntrusted -target /

You may need to experiment with it to make sure that particular package will run like this.

Valued Contributor II

Running anything as a user instead of root is a VFAQ here. In your case, there's a couple ways to do it. If I had this task, I would do it this way.

1- create a script to run the installer and save it as /usr/local/anniwayy/

#run the installer
installer -pkg /usr/local/anniwayy/PolycomRPD.pkg -target /
#remove the launchAgent so it won't run again
rm -f /Library/LaunchAgents/edu.anniwayy.installPolycom.plist
#remove the script to clean up
rm -rf  /usr/local/anniwayy/PolycomRPD.pkg
#remove the package
rm -f /usr/local/anniwayy/

2- create a LaunchAGENT to run the installer in /Library/LaunchAgents/edu.anniwayy.installPolycom.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

3- Set the permissions right.

chmod +x /usr/local/anniwayy/
chown root:wheel  /Library/LaunchAgents/edu.anniwayy.installPolycom.plist
chmod 644 /Library/LaunchAgents/edu.anniwayy.installPolycom.plist

4- Put those three items into a package with composer. Then the next user that logs into the computer will have Polycomm installed.

Valued Contributor

Use outset

1.Place script in login-once/login-every folder

Valued Contributor III

Does anyone know why, no matter what package I supply (even one I created that does nothing and does not require root or admin), the installer command tells me I have to be running as root? I don't see how these instructions would work unless I am missing something here.