chilcote / outset

Automatically process packages, profiles, and scripts during boot, login, or on demand.
572 stars 58 forks source link

Home directory during privileged-every #54

Closed vikaskedia closed 6 years ago

vikaskedia commented 6 years ago

My goal is to stop osx from reopening apps when a user logs in. I am using the concepts from: https://apple.stackexchange.com/questions/230719/how-to-disable-app-relaunch-and-window-restore-in-el-capitan-on-reboot

I have tried 2 options and both did not work:

Option 1:

Inside outset/login-privileged-every/login-privileged-every.sh I have:

chown root ~/Library/Preferences/ByHost/com.apple.loginwindow chmod 000 ~/Library/Preferences/ByHost/com.apple.loginwindow

The error message I get is:

2017-12-31 05:53:41 PM - INFO: Processing /usr/local/outset/login-privileged-every/login-privileged-every.sh 2017-12-31 05:53:41 PM - ERROR: Failure processing /usr/local/outset/login-privileged-every/login-privileged-every.sh: chown: /var/root/Library/Preferences/ByHost/com.apple.loginwindow: No such file or directory chmod: /var/root/Library/Preferences/ByHost/com.apple.loginwindow: No such file or directory

Option 2:

Inside outset/login-privileged-every/login-privileged-every.sh I have:

chown root $HOME/Library/Preferences/ByHost/com.apple.loginwindow chmod 000 $HOME/Library/Preferences/ByHost/com.apple.loginwindow

2018-01-01 01:25:45 PM - INFO: Processing /usr/local/outset/login-privileged-every/login-privileged-every.sh 2018-01-01 01:25:45 PM - ERROR: Failure processing /usr/local/outset/login-privileged-every/login-privileged-every.sh: chown: /var/root/Library/Preferences/ByHost/com.apple.loginwindow: No such file or directory chmod: /var/root/Library/Preferences/ByHost/com.apple.loginwindow: No such file or directory

How do I make the script find out the users home directory?

chilcote commented 6 years ago

Good info here: https://macmule.com/2014/11/19/how-to-get-the-currently-logged-in-user-in-a-more-apple-approved-way/

vikaskedia commented 6 years ago

That worked !!

Tx