VirtualBox

source: vbox/trunk/src/VBox/Installer/darwin/VirtualBox/VBoxAutostartDarwin.sh@ 43302

Last change on this file since 43302 was 42384, checked in by vboxsync, 12 years ago

Autostart/darwin: bug fixes

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.6 KB
Line 
1#!/bin/sh
2
3#
4# Copyright (C) 2012 Oracle Corporation
5#
6# This file is part of VirtualBox Open Source Edition (OSE), as
7# available from http://www.virtualbox.org. This file is free software;
8# you can redistribute it and/or modify it under the terms of the GNU
9# General Public License (GPL) as published by the Free Software
10# Foundation, in version 2 as it comes in the "COPYING" file of the
11# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
12# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
13#
14
15#
16# Wrapper for the per user autostart daemon. Gets a list of all users
17# and starts the VMs.
18#
19
20function vboxStartAllUserVms()
21{
22 # Go through the list and filter out all users without a shell and a
23 # non existing home.
24 for user in `dscl . -list /Users`
25 do
26 HOMEDIR=`dscl . -read /Users/${user} | grep NFSHomeDirectory | sed 's/NFSHomeDirectory: //g'`
27 USERSHELL=`dscl . -read /Users/${user} | grep UserShell | sed 's/UserShell: //g'`
28
29 # Check for known home directories and shells for daemons
30 if [[ "${HOMEDIR}" == "/var/empty" || "${HOMEDIR}" == "/dev/null" || "${HOMEDIR}" == "/var/root"
31 || "${USERSHELL}" == "/usr/bin/false" || "${USERSHELL}" == "/dev/null" || "${USERSHELL}" == "/usr/sbin/uucico" ]]
32 then
33 continue
34 fi
35
36 # Start the daemon
37 su ${user} -c "/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostart --quiet --start --background --config ${1}"
38
39 done
40}
41
42case $1 in
43 --start) vboxStartAllUserVms ${2};;
44 *) echo "Unknown option ${1}";;
45esac
46
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette