The branch, master has been updated
       via  f7ac7ffd Some minor option/prompt tweaks.
      from  4320c25f More helper script improvements.

https://git.samba.org/?p=rsync.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f7ac7ffd165e20d7d18f3d131cd31226563a5c20
Author: Wayne Davison <wa...@opencoder.net>
Date:   Tue Nov 5 17:34:09 2024 -0800

    Some minor option/prompt tweaks.

-----------------------------------------------------------------------

Summary of changes:
 packaging/samba-rsync | 34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)


Changeset truncated at 500 lines:

diff --git a/packaging/samba-rsync b/packaging/samba-rsync
index c1661f46..8691846a 100755
--- a/packaging/samba-rsync
+++ b/packaging/samba-rsync
@@ -29,32 +29,40 @@ while (( $# )); do
        -R|--reverse) REVERSE=yes ;;
        f|ftp) MODE=ftp ;;
        h|html) MODE=html ;;
-       *)
-           echo "Invalid option: $1" >&2
-           exit 1
-           ;;
        -h|--help)
            echo "Usage: [-R] [f|ftp|h|html]"
            echo "-R --reverse  Copy the files from the server to the local 
host."
+           echo "              The default is to update the remote files."
            echo "-h --help     Output this help message."
+           echo " "
+           echo "The script will prompt if ftp or html is not specified on the 
command line."
+           echo "Only one category can be copied at a time. When pulling html 
files, a git"
+           echo "checkout will be either created or updated prior to the rsync 
copy."
            exit
            ;;
+       *)
+           echo "Invalid option: $1" >&2
+           exit 1
+           ;;
     esac
     shift
 done
 
-if [ ! "$MODE" ]; then
-    echo -n "Update ftp or html? "
+while [ ! "$MODE" ]; do
+    if [ "$REVERSE" = yes ]; then
+       DIRECTION=FROM
+    else
+       DIRECTION=TO
+    fi
+    echo -n "Copy which files $DIRECTION the server? ftp or html? "
     read ans
     case "$ans" in
        f*) MODE=ftp ;;
        h*) MODE=html ;;
-       *)
-           echo "Invalid answer." >&2
-           exit 1
-           ;;
+       '') exit 1 ;;
+       *) echo "You must answer f or h to copy the ftp or html data." ;;
     esac
-fi
+done
 
 if [ "$MODE" = ftp ]; then
     SRC_DIR="$FTP_SRC"
@@ -96,10 +104,10 @@ if [ "$REVERSE" = yes ]; then
     echo "Copying files from $RSYNC_SAMBA_HOST to $SRC_DIR ..."
     if [ "$MODE" = html ]; then
        if [ $REVERSE_RSYNC = rsync ]; then
-           git clone "$HTML_GIT" "$SRC_DIR"
+           git clone "$HTML_GIT" "$SRC_DIR" || exit 1
        else
            cd "$SRC_DIR" || exit 1
-           git pull
+           git pull || exit 1
        fi
        sed -n -e 's/[-P]/H/p' "$SRC_DIR/$FILT" >"$TMP_FILT"
        OPTS="${OPTS}f._$TMP_FILT"


-- 
The rsync repository.

_______________________________________________
rsync-cvs mailing list
rsync-cvs@lists.samba.org
https://lists.samba.org/mailman/listinfo/rsync-cvs

Reply via email to