56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# Copyright (C) 2012 Oracle Corporation
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# This file is part of VirtualBox Open Source Edition (OSE), as
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# available from http://www.virtualbox.org. This file is free software;
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# you can redistribute it and/or modify it under the terms of the GNU
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# General Public License (GPL) as published by the Free Software
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# Foundation, in version 2 as it comes in the "COPYING" file of the
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# Wrapper for the per user autostart daemon. Gets a list of all users
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync# and starts the VMs.
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync # Go through the list and filter out all users without a shell and a
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync HOMEDIR=`dscl . -read /Users/${user} | grep NFSHomeDirectory | sed 's/NFSHomeDirectory: //g'`
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync USERSHELL=`dscl . -read /Users/${user} | grep UserShell | sed 's/UserShell: //g'`
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync # Check for known home directories and shells for daemons
e366e4992f5d81a0b93412e10d2ef9dc06f930edvboxsync if [[ "${HOMEDIR}" == "/var/empty" || "${HOMEDIR}" == "/dev/null" || "${HOMEDIR}" == "/var/root"
56a353f79df8b3f9ae8d5ff5adc1d373524e3ad4vboxsync || "${USERSHELL}" == "/usr/bin/false" || "${USERSHELL}" == "/dev/null" || "${USERSHELL}" == "/usr/sbin/uucico" ]]
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync su ${user} -c "/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart --quiet --start --background --config ${CONFIG}"
0073ab680739b243ea5b24de5e7d016ee87bab94vboxsync su ${user} -c "/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart --quiet --stop --config ${CONFIG}"