find "$@" -print | sort | sed 's/ /\\ /g' | xargs "$TOOLDIR/tls" $TLS_ARGS
}
+get_testuid() {
+ id 2>/dev/null | sed 's/^[^0-9]*\([0-9][0-9]*\).*/\1/'
+}
+
check_perms() {
perms=`"$TOOLDIR/tls" "$1" | sed 's/^[-d]\(.........\).*/\1/'`
if test $perms = $2; then
eval "$1"
status=$?
if [ $status != 0 ]; then
- failed="YES";
+ failed="$failed status=$status"
fi
echo "-------------"
echo ""
( cd "$2" && rsync_ls_lR . ) > "$tmpdir/ls-from"
( cd "$3" && rsync_ls_lR . ) > "$tmpdir/ls-to"
- diff $diffopt "$tmpdir/ls-from" "$tmpdir/ls-to" || failed=YES
+ diff $diffopt "$tmpdir/ls-from" "$tmpdir/ls-to" || failed="$failed dir-diff"
echo "-------------"
echo "check how the files compare with diff:"
if [ "x$4" != x ]; then
echo " === Skipping (as directed) ==="
else
- diff -r $diffopt "$2" "$3" || failed=YES
+ diff -r $diffopt "$2" "$3" || failed="$failed file-diff"
fi
echo "-------------"
if [ -z "$failed" ] ; then
return 0
- else
- return 1
fi
+
+ echo "Failed: $failed"
+ return 1
}
logfile="$scratchdir/rsyncd.log"
hostname=`uname -n`
+ uid_setting='uid = 0'
+ gid_setting='gid = 0'
+ case `get_testuid` in
+ 0) ;;
+ *)
+ # Non-root cannot specify uid & gid settings
+ uid_setting="#$uid_setting"
+ gid_setting="#$gid_setting"
+ ;;
+ esac
+
cat >"$conf" <<EOF
# rsyncd configuration file autogenerated by $0
transfer logging = yes
exclude = ? foobar.baz
max verbosity = 4
-#uid = 0
-#gid = 0
+$uid_setting
+$gid_setting
[test-from]
path = $fromdir