diff --git a/external/installer-linux/build.sh b/external/installer-linux/build.sh index 3afe637461..1c08c88ca0 100755 --- a/external/installer-linux/build.sh +++ b/external/installer-linux/build.sh @@ -3,16 +3,37 @@ VERSION="3.4.0-release" BASE=`dirname $0` -# Grab a fresh copy of Metasploit -if [ -f "tmp/msf3/msfconsole" ]; then - svn update tmp/msf3/ -else - svn checkout https://www.metasploit.com/svn/framework3/trunk tmp/msf3/ -fi -(cd tmp; tar cf msf3.tar msf3) +# We can only "exclude" directories. For specific files, we just have to rm +# them. +MINI_EXCLUDES=" +data/templates/src +documentation +external/installer-linux +external/installer-win32 +external/source +lib/rex/exploitation/opcodedb.rb +test +" +MINI_RM=" +msfd +msfelfscan +msfgui +msfmachscan +msfopcode +msfpescan +msfrpc +msfrpcd +msfweb +test +$(find tmp/msf3-mini -name '*.rb.ut.rb') +" + +# +# Expects tmp/msf3.tar to exist +# build_makeself() { - NAME=$1 + TITLE=$1 INSTALLER_FILENAME=$2 BIN_TARBALL_PATH=$3 @@ -23,17 +44,57 @@ build_makeself() { bunzip2 ${TMP}/metasploit.tar.bz2 cp -a scripts/*.sh ${TMP}/ cp -a scripts/msfupdate ${TMP}/ - makeself "${TMP}" "${INSTALLER_FILENAME}" "${NAME}" ./installer.sh + makeself "${TMP}" "${INSTALLER_FILENAME}" "${TITLE}" ./installer.sh rm -rf ${TMP} } -NAME32="Metasploit Framework v${VERSION} Installer (32-bit)" -PATH32="framework-${VERSION}-linux-i686.run" -BINPATH32="${BASE}/bin/linux32.tar.bz2" -build_makeself "${NAME32}" "${PATH32}" "${BINPATH32}" +if [ -f tmp/msf3/msfconsole ]; then + svn up tmp/msf3 +else + svn co https://www.metasploit.com/svn/framework3/trunk msf3 +fi +if [ -f tmp/msf3-mini/msfconsole ]; then + svn up tmp/msf3-mini +else + cp -r tmp/msf3 tmp/msf3-mini + for dir in ${MINI_EXCLUDES}; do + # Supposedly only have to do this once + svn up --set-depth=exclude "$dir" 2>/dev/null + done +fi +for file in ${MINI_RM}; do + rm -rf tmp/msf3-mini/"$file" +done + + +(cd tmp; tar cf msf3.tar msf3) + +TITLE="Metasploit Framework v${VERSION} Installer (64-bit)" +INSTALLER_FILENAME="framework-${VERSION}-linux-x86_64.run" +BINPATH="${BASE}/bin/linux64.tar.bz2" +if [ -f ${BINPATH} ]; then + build_makeself "${TITLE}" "${INSTALLER_FILENAME}" "${BINPATH}" +fi + +TITLE="Metasploit Framework v${VERSION} Installer (32-bit)" +INSTALLER_FILENAME="framework-${VERSION}-linux-i686.run" +BINPATH="${BASE}/bin/linux32.tar.bz2" +if [ -f ${BINPATH} ]; then + # Build the regular 32-bit installer + # Uses the same msf3.tar as 64-bit, so we don't need to regenerate it. + build_makeself "${TITLE}" "${INSTALLER_FILENAME}" "${BINPATH}" + + # Set up and build the mini 32-bit installer + mv tmp/msf3 tmp/msf3-full + mv tmp/msf3-mini tmp/msf3 + (cd tmp; tar cf msf3.tar msf3) + mv tmp/msf3 tmp/msf3-mini + mv tmp/msf3-full tmp/msf3 + + TITLE="Metasploit Framework v${VERSION} Miniature Installer (32-bit)" + INSTALLER_FILENAME="framework-${VERSION}-mini-linux-i686.run" + BINPATH="${BASE}/bin/linux32.tar.bz2" + build_makeself "${TITLE}" "${INSTALLER_FILENAME}" "${BINPATH}" +fi -NAME64="Metasploit Framework v${VERSION} Installer (64-bit)" -PATH64="framework-${VERSION}-linux-x86_64.run" -BINPATH64="${BASE}/bin/linux64.tar.bz2" -build_makeself "${NAME64}" "${PATH64}" "${BINPATH64}"