From: Hugo Villeneuve Date: Mon, 6 Oct 2025 01:09:07 +0000 (-0400) Subject: hv-rsync: add optional list argument X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=3e272e589f19452eb30282ad8f9015cf628e9a55;p=hvutilities.git hv-rsync: add optional list argument Signed-off-by: Hugo Villeneuve --- diff --git a/scripts/hv-rsync.sh b/scripts/hv-rsync.sh index 99d56f4..1f01802 100755 --- a/scripts/hv-rsync.sh +++ b/scripts/hv-rsync.sh @@ -9,6 +9,9 @@ print_usage() echo "${PROG_NAME} -- synchronisation serveur RSYNC" echo "Usage: ${PROG_NAME} [OPTIONS...] MODE" echo + echo "Options:" + echo " -l liste de répertoires (défaut = RSYNC_LIST du fichier de config.)" + echo echo "MODE:" echo " push" echo " pull" @@ -19,12 +22,15 @@ print_usage() echo } -while getopts "h" flag ;do +while getopts "l:h" flag ;do case ${flag} in h) print_usage exit 0 ;; + l) + rsync_list="${OPTARG}" + ;; ?) echo "${PROG_NAME}: Invalid option: ${OPTARG}." echo "Try \`${PROG_NAME} -h' for more information." @@ -62,12 +68,16 @@ fi source ${HVRSYNC_CONF} +if [ "${rsync_list}" = "" ]; then + rsync_list="${RSYNC_LIST}" +fi + # rsync options: # -a: sync recursively and preserves symbolic links, special and device # files, modification times, groups, owners, and permissions. # -n: dry-run -for f in ${RSYNC_LIST}; do +for f in ${rsync_list}; do if [ x"${mode}" = x"diff" ]; then if [ ! -d ${RSYNC_LOCAL_DIR}/${f} ]; then