From 07e31a185559fcc1dca0bfd020d1a124e3aa4571 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 5 Mar 2015 13:23:37 +0100 Subject: [PATCH] Bootstrap/Pmodules/modmanage.in: try to install module- and release-file only if they exist --- scripts/Bootstrap/Pmodules/modmanage.in | 28 +++++++++++++++---------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/scripts/Bootstrap/Pmodules/modmanage.in b/scripts/Bootstrap/Pmodules/modmanage.in index f6475a0..485f03f 100755 --- a/scripts/Bootstrap/Pmodules/modmanage.in +++ b/scripts/Bootstrap/Pmodules/modmanage.in @@ -105,18 +105,24 @@ sync_module() { $DRY rsync --links --perms --recursive --delete \ "${src_prefix}/${rel_module_prefix}/" \ "${target_prefix}/${rel_module_prefix}/" || return $? - - local dir=$( dirname "${target_prefix}/${PSI_MODULES_ROOT}/${rel_modulefile}" ) - mkdir -p "${dir}" || return $? - $DRY rsync --links --perms --recursive \ - "${src_prefix}/${PSI_MODULES_ROOT}/${rel_modulefile}" \ - "${target_prefix}/${PSI_MODULES_ROOT}/${rel_modulefile}" \ - || return $? - $DRY rsync --links --perms --recursive \ - "${src_prefix}/${PSI_MODULES_ROOT}/${rel_releasefile}" \ - "${target_prefix}/${PSI_MODULES_ROOT}/${rel_releasefile}" \ - || return $? + local -r src_modulefile="${src_prefix}/${PSI_MODULES_ROOT}/${rel_modulefile}" + local -r src_releasefile="${src_prefix}/${PSI_MODULES_ROOT}/${rel_releasefile}" + local -r target_modulefile="${target_prefix}/${PSI_MODULES_ROOT}/${rel_modulefile}" + local -r target_releasefile="${target_prefix}/${PSI_MODULES_ROOT}/${rel_releasefile}" + + if [[ -e "${src_modulefile}" ]] || [[ -e "${src_releasefile}" ]]; then + local dir=$( dirname "${target_modulefile}" ) + mkdir -p "${dir}" || return $? + fi + if [[ -e "${src_modulefile}" ]]; then + $DRY rsync --links --perms --recursive \ + "${src_modulefile}" "${target_modulefile}" || return $? + fi + if [[ -e "${src_releasefile}" ]]; then + $DRY rsync --links --perms --recursive \ + "${src_releasefile}" "${target_releasefile}" || return $? + fi } subcommand_init() {