blob: 18f9d61368856841f56984717585740b41236486 [file] [log] [blame]
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
description "Mark that the user has logged in"
author "chromium-os-dev@chromium.org"
# We're a task to ensure that the state change is fully marked
# before session manager calls this step done.
start on start-user-session
task
script
# TODO(sleffler) move to where cryptohome is created
# NB: must quote ~chronos in command sent over dbus; don't want it expanded.
shill_profile_dir=~chronos/shill
shill_profile_name='~chronos/shill'
shill_profile="$shill_profile_dir/shill.profile"
flimflam_profile_dir=~chronos/flimflam
flimflam_profile_name='~chronos/flimflam'
flimflam_profile="$flimflam_profile_dir/flimflam.profile"
if [ -f /home/chronos/.disable_shill ]; then
profile_dir="$flimflam_profile_dir"
profile_name="$flimflam_profile_name"
profile="$flimflam_profile"
else
profile_dir="$shill_profile_dir"
profile_name="$shill_profile_name"
profile="$shill_profile"
if [ -f "$flimflam_profile" -a ! -f "$shill_profile" ]; then
mkdir --mode=700 $profile_dir 2>/dev/null ||
logger -t "$UPSTART_JOB" "Failed to create user profile directory"
cp "$flimflam_profile" "$shill_profile" ||
logger -t "$UPSTART_JOB" "Failed to copy flimflam profile to shill"
fi
fi
if [ ! -d "$profile_dir" ]; then
mkdir --mode=700 $profile_dir 2>/dev/null ||
logger -t "$UPSTART_JOB" "Failed to create user profile directory"
fi
if [ ! -f "$profile" ]; then
dbus-send --system --dest=org.chromium.flimflam --print-reply / \
org.chromium.flimflam.Manager.CreateProfile string:$profile_name ||
logger -t "$UPSTART_JOB" "Failed to create $profile_name profile"
fi
# Push user's network profile
dbus-send --system --dest=org.chromium.flimflam --print-reply / \
org.chromium.flimflam.Manager.PushProfile string:$profile_name ||
logger -t "$UPSTART_JOB" "Failed to push $profile_name profile"
# The "logged-in" file is used by ACPI events to behave
# appropriately. The state directory is created earlier in
# session startup.
touch /var/run/state/logged-in
end script