flatcar-scripts/enable_localaccount.sh
Greg Spencer 798d75f3be This starts to fix the scripts so that they load from /usr/lib/crosutils
from within the chroot.

It also fixes a number of style issues.

It changes the meaning of cros_workon "list-all" to list all available
packages, and adds "list-live" to list all live packages.

It changes things that load chromeos-common.sh from the installer to
load it from /usr/lib/installer.

BUG=chromium-os:4230
TEST=synced, rebuilt chroot, made packages, made images, built chrome
from source, and wrote an image to a USB stick.

Review URL: http://codereview.chromium.org/6240018

Change-Id: I90c34420af1a64020402bafef8e9e77f56837c02
2011-02-01 22:04:49 -08:00

27 lines
853 B
Bash
Executable File

#!/bin/bash
# Copyright (c) 2010 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.
set -e
if [ -z $1 ]; then
echo "Usage: $0 localaccount_username [chroot_path]"
exit 1
fi
# Default chroot_path to its standard location
chroot_path=${2:-"../../chroot"}
echo "Enabling local account $1@gmail.com."
# Add CHROMEOS_LOCAL_ACCOUNT var to /etc/make.conf.user
echo "Setting CHROMEOS_LOCAL_ACCOUNT in $chroot_path/etc/make.conf.user..."
VAR_NAME=CHROMEOS_LOCAL_ACCOUNT
if grep -q ${VAR_NAME} $chroot_path/etc/make.conf.user; then
regex="s/${VAR_NAME}=.*/${VAR_NAME}=$1@gmail.com/"
sudo sed -i -e "${regex}" $chroot_path/etc/make.conf.user
else
sudo sh -c "echo ""${VAR_NAME}=$1@gmail.com"" >> \
$chroot_path/etc/make.conf.user"
fi