mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-07 21:16:57 +02:00
Add an echo to report the action from that part of the script. Review URL: http://codereview.chromium.org/1699015
51 lines
1.3 KiB
Bash
Executable File
51 lines
1.3 KiB
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."
|
|
echo "Remove these files to disable:"
|
|
|
|
for namespace in pam_google pam_offline
|
|
do
|
|
file=../platform/$namespace/pam_localaccount.h
|
|
[ "$namespace" = pam_google ] && namespace=chromeos_pam
|
|
|
|
echo $file
|
|
|
|
cat <<EOF > $file
|
|
// local username for Chrome OS pam
|
|
// This file is auto-generated by enable_localaccount.sh
|
|
|
|
#ifndef CHROMEOS_PAM_LOCALACCOUNT_H_
|
|
#define CHROMEOS_PAM_LOCALACCOUNT_H_
|
|
|
|
namespace $namespace {
|
|
const char kLocalAccount[] = "$1@gmail.com";
|
|
}
|
|
|
|
#endif // CHROMEOS_PAM_LOCALACCOUNT_H_
|
|
EOF
|
|
done
|
|
|
|
# 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
|