OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
3 set -e | 5 set -e |
4 | 6 |
5 if [ -z $1 ] | 7 if [ -z $1 ] |
6 then | 8 then |
7 echo "Usage: $0 localaccount_username" | 9 echo "Usage: $0 localaccount_username" |
8 exit 1 | 10 exit 1 |
9 fi | 11 fi |
10 | 12 |
11 echo "Enabling local account $1@gmail.com." | 13 echo "Enabling local account $1@gmail.com." |
12 echo "Remove ../platform/pam_google/pam_localaccount.h and " | 14 echo "Remove these files to disable:" |
13 echo "../platform/pam_offline/pam_localaccount.h to disable." | |
14 | 15 |
15 cat <<EOF > ../platform/pam_google/pam_localaccount.h | 16 for namespace in pam_google pam_offline |
| 17 do |
| 18 file=../platform/$namespace/pam_localaccount.h |
| 19 [ "$namespace" = pam_google ] && namespace=chromeos_pam |
| 20 |
| 21 echo $file |
| 22 |
| 23 cat <<EOF > $file |
16 // local username for Chrome OS pam | 24 // local username for Chrome OS pam |
17 // This file is auto-generated by enable_localaccount.sh | 25 // This file is auto-generated by enable_localaccount.sh |
18 | 26 |
19 #ifndef CHROMEOS_PAM_LOCALACCOUNT_H_ | 27 #ifndef CHROMEOS_PAM_LOCALACCOUNT_H_ |
20 #define CHROMEOS_PAM_LOCALACCOUNT_H_ | 28 #define CHROMEOS_PAM_LOCALACCOUNT_H_ |
21 | 29 |
22 namespace chromeos_pam { | 30 namespace $namespace { |
23 const char kLocalAccount[] = "$1@gmail.com"; | 31 const char kLocalAccount[] = "$1@gmail.com"; |
24 } | 32 } |
25 | 33 |
26 #endif // CHROMEOS_PAM_LOCALACCOUNT_H_ | 34 #endif // CHROMEOS_PAM_LOCALACCOUNT_H_ |
27 EOF | 35 EOF |
28 | 36 done |
29 cat <<EOF > ../platform/pam_offline/pam_localaccount.h | |
30 // local username for Chrome OS pam | |
31 // This file is auto-generated by enable_localaccount.sh | |
32 | |
33 #ifndef CHROMEOS_PAM_LOCALACCOUNT_H_ | |
34 #define CHROMEOS_PAM_LOCALACCOUNT_H_ | |
35 | |
36 namespace pam_offline { | |
37 const char kLocalAccount[] = "$1@gmail.com"; | |
38 } | |
39 | |
40 #endif // CHROMEOS_PAM_LOCALACCOUNT_H_ | |
41 EOF | |
OLD | NEW |