From b16ac7b4da57dff8d55fec69c6f0f1f62753758c Mon Sep 17 00:00:00 2001 From: adfoster-r7 Date: Tue, 30 Apr 2024 21:36:30 +0100 Subject: [PATCH] Ensure omnibus on windows can be rebuilt multiple times --- config/projects/metasploit-framework.rb | 2 ++ config/software/metasploit-framework.rb | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/config/projects/metasploit-framework.rb b/config/projects/metasploit-framework.rb index 545cf576..5ec7ddb2 100644 --- a/config/projects/metasploit-framework.rb +++ b/config/projects/metasploit-framework.rb @@ -14,7 +14,9 @@ end exclude "**/.git" +exclude "**\\.git" exclude "**/bundler/git" +exclude "**\\bundler\\git" if mac_os_x? require_portable_links true diff --git a/config/software/metasploit-framework.rb b/config/software/metasploit-framework.rb index 438c2f55..da45738f 100644 --- a/config/software/metasploit-framework.rb +++ b/config/software/metasploit-framework.rb @@ -1,8 +1,17 @@ name "metasploit-framework" + +# Detect a local checkout of metasploit-framework at '../metasploit-framework' - i.e. for the scenario of: +# - c:/temp/metasploit-omnibus +# - c:/temp/metasploit-framework (A local checkout of framework to use during the build process) +# but try and use 'C:/metasploit-framework' - as that's the metasploit-omnibus artifacts output directory +def has_windows_metasploit_framework_repo? + windows? && File.exist?('../metasploit-framework') && File.expand_path(File.join(Dir.pwd, "..", "metasploit-framework")) != "c:/metasploit-framework" +end + if linux? && File.exist?("/metasploit-framework") # supply current version of metasploit-framework at root of filesystem source path: "/metasploit-framework" -elsif windows? && File.exist?('../metasploit-framework') +elsif has_windows_metasploit_framework_repo? # supply current version of metasploit-framework relative to the current directory source path: "../metasploit-framework" else