3 # Copyright (c) 1999-2001 Jason Gunthorpe <jgg@debian.org>
4 # Copyright (c) 2002-2003,2006 Ryan Murray <rmurray@debian.org>
5 # Copyright (c) 2004-2005 Joey Schulze <joey@infodrom.org>
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 # Without effect on the commandline
24 if [ -z "$TERM" -o "$TERM" = "dumb" ]
31 PATH=/sbin:/usr/sbin:/bin:/usr/bin
35 cd /var/lib/misc || cd /var/state/glibc/ || cd /var/db/
36 lockfile -r 1 -l 3600 lock
37 trap "rm -f lock" exit
48 rsync ${verbose} -e ssh -rp "${udhost}/var/cache/userdir-ldap/hosts/$HOST" .
50 makedb "$HOST/passwd.tdb" -o passwd.db.t
51 if [ -s "$HOST/shadow.tdb" ]
53 (umask 027 && makedb "$HOST/shadow.tdb" -o shadow.db.t)
54 chown root.shadow shadow.db.t
55 chmod 0640 shadow.db.t
56 mv -f shadow.db.t shadow.db
58 makedb "$HOST/group.tdb" -o group.db.t
59 mv -f passwd.db.t passwd.db
60 mv -f group.db.t group.db
61 for a in $HOST/ssh-rsa-shadow $HOST/ssh_known_hosts; do
64 ln -sf `pwd -P`/ssh-rsa-shadow /etc/ssh
65 ln -sf `pwd -P`/ssh_known_hosts /etc/ssh
67 if [ -x /usr/bin/dchroot ]; then
68 CHROOTS=`dchroot --listpaths`
70 if [ -x "$c/usr/bin/makedb" ]
73 test ! -d "$c/var/lib/misc/$HOST" || mkdir -p "$c/var/lib/misc/$HOST"
75 rsync -a ${verbose} $HOST/group.tdb $HOST/passwd.tdb $HOST/ssh* "$c/var/lib/misc/$HOST"
77 test ! -f "$c/var/lib/misc/$HOST/shadow.tdb" || rm -f "$c/var/lib/misc/$HOST/shadow.tdb"
78 test ! -f "$c/var/lib/misc/shadow.db" || rm -f "$c/var/lib/misc/shadow.db"
80 chroot "$c" makedb "/var/lib/misc/$HOST/passwd.tdb" -o /var/lib/misc/passwd.db.t
81 chroot "$c" makedb "/var/lib/misc/$HOST/group.tdb" -o /var/lib/misc/group.db.t
82 mv -f "$c/var/lib/misc/passwd.db.t" "$c/var/lib/misc/passwd.db"
83 mv -f "$c/var/lib/misc/group.db.t" "$c/var/lib/misc/group.db"
84 ln -sf "$HOST/ssh_known_hosts" "$c/var/lib/misc/"
85 ln -sf ../../var/lib/misc/ssh_known_hosts "$c/etc/ssh"
90 if [ -d "/etc/exim4" -a -e "$HOST/bsmtp" ]; then
91 if perl -e 'exit !((stat "/etc/exim4/bsmtp")[9] < time()-3600)'; then
92 cp "$HOST/bsmtp" /etc/exim4/bsmtp
95 if [ -d "/etc/postfix" -a -f "$HOST/forward-alias" ]; then
96 sed -e 's/:/@debian.org/' $HOST/forward-alias > /etc/postfix/debian
97 /usr/sbin/postmap hash:/etc/postfix/debian < /etc/postfix/debian || true