From: Wayne Davison Date: Mon, 8 Jun 2020 00:20:58 +0000 (-0700) Subject: Put the rsync-ssl-rsh helper script into a lib dir. X-Git-Tag: v3.2.0pre1~52 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=888f4f9503676339be03b2ec53277478c9e3a318;p=thirdparty%2Frsync.git Put the rsync-ssl-rsh helper script into a lib dir. --- diff --git a/Makefile.in b/Makefile.in index 13cba5d9..b45f3f47 100644 --- a/Makefile.in +++ b/Makefile.in @@ -4,8 +4,8 @@ prefix=@prefix@ datarootdir=@datarootdir@ exec_prefix=@exec_prefix@ -stunnel4=@STUNNEL4@ bindir=@bindir@ +libdir=@libdir@/rsync mandir=@mandir@ LIBS=@LIBS@ @@ -71,9 +71,10 @@ all: Makefile rsync$(EXEEXT) stunnel-rsyncd.conf @MAKE_MAN@ install: all -${MKDIR_P} ${DESTDIR}${bindir} + -${MKDIR_P} ${DESTDIR}${libdir} ${INSTALLCMD} ${INSTALL_STRIP} -m 755 rsync$(EXEEXT) ${DESTDIR}${bindir} ${INSTALLCMD} -m 755 rsync-ssl ${DESTDIR}${bindir} - ${INSTALLCMD} -m 755 rsync-ssl-rsh ${DESTDIR}${bindir} + ${INSTALLCMD} -m 755 ssl-rsh ${DESTDIR}${libdir} -${MKDIR_P} ${DESTDIR}${mandir}/man1 -${MKDIR_P} ${DESTDIR}${mandir}/man5 if test -f rsync.1; then ${INSTALLMAN} -m 644 rsync.1 ${DESTDIR}${mandir}/man1; fi @@ -227,15 +228,15 @@ man-copy: fi ; \ done -rsync.1: rsync.yo +rsync.1: rsync.yo $(srcdir)/tweak_manpage yodl2man -o rsync.1 $(srcdir)/rsync.yo -$(srcdir)/tweak_manpage rsync.1 -rsync-ssl.1: rsync-ssl.yo +rsync-ssl.1: rsync-ssl.yo $(srcdir)/tweak_manpage yodl2man -o rsync-ssl.1 $(srcdir)/rsync-ssl.yo -$(srcdir)/tweak_manpage rsync-ssl.1 -rsyncd.conf.5: rsyncd.conf.yo +rsyncd.conf.5: rsyncd.conf.yo $(srcdir)/tweak_manpage yodl2man -o rsyncd.conf.5 $(srcdir)/rsyncd.conf.yo -$(srcdir)/tweak_manpage rsyncd.conf.5 diff --git a/NEWS.md b/NEWS.md index 1807fe4e..783064ab 100644 --- a/NEWS.md +++ b/NEWS.md @@ -85,9 +85,9 @@ Protocol: 31 (unchanged) - Added the `--write-devices` option based on the long-standing patch. - - Added openssl support to the rsync-ssl script via its renamed helper script, - rsync-ssl-rsh. Both bash scripts are now installed by default (removing the - install-ssl-client make target). Rsync was also enhanced to set the + - Added openssl support to the rsync-ssl script via a (lib installed) helper + script, ssl-rsh. Both bash scripts are now installed by default, removing + the install-ssl-client make target. Rsync was also enhanced to set the `RSYNC_PORT` environment variable when running a daemon-over-rsh script. Its value is the user-specified port number (set via `--port` or an rsync:// URL) or 0 if the user didn't override the port. diff --git a/packaging/lsb/rsync.spec b/packaging/lsb/rsync.spec index 3767cd9c..ea02c7e6 100644 --- a/packaging/lsb/rsync.spec +++ b/packaging/lsb/rsync.spec @@ -70,7 +70,7 @@ rm -rf $RPM_BUILD_ROOT %config(noreplace) /etc/xinetd.d/rsync %{_prefix}/bin/rsync %{_prefix}/bin/rsync-ssl -%{_prefix}/bin/rsync-ssl-rsh +%{_prefix}/lib/rsync/ssl-rsh %{_mandir}/man1/rsync.1* %{_mandir}/man1/rsync-ssl.1* %{_mandir}/man5/rsyncd.conf.5* diff --git a/rsync-ssl b/rsync-ssl index f3e365d7..c9a8db90 100755 --- a/rsync-ssl +++ b/rsync-ssl @@ -18,5 +18,6 @@ case "$@" in esac mydir="${0%/*}" +libdir="$mydir/../lib/rsync" -exec "$mydir/rsync" --rsh="$mydir/rsync-ssl-rsh" "${@}" +exec "$mydir/rsync" --rsh="$libdir/ssl-rsh" "${@}" diff --git a/rsync-ssl.yo b/rsync-ssl.yo index 29d311df..51497420 100644 --- a/rsync-ssl.yo +++ b/rsync-ssl.yo @@ -23,9 +23,8 @@ bf(rsync) manpage for more information on how it works. Note that the stunnel connection type requires at least version 4 of stunnel, which should be the case on modern systems. -This script requires that a helper script named bf(rsync-ssl-rsh) be installed -in the same directory as this bf(rsync-ssl) script so that rsync can use it as -its remote-shell command. +This script requires that a helper script named bf(ssl-rsh) be installed the +@libdir@ dir so that rsync can use it as its remote-shell command. manpagesection(ENVIRONMENT VARIABLES) @@ -67,7 +66,7 @@ verb( rsync-ssl --type=openssl -aiv example.com::src/ dest) manpagefiles() -rsync-ssl-rsh +@libdir@/ssl-rsh manpageseealso() diff --git a/rsync-ssl-rsh b/ssl-rsh similarity index 93% rename from rsync-ssl-rsh rename to ssl-rsh index f99aa901..ea7b76c1 100755 --- a/rsync-ssl-rsh +++ b/ssl-rsh @@ -1,16 +1,16 @@ #!/bin/bash # This must be called as (note the trailing dot): # -# rsync-ssl-rsh HOSTNAME rsync --server --daemon . +# ssl-rsh HOSTNAME rsync --server --daemon . # # ... which is typically done via the rsync-ssl script, which results in something like this: # -# rsync --rsh=rsync-ssl-rsh -aiv HOSTNAME::module [ARGS] +# rsync --rsh=/usr/lib/rsync/ssl-rsh -aiv HOSTNAME::module [ARGS] # # This SSL setup based on the files by: http://dozzie.jarowit.net/trac/wiki/RsyncSSL # Note that an stunnel connection requires at least version 4.x of stunnel. -# The environment can override our defaults using RSYNC_SSL_* variables +# The environment can override our defaults using RSYNC_SSL_* variables. See `man rsync-ssl`. function path_search { IFS_SAVE="$IFS" @@ -106,7 +106,7 @@ hostname="$1" shift if [[ -z "$hostname" || "$1" != rsync || "$2" != --server || "$3" != --daemon ]]; then - echo "Usage: rsync-ssl-helper HOSTNAME rsync --server --daemon ." 1>&2 + echo "Usage: ssl-rsh HOSTNAME rsync --server --daemon ." 1>&2 exit 1 fi diff --git a/tweak_manpage b/tweak_manpage index 4c55c514..76b76040 100755 --- a/tweak_manpage +++ b/tweak_manpage @@ -3,6 +3,20 @@ use strict; use warnings; +our %subs; + +BEGIN { + open IN, '<', 'Makefile' or die $!; + while () { + my ($var, $val) = /^(\w+)=(.+)/; + next unless defined $val; + $val =~ s/\$\{(\w+)\}/$subs{$1}/ while $val =~ /\$\{/; + $subs{$var} = $val; + last if $var eq 'libdir'; + } + close IN; +} + # We only need to use "\&'" or "\&." at the start of a line. s/(?<=.)\\\&(['.])/$1/g; @@ -19,6 +33,8 @@ s/(\\f(B|\(CW).*?\\fP)/ realquotes($1) /egs; s/^\\\&(\\\(oq)/$1/gm; +s/\@libdir\@/$subs{libdir}/g; + sub realquotes { my($txt) = @_;