Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions maybe-make-man
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ force_flagfile="$srcdir/.md2man-force"
if [ ! -f "$flagfile" ]; then
# We test our smallest manpage just to see if the python setup works.
if "$srcdir/md-convert" --test "$srcdir/rsync-ssl.1.md" >/dev/null 2>&1; then
touch "$flagfile"
touch "$flagfile"
else
outname=$(basename "$inname" .md)
if [ -f "$outname" ]; then
exit 0
elif [ -f "$srcdir/$outname" ]; then
echo "Copying $srcdir/$outname"
cp -p "$srcdir/$outname" .
exit 0
else
echo "ERROR: $outname cannot be created."
if [ -f "$HOME/build_farm/build_test.fns" ]; then
exit 0 # No exit errorno to avoid a build failure in the samba build farm
else
exit 1
fi
fi
outname=$(basename "$inname" .md)
if [ -f "$outname" ]; then
exit 0
elif [ -f "$srcdir/$outname" ]; then
echo "Copying $srcdir/$outname"
cp -p "$srcdir/$outname" .
exit 0
else
echo "ERROR: $outname cannot be created."
if [ -f "$HOME/build_farm/build_test.fns" ]; then
exit 0 # No exit errorno to avoid a build failure in the samba build farm
else
exit 1
fi
fi
fi
fi

Expand Down
16 changes: 8 additions & 8 deletions mkgitver
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ if test -d "$srcdir/.git" || test -f "$srcdir/.git"; then
# quoted value. Empty (define missing/unmatched) -> leave RSYNC_GITVER unset.
rsyncver=$(sed -n 's/^[[:space:]]*#[[:space:]]*define[[:space:]][[:space:]]*RSYNC_VERSION[[:space:]][[:space:]]*"\([^"]*\)".*/\1/p' "$srcdir/version.h")
if [ -n "$gitsha" ] && [ -n "$rsyncver" ]; then
gitver="$rsyncver-g$gitsha"
echo "#define RSYNC_GITVER \"$gitver\"" >git-version.h.new
if ! diff git-version.h.new git-version.h >/dev/null; then
echo "Updating git-version.h"
mv git-version.h.new git-version.h
else
rm git-version.h.new
fi
gitver="$rsyncver-g$gitsha"
echo "#define RSYNC_GITVER \"$gitver\"" >git-version.h.new
if ! diff git-version.h.new git-version.h >/dev/null; then
echo "Updating git-version.h"
mv git-version.h.new git-version.h
else
rm git-version.h.new
fi
fi
fi
28 changes: 14 additions & 14 deletions packaging/prep-auto-dir
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@ auto_top='auto-build-save'
if test -d $auto_top && test -d .git; then
desired_branch=$(git rev-parse --abbrev-ref HEAD | tr / %)
if test "$desired_branch" = HEAD; then
echo "ERROR: switch to the right build dir manually when in detached HEAD mode." 1>&2
exit 1
echo "ERROR: switch to the right build dir manually when in detached HEAD mode." 1>&2
exit 1
fi
auto_dir="$auto_top/$desired_branch"
if test -d build; then
cur_branch=$(readlink build/.branch)
cur_branch=$(readlink build/.branch)
else
cur_branch='/'
cur_branch='/'
fi
if test "$desired_branch" != "$cur_branch"; then
if test "$cur_branch" != /; then
rm -f "$auto_top/$cur_branch"
mv build "$auto_top/$cur_branch"
fi
test -d "$auto_dir" || mkdir "$auto_dir"
test -h "$auto_dir/.branch" || ln -s "$desired_branch" "$auto_dir/.branch"
mv "$auto_dir" build
ln -s ../build "$auto_dir"
if test "$cur_branch" != /; then
rm -f "$auto_top/$cur_branch"
mv build "$auto_top/$cur_branch"
fi
test -d "$auto_dir" || mkdir "$auto_dir"
test -h "$auto_dir/.branch" || ln -s "$desired_branch" "$auto_dir/.branch"
mv "$auto_dir" build
ln -s ../build "$auto_dir"
fi
if test ! -h Makefile; then
rm -f Makefile
ln -s packaging/auto-Makefile Makefile
rm -f Makefile
ln -s packaging/auto-Makefile Makefile
fi
echo "$desired_branch"
fi
4 changes: 2 additions & 2 deletions packaging/smart-make
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ if diff configure.sh configure.sh.old >/dev/null 2>&1; then
else
echo "configure.sh has CHANGED."
if test -f config.status; then
./config.status --recheck
./config.status --recheck
else
$srcdir/configure
$srcdir/configure
fi
fi

Expand Down
58 changes: 29 additions & 29 deletions prepare-source
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@ fi
if test "$dir" = '.'; then
branch=$(packaging/prep-auto-dir) || exit 1
if test "$branch" != ""; then
cd build || exit 1
dir=..
cd build || exit 1
dir=..
fi
fi

if test "$dir" != '.'; then
for lnk in configure.ac m4; do
if test ! -h $lnk; then
rm -f $lnk # Just in case
ln -s "$dir/$lnk" $lnk
fi
if test ! -h $lnk; then
rm -f $lnk # Just in case
ln -s "$dir/$lnk" $lnk
fi
done
for fn in configure.sh config.h.in aclocal.m4; do
test ! -f $fn && test -f "$dir/$fn" && cp -p "$dir/$fn" $fn
test ! -f $fn && test -f "$dir/$fn" && cp -p "$dir/$fn" $fn
done
fi

Expand All @@ -42,30 +42,30 @@ fi

for action in "${@}"; do
case "$action" in
build|make)
make -f "$dir/prepare-source.mak"
;;
fetch|fetchgen)
if test "$action" = fetchgen; then
match='*'
else
match='[ca]*'
fi
"$dir"/rsync-ssl -iipc --no-motd "rsync://download.samba.org/rsyncftp/generated-files/$match" ./
test $? != 0 && continue
sleep 1 # The following files need to be newer than aclocal.m4
touch configure.sh config.h.in
;;
fetchSRC)
./rsync-ssl -iipr --no-motd --exclude=/.git/ rsync://download.samba.org/ftp/pub/unpacked/rsync/ .
;;
*)
echo "Unknown action: $action"
exit 1
;;
build|make)
make -f "$dir/prepare-source.mak"
;;
fetch|fetchgen)
if test "$action" = fetchgen; then
match='*'
else
match='[ca]*'
fi
"$dir"/rsync-ssl -iipc --no-motd "rsync://download.samba.org/rsyncftp/generated-files/$match" ./
test $? != 0 && continue
sleep 1 # The following files need to be newer than aclocal.m4
touch configure.sh config.h.in
;;
fetchSRC)
./rsync-ssl -iipr --no-motd --exclude=/.git/ rsync://download.samba.org/ftp/pub/unpacked/rsync/ .
;;
*)
echo "Unknown action: $action"
exit 1
;;
esac
if test $? = 0; then
exit
exit
fi
done

Expand Down
80 changes: 40 additions & 40 deletions support/instant-rsyncd
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,31 @@ echo
echo "This will setup an rsync daemon in $dir"

if [ $# = 0 ]; then
IFS='' read -r -p 'Module name to create (or return to exit): ' module
[ ! "$module" ] && exit
IFS='' read -r -p 'Module name to create (or return to exit): ' module
[ ! "$module" ] && exit
else
module="$1"
shift
module="$1"
shift
fi

if [ $# = 0 ]; then
IFS='' read -r -p 'Port number the daemon should listen on [873]: ' port
IFS='' read -r -p 'Port number the daemon should listen on [873]: ' port
else
port="$1"
shift
port="$1"
shift
fi
[ "$port" ] || port=873

if [ $# = 0 ]; then
IFS='' read -r -p 'User name for authentication (empty for none): ' user
IFS='' read -r -p 'User name for authentication (empty for none): ' user
else
user="$1"
shift
user="$1"
shift
fi

if [ "$user" ]; then
IFS='' read -r -s -p 'Desired password: ' password
echo
IFS='' read -r -s -p 'Desired password: ' password
echo
fi

rsync="$1"
Expand All @@ -66,14 +66,14 @@ use chroot = no
EOF

if [ "$user" ]; then
cat >>rsyncd.conf <<-EOF
cat >>rsyncd.conf <<-EOF
auth users = $user
secrets file = $module.secrets
EOF
touch "$module".secrets
chmod go-rwx "$module".secrets
echo "$user:$password" >"$module".secrets
user="$user@"
touch "$module".secrets
chmod go-rwx "$module".secrets
echo "$user:$password" >"$module".secrets
user="$user@"
fi

cat >start <<EOF
Expand All @@ -99,28 +99,28 @@ chmod +x stop
path="rsync://$user$(hostname):$port/$module/"

if ./start; then
sleep .2
echo
echo "I ran the start command for the daemon. The log file rsyncd.log says:"
echo
cat rsyncd.log
echo
echo "You can start and stop it with ./start and ./stop respectively."
echo "You can customize the configuration file rsyncd.conf."
echo
echo "Give rsync the following path to access the module:"
echo " $path"
echo
if [ "$user" ]; then
echo "Let's test the daemon now. Enter the password you chose at the prompt."
else
echo "Let's test the daemon now."
fi
echo
echo '$' "$rsync" --list-only "$path"
$rsync --list-only "$path"
echo
echo "You should see an empty folder; it's $moduledir."
sleep .2
echo
echo "I ran the start command for the daemon. The log file rsyncd.log says:"
echo
cat rsyncd.log
echo
echo "You can start and stop it with ./start and ./stop respectively."
echo "You can customize the configuration file rsyncd.conf."
echo
echo "Give rsync the following path to access the module:"
echo " $path"
echo
if [ "$user" ]; then
echo "Let's test the daemon now. Enter the password you chose at the prompt."
else
echo "Let's test the daemon now."
fi
echo
echo '$' "$rsync" --list-only "$path"
$rsync --list-only "$path"
echo
echo "You should see an empty folder; it's $moduledir."
else
echo "Something went wrong. Do you see an error message?"
echo "Something went wrong. Do you see an error message?"
fi
20 changes: 10 additions & 10 deletions support/lsh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@ do_cd=y # Default path is user's home dir (just like ssh) unless host is "lh".

while : ; do
case "$1" in
-l) user="$2"; shift; shift ;;
-l*) user=$(echo "$1" | sed 's/^-l//'); shift ;;
--no-cd) do_cd=n; shift ;;
-*) shift ;;
localhost) shift; break ;;
lh) do_cd=n; shift; break ;;
*) echo "lsh: unable to connect to host $1" 1>&2; exit 1 ;;
-l) user="$2"; shift; shift ;;
-l*) user=$(echo "$1" | sed 's/^-l//'); shift ;;
--no-cd) do_cd=n; shift ;;
-*) shift ;;
localhost) shift; break ;;
lh) do_cd=n; shift; break ;;
*) echo "lsh: unable to connect to host $1" 1>&2; exit 1 ;;
esac
done

if [ "$user" ]; then
prefix=''
if [ $do_cd = y ]; then
home=$(perl -e "print((getpwnam('$user'))[7])")
prefix="cd '$home' &&"
home=$(perl -e "print((getpwnam('$user'))[7])")
prefix="cd '$home' &&"
fi
sudo -H -u "$user" sh -c "$prefix $*"
else
if [ $do_cd = y ]; then
cd || exit 1
cd || exit 1
fi
# shellcheck disable=2294
eval "${@}"
Expand Down
4 changes: 2 additions & 2 deletions support/rsync-no-vanished
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ IGNOREOUT='^((file|directory) has vanished: |rsync warning: some files vanished
# If someone installs this as "rsync", make sure we don't affect a server run.
for arg in "${@}"; do
if [[ "$arg" == --server ]]; then
exec $REAL_RSYNC "${@}"
exit $? # Not reached
exec $REAL_RSYNC "${@}"
exit $? # Not reached
fi
done

Expand Down
8 changes: 4 additions & 4 deletions support/rsync-slash-strip
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ REAL_RSYNC=/usr/bin/rsync
args=()
for arg in "${@}"; do
if [[ "$arg" == --server ]]; then
exec $REAL_RSYNC "${@}"
exit $? # Not reached
exec $REAL_RSYNC "${@}"
exit $? # Not reached
fi
if [[ "$arg" == / ]]; then
args=("${args[@]}" /)
args=("${args[@]}" /)
else
args=("${args[@]}" "${arg%/}")
args=("${args[@]}" "${arg%/}")
fi
done
exec $REAL_RSYNC "${args[@]}"