1 | #!/bin/sh |
---|
2 | # Copyright © 2005-2009 Roger Leigh <rleigh@debian.org> |
---|
3 | # |
---|
4 | # schroot is free software: you can redistribute it and/or modify it |
---|
5 | # under the terms of the GNU General Public License as published by |
---|
6 | # the Free Software Foundation, either version 3 of the License, or |
---|
7 | # (at your option) any later version. |
---|
8 | # |
---|
9 | # schroot is distributed in the hope that it will be useful, but |
---|
10 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
12 | # General Public License for more details. |
---|
13 | # |
---|
14 | # You should have received a copy of the GNU General Public License |
---|
15 | # along with this program. If not, see |
---|
16 | # <http://www.gnu.org/licenses/>. |
---|
17 | # |
---|
18 | ##################################################################### |
---|
19 | |
---|
20 | set -e |
---|
21 | |
---|
22 | if [ -f "$CHROOT_SCRIPT_CONFIG" ]; then |
---|
23 | . "$CHROOT_SCRIPT_CONFIG" |
---|
24 | elif [ "$2" = "ok" ]; then |
---|
25 | echo "script-config file '$CHROOT_SCRIPT_CONFIG' does not exist" |
---|
26 | exit 1 |
---|
27 | fi |
---|
28 | |
---|
29 | if [ "$AUTH_VERBOSITY" = "verbose" ]; then |
---|
30 | VERBOSE="--verbose" |
---|
31 | fi |
---|
32 | |
---|
33 | # Copy NSS database from host to chroot |
---|
34 | # $1: database name |
---|
35 | # $2: destination file name |
---|
36 | dup_nss() |
---|
37 | { |
---|
38 | if [ "$AUTH_VERBOSITY" = "verbose" ]; then |
---|
39 | echo "Copying $1 database to $2" |
---|
40 | fi |
---|
41 | getent "$1" > "$2" |
---|
42 | } |
---|
43 | |
---|
44 | if [ $1 = "setup-start" ] || [ $1 = "setup-recover" ]; then |
---|
45 | |
---|
46 | if [ -n "$NSSDATABASES" ]; then |
---|
47 | if [ -f "$NSSDATABASES" ]; then |
---|
48 | while read db; do |
---|
49 | dup_nss "$db" "${CHROOT_PATH}/etc/$db" |
---|
50 | done < "$NSSDATABASES" |
---|
51 | else |
---|
52 | echo "nssdatabases file '$NSSDATABASES' does not exist" |
---|
53 | exit 1 |
---|
54 | fi |
---|
55 | fi |
---|
56 | |
---|
57 | fi |
---|
58 | |
---|