Initial LanUps implementation and native installers
This commit is contained in:
commit
67a043c89b
66 files changed
+2870
No files matched your search
@@ -0,0 +1,11 @@
|
||||
<?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>local.lanups.agent</string>
|
||||
<key>ProgramArguments</key><array><string>/usr/local/libexec/lanups/agent/LanUps.Agent</string></array>
|
||||
<key>RunAtLoad</key><true/>
|
||||
<key>Umask</key><integer>63</integer>
|
||||
<key>KeepAlive</key><dict><key>SuccessfulExit</key><false/></dict>
|
||||
<key>StandardOutPath</key><string>/var/log/lanups-agent.log</string>
|
||||
<key>StandardErrorPath</key><string>/var/log/lanups-agent-error.log</string>
|
||||
</dict></plist>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?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>local.lanups.desktop</string>
|
||||
<key>ProgramArguments</key><array><string>/Applications/LanUps.app/Contents/MacOS/LanUps.Desktop</string><string>--tray</string></array>
|
||||
<key>RunAtLoad</key><true/>
|
||||
<key>LimitLoadToSessionType</key><string>Aqua</string>
|
||||
</dict></plist>
|
||||
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
data='/Library/Application Support/LanUps'
|
||||
token="$data/agent.token"
|
||||
install -d -m 0755 -o root -g wheel "$data"
|
||||
if [ ! -f "$token" ]; then LANUPS_AGENT_TOKEN="$token" /usr/local/libexec/lanups/agent/LanUps.Agent --provision; fi
|
||||
chmod 0600 "$token"
|
||||
|
||||
user=$(/usr/bin/stat -f '%Su' /dev/console)
|
||||
case "$user" in root|loginwindow|_mbsetupuser|'') user='';; esac
|
||||
if [ -n "$user" ]; then
|
||||
uid=$(id -u "$user")
|
||||
home=$(/usr/bin/dscl . -read "/Users/$user" NFSHomeDirectory | sed 's/^NFSHomeDirectory: //')
|
||||
case "$home" in /*) ;; *) echo 'Cannot determine the desktop account home' >&2; exit 1;; esac
|
||||
chmod -N "$token"
|
||||
chmod +a "user:$user allow read" "$token"
|
||||
sudo -u "$user" mkdir -p "$home/Library/LaunchAgents"
|
||||
sudo -u "$user" install -m 0644 /usr/local/libexec/lanups/local.lanups.desktop.plist "$home/Library/LaunchAgents/local.lanups.desktop.plist"
|
||||
fi
|
||||
|
||||
launchctl bootstrap system /Library/LaunchDaemons/local.lanups.agent.plist
|
||||
if [ -n "$user" ] && launchctl print "gui/$uid" >/dev/null 2>&1; then
|
||||
launchctl bootstrap "gui/$uid" "$home/Library/LaunchAgents/local.lanups.desktop.plist"
|
||||
fi
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
[ "${3:-/}" = / ] || { echo 'Install LanUps onto the running macOS system volume.' >&2; exit 1; }
|
||||
if launchctl print system/local.lanups.agent >/dev/null 2>&1; then launchctl bootout system/local.lanups.agent; fi
|
||||
user=$(/usr/bin/stat -f '%Su' /dev/console)
|
||||
case "$user" in root|loginwindow|_mbsetupuser|'') exit 0;; esac
|
||||
uid=$(id -u "$user")
|
||||
if launchctl print "gui/$uid/local.lanups.desktop" >/dev/null 2>&1; then launchctl bootout "gui/$uid/local.lanups.desktop"; fi
|
||||
Reference in new issue
Block a user