Import from samosa: Provide a space for proper questioning
[mirror/userdir-ldap.git] / ud-replicate
index 42934c4..8968aa1 100755 (executable)
@@ -2,14 +2,25 @@
 # The rsync source host needs to be customized..
 set -e
 
-exec > /dev/null 2>&1
+# Without effect on the commandline
+if [ -z "$PS1" -o "$TERM" ]
+then
+    exec > /dev/null 2>&1
+    verbose=-v
+fi
 
 HOST=`hostname -f`
 cd /tmp/
 cd /var/lib/misc || cd /var/state/glibc/ || cd /var/db/
 lockfile -r 1 -l 3600 lock
 trap "rm -f lock" exit
-rsync -e ssh -rp "sshdist@samosa:/var/cache/userdir-ldap/hosts/$HOST" .
+case $HOST in
+*samosa*)
+    udhost=;;
+*)
+    udhost="sshdist@samosa:";;
+esac
+rsync ${verbose} -e ssh -rp "${udhost}/var/cache/userdir-ldap/hosts/$HOST" .
 makedb "$HOST/passwd.tdb" -o passwd.db.t
 (umask 027 && makedb "$HOST/shadow.tdb" -o shadow.db.t)
 chown root.shadow shadow.db.t; chmod 0640 shadow.db.t
@@ -41,5 +52,5 @@ if [ -d "/etc/exim" -a -e "$HOST/bsmtp" ]; then
 fi
 if [ -d "/etc/postfix" -a -f "$HOST/forward-alias" ]; then
        sed -e 's/:/@debian.org/' $HOST/forward-alias > /etc/postfix/debian
-       postmap sdbm:/etc/postfix/debian < /etc/postfix/debian &> /dev/null || true
+       /usr/sbin/postmap hash:/etc/postfix/debian < /etc/postfix/debian || true
 fi