Re-use .h code for both files. Add a license header.

Review URL: http://codereview.chromium.org/594006
This commit is contained in:
David McMahon 2010-02-09 11:44:09 -08:00
parent d00425ef50
commit b6fb706f38

View File

@ -1,5 +1,7 @@
#!/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 ]
@ -9,33 +11,26 @@ then
fi
echo "Enabling local account $1@gmail.com."
echo "Remove ../platform/pam_google/pam_localaccount.h and "
echo "../platform/pam_offline/pam_localaccount.h to disable."
echo "Remove these files to disable:"
cat <<EOF > ../platform/pam_google/pam_localaccount.h
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 chromeos_pam {
const char kLocalAccount[] = "$1@gmail.com";
}
#endif // CHROMEOS_PAM_LOCALACCOUNT_H_
EOF
cat <<EOF > ../platform/pam_offline/pam_localaccount.h
// 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 pam_offline {
namespace $namespace {
const char kLocalAccount[] = "$1@gmail.com";
}
#endif // CHROMEOS_PAM_LOCALACCOUNT_H_
EOF
done