various fixes
[distro-setup] / rootsshsync
index ebfc80216b6e293e9162e5c2f3ec825048f166ad..d3e860b30c0109c38a32f78f0d2a32641d0fa921 100755 (executable)
@@ -19,13 +19,12 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 [[ $EUID == 0 ]] || exec sudo "$BASH_SOURCE" "$@"
 
 if test -e /q/root/.ssh; then
-    export LNF_VERBOSE=true
-    if ! /a/exe/lnf /q/root/.ssh /root > /tmp/lnf_log; then
-        cat /tmp/lnf_log
-    fi
+    /a/exe/lnf /q/root/.ssh /root
 else
     mkdir -p /root/.ssh
     chmod 700 /root/.ssh
 fi
-cp -rL $(eval echo ~${SUDO_USER:-$USER})/.ssh/* /root/.ssh
+# -t times, so it won't rewrite the file every time,
+# -L resolve links
+rsync -rtL $(eval echo ~${SUDO_USER:-$USER})/.ssh /root
 chown -R root:root /root/.ssh