mirror of
https://github.com/GH05TCREW/pentestagent.git
synced 2026-03-07 14:23:20 +00:00
scripts: add METASPLOIT_SUBTREE_REPO override and improve subtree messaging
This commit is contained in:
@@ -4,11 +4,12 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
REPO_URL="https://github.com/GH05TCREW/MetasploitMCP.git"
|
||||
REPO_URL="${METASPLOIT_SUBTREE_REPO:-https://github.com/GH05TCREW/MetasploitMCP.git}"
|
||||
PREFIX="third_party/MetasploitMCP"
|
||||
BRANCH="main"
|
||||
|
||||
echo "This will add MetasploitMCP as a git subtree under ${PREFIX}."
|
||||
echo "You can override the upstream repo with: METASPLOIT_SUBTREE_REPO=...\n"
|
||||
echo "If the subtree already exists, the script will pull and rebase the subtree instead.\n"
|
||||
|
||||
if [ -d "${PREFIX}" ]; then
|
||||
@@ -27,6 +28,14 @@ if [ -d "${PREFIX}" ]; then
|
||||
fi
|
||||
else
|
||||
echo "Adding subtree for the first time..."
|
||||
git subtree add --prefix="${PREFIX}" "${REPO_URL}" "${BRANCH}" --squash
|
||||
echo "MetasploitMCP subtree added under ${PREFIX}."
|
||||
# Ensure parent dir exists for clearer errors
|
||||
mkdir -p "$(dirname "${PREFIX}")"
|
||||
|
||||
if git subtree add --prefix="${PREFIX}" "${REPO_URL}" "${BRANCH}" --squash; then
|
||||
echo "MetasploitMCP subtree added under ${PREFIX}."
|
||||
else
|
||||
echo "Failed to add subtree from ${REPO_URL}." >&2
|
||||
echo "Check that the URL is correct or override with METASPLOIT_SUBTREE_REPO." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user