diff --git a/CHANGELOG.md b/CHANGELOG.md index d47d8de..9be6d84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ suffix. (issue #248) ### build-system +* Option '--clean-install' added. If this option is set, the + module is removed before building, if the module already + exist. (issue #247) ## Version 1.1.18 ### modulecmd diff --git a/Pmodules/libpbuild.bash b/Pmodules/libpbuild.bash index 99b5d27..eaf9749 100644 --- a/Pmodules/libpbuild.bash +++ b/Pmodules/libpbuild.bash @@ -1797,6 +1797,13 @@ _build_module() { fi install_release_file else + if [[ "${opt_clean_install,,}" == 'yes' ]]; then + std::info \ + "%s " \ + "${module_name}/${module_version}:" \ + "remove module, if already exists ..." + remove_module + fi std::info \ "%s " \ "${module_name}/${module_version}:" \ diff --git a/Pmodules/modbuild.in b/Pmodules/modbuild.in index 53a264a..84aa741 100755 --- a/Pmodules/modbuild.in +++ b/Pmodules/modbuild.in @@ -86,6 +86,9 @@ SELECT VARIANT TO BUILD: BUILD-STEPS OPTIONS: +--clean-install + Remove module if already exist before building. + --prep Prepare sources: unpack sources and apply patches only. @@ -184,6 +187,7 @@ declare -- opt_config_file='' declare -- opt_debug='no' declare -- opt_yaml='yes' declare -- opt_variant='' +declare -- opt_clean_install='no' declare -- BUILD_SCRIPT='' declare -- yaml_config_file='' @@ -299,6 +303,9 @@ parse_args() { --prep | --configure | --compile | --install | --all ) opt_build_target=${1:2} ;; + --clean-install ) + opt_clean_install='yes' + ;; --update-modulefiles ) opt_update_modulefiles='yes' ;;