projects
/
mirror
/
userdir-ldap.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ud-generate: handle individual ssh keys
[mirror/userdir-ldap.git]
/
ud-replicate
diff --git
a/ud-replicate
b/ud-replicate
index
26818ed
..
2e99d75
100755
(executable)
--- a/
ud-replicate
+++ b/
ud-replicate
@@
-1,8
+1,9
@@
-#! /bin/sh
+#! /bin/
ba
sh
# Copyright (c) 1999-2001 Jason Gunthorpe <jgg@debian.org>
# Copyright (c) 2002-2003,2006 Ryan Murray <rmurray@debian.org>
# Copyright (c) 2004-2005 Joey Schulze <joey@infodrom.org>
# Copyright (c) 1999-2001 Jason Gunthorpe <jgg@debian.org>
# Copyright (c) 2002-2003,2006 Ryan Murray <rmurray@debian.org>
# Copyright (c) 2004-2005 Joey Schulze <joey@infodrom.org>
+# Copyright (c) 2008 Peter Palfrader <peter@palfrader.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@
-24,10
+25,19
@@
set -e
if [ -z "$TERM" -o "$TERM" = "dumb" ]
then
exec > /dev/null 2>&1
if [ -z "$TERM" -o "$TERM" = "dumb" ]
then
exec > /dev/null 2>&1
+ sleep $(( $RANDOM % 120 ))
else
verbose=-v
fi
else
verbose=-v
fi
+tempdir=''
+
+cleanup ()
+{
+ rm -f lock
+ rm -rf $tempdir
+}
+
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
HOST=`hostname -f`
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
HOST=`hostname -f`
@@
-36,10
+46,10
@@
LOCALSYNCON=`ud-config localsyncon`;
cd /tmp/
cd /var/lib/misc || cd /var/state/glibc/ || cd /var/db/
lockfile -r 1 -l 3600 lock
cd /tmp/
cd /var/lib/misc || cd /var/state/glibc/ || cd /var/db/
lockfile -r 1 -l 3600 lock
-trap
"rm -f lock"
exit
+trap
cleanup
exit
case $HOST in
case $HOST in
-
*$LOCALSYNCON*
)
+
$LOCALSYNCON
)
udhost=
;;
*)
udhost=
;;
*)
@@
-47,7
+57,7
@@
case $HOST in
;;
esac
;;
esac
-rsync ${verbose} -e
ssh
-rp "${udhost}/var/cache/userdir-ldap/hosts/$HOST" .
+rsync ${verbose} -e
'ssh -i /etc/ssh/ssh_host_rsa_key -o PreferredAuthentications=publickey'
-rp "${udhost}/var/cache/userdir-ldap/hosts/$HOST" .
makedb "$HOST/passwd.tdb" -o passwd.db.t
if [ -s "$HOST/shadow.tdb" ]
makedb "$HOST/passwd.tdb" -o passwd.db.t
if [ -s "$HOST/shadow.tdb" ]
@@
-66,6
+76,15
@@
done
ln -sf `pwd -P`/ssh-rsa-shadow /etc/ssh
ln -sf `pwd -P`/ssh_known_hosts /etc/ssh
ln -sf `pwd -P`/ssh-rsa-shadow /etc/ssh
ln -sf `pwd -P`/ssh_known_hosts /etc/ssh
+if [ -e ssh-keys.tar.gz ]; then
+ export TMPDIR='/tmp/'
+ tempdir=$(mktemp -d)
+ old=$(pwd -P)
+ cd $tempdir && tar -xvf $old/ssh-keys.tar.gz
+ mkdir userkeys 2> /dev/null || true
+ rsync -av --delete-after $tempdir/ userkeys/
+fi
+
if [ -x /usr/bin/dchroot ]; then
CHROOTS=`dchroot --listpaths`
for c in $CHROOTS; do
if [ -x /usr/bin/dchroot ]; then
CHROOTS=`dchroot --listpaths`
for c in $CHROOTS; do