make install error - nselib/data/psexec

View: New views
9 Messages — Rating Filter:   Alert me  

make install error - nselib/data/psexec

by Tom Sellers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am seeing an error when running make install on my Ubuntu machine:

/usr/bin/install -c -c -m 644 nse_main.lua /usr/local/share/nmap/
/usr/bin/install -c -d /usr/local/share/nmap/scripts
/usr/bin/install -c -c -m 644 scripts/script.db scripts/*.nse /usr/local/share/nmap/scripts
/usr/bin/install -c -d /usr/local/share/nmap/nselib
/usr/bin/install -c -c -m 644 nselib/*.lua /usr/local/share/nmap/nselib
/usr/bin/install -c -d /usr/local/share/nmap/nselib/data
/usr/bin/install -c -c -m 644 nselib/data/* /usr/local/share/nmap/nselib/data
/usr/bin/install: omitting directory `nselib/data/psexec'
make: *** [install-nse] Error 1


This is after a complete fresh SVN checkout and running my compile
script that does the following:

        cd /code_repo/nmap
        rm -rf /usr/local/share/nmap

        make clean
        ./configure --without-zenmap
        make
        make install

I have a general idea as to what is wrong, but I am not sure as to the
the best way to correct it.

Tom

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/

Re: make install error - nselib/data/psexec

by Ron (list) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tom Sellers wrote:

> I am seeing an error when running make install on my Ubuntu machine:
>
> /usr/bin/install -c -c -m 644 nse_main.lua /usr/local/share/nmap/
> /usr/bin/install -c -d /usr/local/share/nmap/scripts
> /usr/bin/install -c -c -m 644 scripts/script.db scripts/*.nse
> /usr/local/share/nmap/scripts
> /usr/bin/install -c -d /usr/local/share/nmap/nselib
> /usr/bin/install -c -c -m 644 nselib/*.lua /usr/local/share/nmap/nselib
> /usr/bin/install -c -d /usr/local/share/nmap/nselib/data
> /usr/bin/install -c -c -m 644 nselib/data/*
> /usr/local/share/nmap/nselib/data
> /usr/bin/install: omitting directory `nselib/data/psexec'
> make: *** [install-nse] Error 1
>
>
> This is after a complete fresh SVN checkout and running my compile
> script that does the following:
>
>     cd /code_repo/nmap
>     rm -rf /usr/local/share/nmap
>
>     make clean
>     ./configure --without-zenmap
>     make
>     make install
>
> I have a general idea as to what is wrong, but I am not sure as to the
> the best way to correct it.
>
> Tom

Hmm, this error is caused by code I added, but I don't know the proper
way to fix it.

Little help? :)

Ron

--
Ron Bowes
http://www.skullsecurity.org/
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/

Re: make install error - nselib/data/psexec

by David Fifield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Nov 11, 2009 at 09:47:24AM -0600, Ron wrote:

> Tom Sellers wrote:
> > I am seeing an error when running make install on my Ubuntu machine:
> >
> > /usr/bin/install -c -c -m 644 nse_main.lua /usr/local/share/nmap/
> > /usr/bin/install -c -d /usr/local/share/nmap/scripts
> > /usr/bin/install -c -c -m 644 scripts/script.db scripts/*.nse
> > /usr/local/share/nmap/scripts
> > /usr/bin/install -c -d /usr/local/share/nmap/nselib
> > /usr/bin/install -c -c -m 644 nselib/*.lua /usr/local/share/nmap/nselib
> > /usr/bin/install -c -d /usr/local/share/nmap/nselib/data
> > /usr/bin/install -c -c -m 644 nselib/data/*
> > /usr/local/share/nmap/nselib/data
> > /usr/bin/install: omitting directory `nselib/data/psexec'
> > make: *** [install-nse] Error 1
>
> Hmm, this error is caused by code I added, but I don't know the proper
> way to fix it.

The problem is that the install command is being asked to copy a
directory instead of a regular file. The makefile rule is this:

        $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data
        $(INSTALL) -c -m 644 $(NSE_LIB_DATA_FILES) $(DESTDIR)$(nmapdatadir)/nsellib/data

You have to find a way to list the files you want to install. I can't
think of an elegant way to do it. You might try this:

        $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data
        $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data/psexec
        for f in `find nselib/data -name .svn -prune -o -print`; do \
                $(INSTALL) -c -m 644 $$f $(DESTDIR)$(nmapdatadir)/$$f; \
        done

You'll have to make sure that works with BSD find. Also, it doesn't look
like all of the psexec data files are meant to be installed, like
nmap_service.vcproj.

We had a similar problem with the scripts subdirectory in
http://seclists.org/nmap-dev/2007/q2/254. There it was easier to solve;
we just declared that the scripts directory couldn't have subdirectories
of its own.

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/

Re: make install error - nselib/data/psexec

by David Fifield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Nov 12, 2009 at 12:20:51PM -0700, David Fifield wrote:

> On Wed, Nov 11, 2009 at 09:47:24AM -0600, Ron wrote:
> > Tom Sellers wrote:
> > > I am seeing an error when running make install on my Ubuntu machine:
> > >
> > > /usr/bin/install -c -c -m 644 nse_main.lua /usr/local/share/nmap/
> > > /usr/bin/install -c -d /usr/local/share/nmap/scripts
> > > /usr/bin/install -c -c -m 644 scripts/script.db scripts/*.nse
> > > /usr/local/share/nmap/scripts
> > > /usr/bin/install -c -d /usr/local/share/nmap/nselib
> > > /usr/bin/install -c -c -m 644 nselib/*.lua /usr/local/share/nmap/nselib
> > > /usr/bin/install -c -d /usr/local/share/nmap/nselib/data
> > > /usr/bin/install -c -c -m 644 nselib/data/*
> > > /usr/local/share/nmap/nselib/data
> > > /usr/bin/install: omitting directory `nselib/data/psexec'
> > > make: *** [install-nse] Error 1
> >
> > Hmm, this error is caused by code I added, but I don't know the proper
> > way to fix it.
>
> The problem is that the install command is being asked to copy a
> directory instead of a regular file. The makefile rule is this:
>
> $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data
> $(INSTALL) -c -m 644 $(NSE_LIB_DATA_FILES) $(DESTDIR)$(nmapdatadir)/nsellib/data
>
> You have to find a way to list the files you want to install. I can't
> think of an elegant way to do it. You might try this:
>
> $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data
> $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data/psexec
> for f in `find nselib/data -name .svn -prune -o -print`; do \
> $(INSTALL) -c -m 644 $$f $(DESTDIR)$(nmapdatadir)/$$f; \
> done

I made a mistake in the above commands. That still try to install
directories, but it happens to work because the for loop isolates the
error from make. This is better:

  $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data
  $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data/psexec
  for f in `find nselib/data -name .svn -prune -o -type f -print`; do \
  $(INSTALL) -c -m 644 $$f $(DESTDIR)$(nmapdatadir)/$$f; \
  done

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/

Re: make install error - nselib/data/psexec

by Ron (list) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

David Fifield wrote:

> I made a mistake in the above commands. That still try to install
> directories, but it happens to work because the for loop isolates the
> error from make. This is better:
>
>   $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data
>   $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data/psexec
>   for f in `find nselib/data -name .svn -prune -o -type f -print`; do \
>   $(INSTALL) -c -m 644 $$f $(DESTDIR)$(nmapdatadir)/$$f; \
>   done
>
> David Fifield


Well, another solution is to get rid of the 'psexec' folder in the data
directory and put all its files in 'data', but they're pretty specific
so it probably doesn't make sense.

I'll go with whatever solution you think is best. I'm not really a
Makefile expert, so I'll trust your capable hands.

Ron


--
Ron Bowes
http://www.skullsecurity.org/
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/

Re: make install error - nselib/data/psexec

by Corey Chandler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ron wrote:

> David Fifield wrote:
>  
>> I made a mistake in the above commands. That still try to install
>> directories, but it happens to work because the for loop isolates the
>> error from make. This is better:
>>
>>   $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data
>>   $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data/psexec
>>   for f in `find nselib/data -name .svn -prune -o -type f -print`; do \
>>   $(INSTALL) -c -m 644 $$f $(DESTDIR)$(nmapdatadir)/$$f; \
>>   done
>>
>> David Fifield
>>    
>
>
> Well, another solution is to get rid of the 'psexec' folder in the data
> directory and put all its files in 'data', but they're pretty specific
> so it probably doesn't make sense.
>
> I'll go with whatever solution you think is best. I'm not really a
> Makefile expert, so I'll trust your capable hands.
>
> Ron
>
>
>  
Yeah, this also blows up on MacOS.

-- Corey
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/

Re: make install error - nselib/data/psexec - Potential Fix

by Tom Sellers :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Corey Chandler wrote:

> Ron wrote:
>> David Fifield wrote:
>>  
>>> I made a mistake in the above commands. That still try to install
>>> directories, but it happens to work because the for loop isolates the
>>> error from make. This is better:
>>>
>>>      $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data
>>>      $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data/psexec
>>>      for f in `find nselib/data -name .svn -prune -o -type f -print`;
>>> do \
>>>          $(INSTALL) -c -m 644 $$f $(DESTDIR)$(nmapdatadir)/$$f; \
>>>      done
>>>
>>> David Fifield
>>>    
>>
>>
>> Well, another solution is to get rid of the 'psexec' folder in the data
>> directory and put all its files in 'data', but they're pretty specific
>> so it probably doesn't make sense.
>>
>> I'll go with whatever solution you think is best. I'm not really a
>> Makefile expert, so I'll trust your capable hands.
>>
>> Ron
Ok, I think I have this fixed.  Based on my reading of the problem the error message,

        /usr/bin/install: omitting directory `nselib/data/psexec'
        make: *** [install-nse] Error 1

is due to the following line using a wildcard whose results include a directory "psexec":

        $(INSTALL) -c -m 644 $(NSE_LIB_DATA_FILES) $(DESTDIR)$(nmapdatadir)/nselib/data

Interestingly, there was a chance of this happening before, two lines up, where the
"nselib" directory contents are handled.  In that case the NSE_LIB_LUA_FILES variable
specifies *.lua, avoiding the issue by not processing the directory "data".  Since the
"data" folder contains files with various extensions and some without this would not
work.

I figure that it would be unlikely that we would change all of the file names in nselib/data
to include some extension and that if we did, it would just break later.

So I took David's code above as an example and modified it to process the "nselib/data"
directory twice, once to create directories, then again to copy the files.

The benefit of this process is that if further directories created under nselib/data
they will automatically be picked up.  The downside is that some undesirable files,
such as *.c and *.vcproj, will get moved as well.

If that is a problem, I can rewrite the patch.

Perhaps someone with stronger shell-fu could craft an if like that checks $f to see
if it includes .c or .vcproj and skips this files during the file processing loop.

At one point I had a single loop parsing nselib/data that skipped subdirectories
and then manually processed the psexec folder.  The downside is that if new folders
are added to "nselib/data" then the Makefile.in file will need to be edited again.



I have attached both a diff and a complete copy of the Makefile.in file.

I have tested the file on Ubuntu linux.  This change likely needs a couple test runs
on other *nix based OSes.

I suggest deleting the directory where nmap's shared files are installed prior to
testing.  In my case the directory is /usr/local/share/nmap.

Thanks much,

Tom

# Extract the version string from nmap.h.
export NMAP_VERSION := $(shell grep '^\#[ \t]*define[ \t]\+NMAP_VERSION' nmap.h | sed -e 's/.*"\(.*\)".*/\1/' -e 'q')
NMAP_NAME= Nmap
NMAP_URL= http://nmap.org
NMAP_PLATFORM=@host@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
mandir = @mandir@
srcdir = @srcdir@
nmapdatadir = @datadir@/nmap
deskdir = $(prefix)/share/applications
NMAPDEVDIR=~/nmap-private-dev

export NBASEDIR=@NBASEDIR@
export NSOCKDIR=@NSOCKDIR@
export LIBLUADIR = @LIBLUADIR@
export NDIR=$(shell pwd)
export LIBLUA_LIBS = @LIBLUA_LIBS@
export NCATDIR=@NCATDIR@
CC = @CC@
CXX = @CXX@
CCOPT =
DBGFLAGS =
STRIP = @STRIP@
LIBPCAPDIR = @libpcapdir@
LIBPCREDIR = @LIBPCREDIR@
export LIBDNETDIR = @LIBDNETDIR@
ZENMAPDIR = zenmap
NDIFFDIR = ndiff
PYTHON = @PYTHON@
DEFS = @DEFS@ -DNMAP_NAME=\"$(NMAP_NAME)\" -DNMAP_URL=\"$(NMAP_URL)\" -DNMAP_PLATFORM=\"$(NMAP_PLATFORM)\" -DNMAPDATADIR=\"$(nmapdatadir)\"
# With GCC, add extra security checks to source code.
# http://gcc.gnu.org/ml/gcc-patches/2004-09/msg02055.html
# Level 1 only makes changes that don't affect "conforming" programs,
# while level 2 enforces additional restrictions.
DEFS += -D_FORTIFY_SOURCE=2
# For mtrace debugging -- see MTRACE define in main.cc for instructions
# Should only be enabled during debugging and not in any real release.
# DEFS += -DMTRACE=1
CXXFLAGS = @CXXFLAGS@ $(DBGFLAGS) $(CCOPT) $(DEFS)
CPPFLAGS = @CPPFLAGS@
export CFLAGS = $(CXXFLAGS)
# CFLAGS = $(DEFS) $(INCLS)
STATIC =
LDFLAGS = @LDFLAGS@ $(DBGFLAGS) $(STATIC)
LIBS =  @LIBNBASE_LIBS@ @LIBNSOCK_LIBS@ @LIBPCRE_LIBS@ @LIBPCAP_LIBS@ @OPENSSL_LIBS@ @LIBDNET_LIBS@ @LIBLUA_LIBS@ @LIBS@
# LIBS =  -lefence @LIBS@
# LIBS =  -lrmalloc @LIBS@
INSTALL = @INSTALL@
# MAKEDEPEND = @MAKEDEPEND@
export RPMTDIR=$(HOME)/rpm
# Whether the user wants to install translated man pages. If "yes", then
# all translated man pages are installed, unless a subset is specified
# with the LINGUAS environment variable.
USE_NLS = @USE_NLS@
# A space-separated list of language codes supported (for man page
# installation). The user can install a subset of these with the LINGUAS
# environment variable or none of them with --disable-nls.
ALL_LINGUAS = de es fr hr hu it jp pl pt_BR pt_PT ro ru sk zh
# A space-separated list of language codes requested by the user.
LINGUAS ?= $(ALL_LINGUAS)


# DESTDIR is used by some package maintainers to install Nmap under
# its usual directory structure into a different tree.  See the
# CHANGELOG for more info.
DESTDIR =

TARGET = nmap
INSTALLNSE=@INSTALLNSE@
BUILDZENMAP=@BUILDZENMAP@
BUILDNDIFF=@BUILDNDIFF@
INSTALLZENMAP=@INSTALLZENMAP@
INSTALLNDIFF=@INSTALLNDIFF@
UNINSTALLZENMAP=@UNINSTALLZENMAP@

ifneq (@LIBLUA_LIBS@,)
NSE_SRC=nse_main.cc nse_nsock.cc nse_fs.cc nse_nmaplib.cc nse_debug.cc nse_pcrelib.cc nse_binlib.cc nse_bit.cc
NSE_HDRS=nse_main.h nse_nsock.h nse_fs.h nse_nmaplib.h nse_debug.h nse_pcrelib.h nse_binlib.h nse_bit.h
NSE_OBJS=nse_main.o nse_nsock.o nse_fs.o nse_nmaplib.o nse_debug.o nse_pcrelib.o nse_binlib.o nse_bit.o
ifneq (@OPENSSL_LIBS@,)
NSE_SRC+=nse_openssl.cc nse_ssl_cert.cc
NSE_HDRS+=nse_openssl.h nse_ssl_cert.h
NSE_OBJS+=nse_openssl.o nse_ssl_cert.o
endif
endif

export SRCS = main.cc nmap.cc targets.cc tcpip.cc nmap_error.cc utils.cc idle_scan.cc osscan.cc osscan2.cc output.cc payload.cc scan_engine.cc timing.cc charpool.cc services.cc protocols.cc nmap_rpc.cc portlist.cc NmapOps.cc TargetGroup.cc Target.cc FingerPrintResults.cc service_scan.cc NmapOutputTable.cc MACLookup.cc nmap_tty.cc nmap_dns.cc traceroute.cc portreasons.cc $(NSE_SRC) @COMPAT_SRCS@

export HDRS = charpool.h FingerPrintResults.h global_structures.h idle_scan.h MACLookup.h nmap_amigaos.h nmap_dns.h nmap_error.h nmap.h NmapOps.h NmapOutputTable.h nmap_rpc.h nmap_tty.h nmap_winconfig.h osscan.h osscan2.h output.h payload.h portlist.h protocols.h scan_engine.h service_scan.h services.h TargetGroup.h Target.h targets.h tcpip.h timing.h utils.h traceroute.h portreasons.h $(NSE_HDRS)

OBJS = main.o nmap.o targets.o tcpip.o nmap_error.o utils.o idle_scan.o osscan.o osscan2.o output.o payload.o scan_engine.o timing.o charpool.o services.o protocols.o nmap_rpc.o portlist.o NmapOps.o TargetGroup.o Target.o FingerPrintResults.o service_scan.o NmapOutputTable.o MACLookup.o nmap_tty.o nmap_dns.o  traceroute.o portreasons.o $(NSE_OBJS) @COMPAT_OBJS@

# %.o : %.cc -- nope this is a GNU extension
.cc.o:
        $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@

all: @LUA_BUILD@ @PCAP_BUILD@ @PCRE_BUILD@ @DNET_BUILD@ @NBASE_BUILD@ @NSOCK_BUILD@ @NCAT_BUILD@
        $(MAKE) $(TARGET) $(BUILDZENMAP) $(BUILDNDIFF)

$(TARGET): @LUA_DEPENDS@ @PCAP_DEPENDS@ @PCRE_DEPENDS@ @DNET_DEPENDS@ $(NBASEDIR)/libnbase.a $(NSOCKDIR)/src/libnsock.a $(OBJS)
        @echo Compiling nmap
        rm -f $@
        $(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)

pcre_build: $(LIBPCREDIR)/Makefile
        @echo Compiling libpcre; cd $(LIBPCREDIR) && $(MAKE)

dnet_build: $(LIBDNETDIR)/Makefile
        @echo Compiling libdnet; cd $(LIBDNETDIR) && $(MAKE)

pcap_build: $(LIBPCAPDIR)/Makefile
        @echo Compiling libpcap; cd $(LIBPCAPDIR) && $(MAKE)

nbase_build: $(NBASEDIR)/Makefile
        @echo Compiling libnbase;
        cd $(NBASEDIR) && $(MAKE)

nsock_build: $(NSOCKDIR)/src/Makefile nbase_build
        @echo Compiling libnsock;
        cd $(NSOCKDIR)/src && $(MAKE)

ncat_build: $(NCATDIR)/Makefile nbase_build nsock_build $(NCATDIR)/ncat.h
        cd $(NCATDIR) && $(MAKE)

lua_build: $(LIBLUADIR)/Makefile
        @echo Compiling liblua; cd $(LIBLUADIR) && $(MAKE) liblua.a CC="$(CC)" MYCFLAGS="$(CFLAGS) @LUA_CFLAGS@"

#$(LIBPCAPDIR)/Makefile:
# @echo Configuring libpcap; cd $(LIBPCAPDIR); ./configure


# Make a statically compiled binary for portability between distributions
static:
        $(MAKE) STATIC=-static

debug:
        $(MAKE) DBGFLAGS="-O0 -g -pg -ftest-coverage -fprofile-arcs"

# CALL THIS FROM ONE COMPUTER AND CHECK IN RESULTS BEFORE DOING ANYONE
# DOES A MAKE RELEASE
prerelease:
        cd $(NMAPDEVDIR) && $(MAKE) prerelease

# Make just the Nmap tarballs
release-tarballs:
        cd $(NMAPDEVDIR) && $(MAKE) release-tarballs

# Make the tarballs and RPMs (which are built from tarball)
release-rpms:
        cd $(NMAPDEVDIR) && $(MAKE) release-rpms

# Update the web site
web:
        cd $(NMAPDEVDIR) && $(MAKE) web

clean: @LUA_CLEAN@ @PCAP_CLEAN@ @PCRE_CLEAN@ @DNET_CLEAN@ nsock_clean nbase_clean my_clean @ZENMAP_CLEAN@ @NCAT_CLEAN@

my_clean:
        rm -f dependencies.mk makefile.dep
        rm -f $(OBJS) $(TARGET) config.cache
pcap_clean:
        -cd $(LIBPCAPDIR) && $(MAKE) clean
pcre_clean:
        -cd $(LIBPCREDIR) && $(MAKE) clean
dnet_clean:
        -cd $(LIBDNETDIR) && $(MAKE) clean
nbase_clean:
        -cd $(NBASEDIR) && $(MAKE) clean
nsock_clean:
        -cd $(NSOCKDIR)/src && $(MAKE) clean
ncat_clean:
        -cd $(NCATDIR) && $(MAKE) clean
lua_clean:
        -cd $(LIBLUADIR) && $(MAKE) clean
zenmap_clean:
        -cd $(ZENMAPDIR) && $(PYTHON) setup.py clean --all
ndiff_clean:
        -cd $(NDIFFDIR) && $(PYTHON) setup.py clean --all
pcap_dist_clean:
        -cd $(LIBPCAPDIR) && $(MAKE) distclean
pcre_dist_clean:
        -cd $(LIBPCREDIR) && $(MAKE) distclean
dnet_dist_clean:
        -cd $(LIBDNETDIR) && $(MAKE) distclean
lua_dist_clean:
        -cd $(LIBLUADIR) && $(MAKE) clean
nbase_dist_clean:
        -cd $(NBASEDIR) && $(MAKE) distclean
nsock_dist_clean:
        -cd $(NSOCKDIR)/src && $(MAKE) distclean
ncat_dist_clean:
        -cd $(NCATDIR) && $(MAKE) distclean
zenmap_dist_clean: zenmap_clean
        -cd $(ZENMAPDIR) && rm -rf MANIFEST build/ dist/
ndiff_dist_clean: ndiff_clean
        -cd $(NDIFFDIR) && rm -rf build/ dist/
debugclean:
        rm -f *.gcov *.gcda *.gcno gmon.out

distclean: my_clean my_distclean @LUA_DIST_CLEAN@ @PCAP_DIST_CLEAN@ @PCRE_DIST_CLEAN@ @DNET_DIST_CLEAN@ @ZENMAP_DIST_CLEAN@ @NCAT_DIST_CLEAN@ nbase_dist_clean nsock_dist_clean

my_distclean:
        rm -f Makefile Makefile.bak makefile.dep nmap_config.h stamp-h stamp-h.in \
                 config.cache config.log config.status

install-nmap: $(TARGET)
        $(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(nmapdatadir)
        $(INSTALL) -c -m 755 nmap $(DESTDIR)$(bindir)/nmap
# Use strip -x to avoid stripping dynamically loaded NSE functions. See
# http://seclists.org/nmap-dev/2007/q4/0272.html.
        $(STRIP) -x $(DESTDIR)$(bindir)/nmap
        $(INSTALL) -c -m 644 docs/$(TARGET).1 $(DESTDIR)$(mandir)/man1/
        if [ "$(USE_NLS)" = "yes" ]; then \
          for ll in $(filter $(ALL_LINGUAS),$(LINGUAS)); do \
            $(INSTALL) -d $(DESTDIR)$(mandir)/$$ll/man1; \
            $(INSTALL) -c -m 644 docs/$(TARGET)-$$ll.1 $(DESTDIR)$(mandir)/$$ll/man1/$(TARGET).1; \
          done; \
        fi
        $(INSTALL) -c -m 644 docs/nmap.xsl $(DESTDIR)$(nmapdatadir)/
        $(INSTALL) -c -m 644 docs/nmap.dtd $(DESTDIR)$(nmapdatadir)/
        $(INSTALL) -c -m 644 nmap-services $(DESTDIR)$(nmapdatadir)/
        $(INSTALL) -c -m 644 nmap-rpc $(DESTDIR)$(nmapdatadir)/
        $(INSTALL) -c -m 644 nmap-os-db $(DESTDIR)$(nmapdatadir)/
        $(INSTALL) -c -m 644 nmap-service-probes $(DESTDIR)$(nmapdatadir)/
        $(INSTALL) -c -m 644 nmap-protocols $(DESTDIR)$(nmapdatadir)/
        $(INSTALL) -c -m 644 nmap-mac-prefixes $(DESTDIR)$(nmapdatadir)/

# Update the Ncat version number.
$(NCATDIR)/ncat.h: nmap.h
        sed -e 's/^#[ \t]*define[ \t]\+NCAT_VERSION[ \t]\+\(".*"\)/#define NCAT_VERSION "$(NMAP_VERSION)"/' $@ > $@.tmp
        mv -f $@.tmp $@

# Update the version number used by Zenmap.
$(ZENMAPDIR)/zenmapCore/Version.py $(ZENMAPDIR)/share/zenmap/config/zenmap_version: nmap.h
        cd $(ZENMAPDIR) && $(PYTHON) install_scripts/utils/version_update.py "$(NMAP_VERSION)"

# By default distutils rewrites installed scripts to hardcode the
# location of the Python interpreter they were built with (something
# like #!/usr/bin/python2.4). This is the wrong thing to do when
# installing on a machine other than the one used to do the build. Use
# this as the location of the interpreter whenever we're not doing a
# local installation.
DEFAULT_PYTHON_PATH = /usr/bin/env python

build-zenmap: $(ZENMAPDIR)/setup.py $(ZENMAPDIR)/zenmapCore/Version.py
# When DESTDIR is defined, assume we're building an executable
# distribution rather than a local installation and force a generic
# Python interpreter location.
        cd $(ZENMAPDIR) && $(PYTHON) setup.py build $(if $(DESTDIR),--executable "$(DEFAULT_PYTHON_PATH)")

install-zenmap: $(ZENMAPDIR)/setup.py
        $(INSTALL) -d $(DESTDIR)$(bindir) $(DESTDIR)$(mandir)/man1
        cd $(ZENMAPDIR) && $(PYTHON) setup.py install --prefix "$(prefix)" --force $(if $(DESTDIR),--root "$(DESTDIR)")
        $(INSTALL) -c -m 644 docs/zenmap.1 $(DESTDIR)$(mandir)/man1/
# Create a symlink from nmapfe to zenmap if nmapfe doesn't exist or is
# already a link.
        if [ ! -f $(DESTDIR)$(bindir)/nmapfe -o -L $(DESTDIR)$(bindir)/nmapfe ]; then \
                ln -sf zenmap $(DESTDIR)$(bindir)/nmapfe; \
        fi
# Create a symlink from xnmap to zenmap unconditionally.
        ln -sf zenmap $(DESTDIR)$(bindir)/xnmap

build-ndiff:
        cd $(NDIFFDIR) && $(PYTHON) setup.py build $(if $(DESTDIR),--executable "$(DEFAULT_PYTHON_PATH)")

install-ndiff:
        cd $(NDIFFDIR) && $(PYTHON) setup.py install --prefix "$(prefix)" $(if $(DESTDIR),--root "$(DESTDIR)")

NSE_FILES = scripts/script.db scripts/*.nse
NSE_LIB_LUA_FILES = nselib/*.lua
NSE_LIB_DATA_FILES = nselib/data/*

install-nse: $(TARGET)
        $(INSTALL) -c -m 644 nse_main.lua $(DESTDIR)$(nmapdatadir)/
        $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/scripts
        $(INSTALL) -c -m 644 $(NSE_FILES) $(DESTDIR)$(nmapdatadir)/scripts
        $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib
        $(INSTALL) -c -m 644 $(NSE_LIB_LUA_FILES) $(DESTDIR)$(nmapdatadir)/nselib
        $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data
        for f in `find nselib/data -name .svn -prune -o -type d -print`; do \
                $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/$$f; \
        done
        for f in `find nselib/data -name .svn -prune -o -type f -print`; do \
                        $(INSTALL) -c -m 644 $$f $(DESTDIR)$(nmapdatadir)/$$f; \
        done

install-ncat: $(NCATDIR)/ncat
        @cd $(NCATDIR) && $(MAKE) install

install: install-nmap $(INSTALLNSE) $(INSTALLZENMAP) @NCAT_INSTALL@ $(INSTALLNDIFF)
        @echo "NMAP SUCCESSFULLY INSTALLED"

uninstall: uninstall-nmap $(UNINSTALLZENMAP) @NCAT_UNINSTALL@

uninstall-nmap:
        rm -f $(DESTDIR)$(bindir)/$(TARGET)
        rm -f $(DESTDIR)$(mandir)/man1/$(TARGET).1
        rm -f $(DESTDIR)$(mandir)/*/man1/$(TARGET).1
        rm -rf $(DESTDIR)$(nmapdatadir)

uninstall-zenmap:
        cd $(ZENMAPDIR) && $(PYTHON) setup.py uninstall
        rm -f $(DESTDIR)$(mandir)/man1/zenmap.1
# Uninstall nmapfe only if it's a symlink.
        if [ -L $(DESTDIR)$(bindir)/nmapfe ]; then \
                rm -f $(DESTDIR)$(bindir)/nmapfe; \
        fi
        rm -f $(DESTDIR)$(bindir)/xnmap

uninstall-ncat:
        @cd $(NCATDIR) && $(MAKE) uninstall

${srcdir}/configure: configure.ac
        cd ${srcdir} && autoconf

## autoheader might not change config.h.in, so touch a stamp file.
#${srcdir}/config.h.in: stamp-h.in
#${srcdir}/stamp-h.in: configure.ac acconfig.h \
# config.h.top config.h.bot
# cd ${srcdir} && autoheader
# echo timestamp > ${srcdir}/stamp-h.in
#
#config.h: stamp-h
#stamp-h: config.h.in config.status
# ./config.status

Makefile: Makefile.in config.status
        ./config.status

config.status: configure
        ./config.status --recheck

makefile.dep:
        $(CXX) -MM $(CPPFLAGS) $(SRCS) > $@
include makefile.dep

Index: nmap/Makefile.in
===================================================================
--- nmap/Makefile.in (revision 16075)
+++ nmap/Makefile.in (working copy)
@@ -280,7 +280,12 @@
  $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib
  $(INSTALL) -c -m 644 $(NSE_LIB_LUA_FILES) $(DESTDIR)$(nmapdatadir)/nselib
  $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data
- $(INSTALL) -c -m 644 $(NSE_LIB_DATA_FILES) $(DESTDIR)$(nmapdatadir)/nselib/data
+ for f in `find nselib/data -name .svn -prune -o -type d -print`; do \
+ $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/$$f; \
+ done
+ for f in `find nselib/data -name .svn -prune -o -type f -print`; do \
+ $(INSTALL) -c -m 644 $$f $(DESTDIR)$(nmapdatadir)/$$f; \
+ done
 
 install-ncat: $(NCATDIR)/ncat
  @cd $(NCATDIR) && $(MAKE) install

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/

Re: make install error - nselib/data/psexec - Potential Fix

by David Fifield :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Nov 13, 2009 at 11:34:24PM -0600, Tom Sellers wrote:

> Corey Chandler wrote:
>> Ron wrote:
>>> David Fifield wrote:
>>>  
>>>> I made a mistake in the above commands. That still try to install
>>>> directories, but it happens to work because the for loop isolates the
>>>> error from make. This is better:
>>>>
>>>>      $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data
>>>>      $(INSTALL) -d $(DESTDIR)$(nmapdatadir)/nselib/data/psexec
>>>>      for f in `find nselib/data -name .svn -prune -o -type f
>>>> -print`; do \
>>>>          $(INSTALL) -c -m 644 $$f $(DESTDIR)$(nmapdatadir)/$$f; \
>>>>      done
>>>>
>>>> David Fifield
>>>>    
>>>
>>>
>>> Well, another solution is to get rid of the 'psexec' folder in the data
>>> directory and put all its files in 'data', but they're pretty specific
>>> so it probably doesn't make sense.
>>>
>>> I'll go with whatever solution you think is best. I'm not really a
>>> Makefile expert, so I'll trust your capable hands.
>
> Ok, I think I have this fixed.  Based on my reading of the problem the
> error message,
>
> /usr/bin/install: omitting directory `nselib/data/psexec'
> make: *** [install-nse] Error 1
>
> is due to the following line using a wildcard whose results include a
> directory "psexec":
>
> $(INSTALL) -c -m 644 $(NSE_LIB_DATA_FILES) $(DESTDIR)$(nmapdatadir)/nselib/data
>
> Interestingly, there was a chance of this happening before, two lines
> up, where the "nselib" directory contents are handled.  In that case
> the NSE_LIB_LUA_FILES variable specifies *.lua, avoiding the issue by
> not processing the directory "data".  Since the "data" folder contains
> files with various extensions and some without this would not work.
>
> I figure that it would be unlikely that we would change all of the
> file names in nselib/data to include some extension and that if we
> did, it would just break later.
>
> So I took David's code above as an example and modified it to process
> the "nselib/data" directory twice, once to create directories, then
> again to copy the files.
>
> The benefit of this process is that if further directories created
> under nselib/data they will automatically be picked up.  The downside
> is that some undesirable files, such as *.c and *.vcproj, will get
> moved as well.

Thanks, Tom, this works for me on GNU/Linux and Mac OS X. Ron, which
files from the psexec directory are not meant to be installed?

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/

Re: make install error - nselib/data/psexec - Potential Fix

by Ron (list) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

David Fifield wrote:
> Thanks, Tom, this works for me on GNU/Linux and Mac OS X. Ron, which
> files from the psexec directory are not meant to be installed?
>
> David Fifield

The ones that SHOULD NOT be installed are *.c and *.vcproj.

The ones that SHOULD be installed are *.lua and *.exe.

I'd probably whitelist *.lua + *.exe rather than trying to eliminate
everything else.

Ron

--
Ron Bowes
http://www.skullsecurity.org/
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/