From 3e272e589f19452eb30282ad8f9015cf628e9a55 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Sun, 5 Oct 2025 21:09:07 -0400 Subject: [PATCH] hv-rsync: add optional list argument Signed-off-by: Hugo Villeneuve --- scripts/hv-rsync.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 -- 2.20.1