janthenat
New Member.
1237 views

Install files to current user home directory

Attempting to build a bundle that simply installs a file to the currently logged in user's home directory. Under "Install" I'm using "Install File(s)" and I want to place the file at /Users/<username>/Library/Application Support/Oracle/Java/Deployment/security/exception.sites. So I specified the following path:

"$HOME/Library/Application Support/Oracle/Java/Deployment/security/exception.sites"

It is clear that this process does not understand the standard variable "$HOME" which directs to the currently logged in user's local home directory. On the Windows side we can use variables like "${LocalAppData}" to get to the current user's AppData folder, is there something similar available for the Mac? Maybe the question has to do with exactly how the Install File(s) process works for Mac clients? What command is being run, and by what user? How can I do this properly? Sadly the documentation is not much help.
Labels (1)
0 Likes
7 Replies
Micro Focus Expert
Micro Focus Expert

Re: Install files to current user home directory

Since the "Install Files" option does not allow you to specify user, it is almost certainly run as ROOT, which means even if you got $HOME working, it would not be the correct home.

I suspect you need 2 actions...

#1 - Install File to a Fixed Location such as /tmp/JavaTemp/exception.sites
#2 -Script Action set to run as Logged on User, and have some bash script copy it.

Note: I'm not really a MAC Person, so I won't be much help beyond my 2 cents above.....


janthenat;2488370 wrote:
Attempting to build a bundle that simply installs a file to the currently logged in user's home directory. Under "Install" I'm using "Install File(s)" and I want to place the file at /Users/<username>/Library/Application Support/Oracle/Java/Deployment/security/exception.sites. So I specified the following path:

"$HOME/Library/Application Support/Oracle/Java/Deployment/security/exception.sites"

It is clear that this process does not understand the standard variable "$HOME" which directs to the currently logged in user's local home directory. On the Windows side we can use variables like "${LocalAppData}" to get to the current user's AppData folder, is there something similar available for the Mac? Maybe the question has to do with exactly how the Install File(s) process works for Mac clients? What command is being run, and by what user? How can I do this properly? Sadly the documentation is not much help.
0 Likes
asudheer Absent Member.
Absent Member.

Re: Install files to current user home directory

A little different variant of what Craig suggested could be

How about Install Files to a stage folder followed by Copy Files action from stage folder to user folder, since this action can be run as user.

I haven't tried this myself yet...
0 Likes
janthenat
New Member.

Re: Install files to current user home directory

Here is how I decided to accomplish the goal via Bundle, Actions, Launch:

1. Install file to /tmp/exception.sites
2. Run Script - "mkdir -p $HOME/Library/Application\ Support/Oracle/Java/Deployment/security/" (Run as logged in user, creates the directory structure if it does not exist)
3. Run Script - "cp /tmp/exception.sites $HOME/Library/Application\ Support/Oracle/Java/Deployment/security/exception.sites" (Run as logged in user, copies the file from /tmp)

This method works, now the only problem is getting the bundle to run at user login. I'm open to ideas since we can't use Launch Schedule, Event, User Login for Macs. I'm currently using Launch Schedule, Recurring, Device Refresh... but this is not good enough in my opinion. Is there a better way?
0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Install files to current user home directory

#1 - I know NOTHING about MACs. The Last Time I used one regularly, it was still Monochrome....

That being said...it seems you can set logon items to run here.....
https://eclecticlight.co/2018/05/22/running-at-startup-when-to-use-a-login-item-or-a-launchagent-launchdaemon/ seems to show how to add
Assign a script that runs on refresh to add a "zac bln" command from here.
This way "zac bln" would run on user logon to launch your desired bundle.

Did I say I know nothing about MACs?

A Little Googling and Too Much Sugar in My Coffee to think up crazy Ideas...
Maybe it will work for you....maybe you will roll your eyes so much they get suck....hopefully not the later....



janthenat;2498089 wrote:
Here is how I decided to accomplish the goal via Bundle, Actions, Launch:

1. Install file to /tmp/exception.sites
2. Run Script - "mkdir -p $HOME/Library/Application\ Support/Oracle/Java/Deployment/security/" (Run as logged in user, creates the directory structure if it does not exist)
3. Run Script - "cp /tmp/exception.sites $HOME/Library/Application\ Support/Oracle/Java/Deployment/security/exception.sites" (Run as logged in user, copies the file from /tmp)

This method works, now the only problem is getting the bundle to run at user login. I'm open to ideas since we can't use Launch Schedule, Event, User Login for Macs. I'm currently using Launch Schedule, Recurring, Device Refresh... but this is not good enough in my opinion. Is there a better way?
0 Likes
janthenat
New Member.

Re: Install files to current user home directory

CRAIGDWILSON;2498102 wrote:
#1 - I know NOTHING about MACs. The Last Time I used one regularly, it was still Monochrome....


Well, the first thing to know is that they're "Macs", even though they do have "MACs" ;^) (sorry, couldn't help myself)
0 Likes
Micro Focus Expert
Micro Focus Expert

Re: Install files to current user home directory

Jokes always appreciated.....



janthenat;2498279 wrote:
Well, the first thing to know is that they're "Macs", even though they do have "MACs" ;^) (sorry, couldn't help myself)
0 Likes
janthenat
New Member.

Re: Install files to current user home directory

CRAIGDWILSON;2498102 wrote:
That being said...it seems you can set logon items to run here.....
https://eclecticlight.co/2018/05/22/running-at-startup-when-to-use-a-login-item-or-a-launchagent-launchdaemon/ seems to show how to add
Assign a script that runs on refresh to add a "zac bln" command from here.
This way "zac bln" would run on user logon to launch your desired bundle.


I'm trying to think through the idea of using a LaunchAgent in conjunction with a bundle to cause a bundle to launch at login. Seems like you would just have to include an action to Install a LaunchAgent containing the "zac bln ..." command. It would need look something like below, and be named to match like "com.company.BundleName.plist". The trick is putting it in the right place for the right purpose. Placing it in /Library/LaunchAgents/... will cause it to run for each user when they login. If you only want it to run for specific user(s)/usergroup it will surely be more complicated.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">
<dict>
<key>Label</key>
<string>com.company.BundleName</string>
<key>ProgramArguments</key>
<array>
<string>/opt/novell/zenworks/bin/zac</string>
<string>bln "BundleName"</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.