LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Try to remove previous installation and create a package but got an error (https://www.linuxquestions.org/questions/linux-newbie-8/try-to-remove-previous-installation-and-create-a-package-but-got-an-error-800834/)

ethereal1m 04-08-2010 01:09 PM

Try to remove previous installation and create a package but got an error
 
Dear all,
I once installed a software using make install and uninstalled it manually (since I'm not familiar with make uninstall). But when I try to create a package using src2pkg from its binary, got an error.

Suppose this is the makefile:
Code:

TGT=noip2
CC=gcc
PKG=noip-2.1.tgz

PREFIX=/usr/local
CONFDIR=${PREFIX}/etc
BINDIR=${PREFIX}/bin

# these defines are for Linux
LIBS=
ARCH=linux

# for Mac OS X and BSD systems that have getifaddr(), uncomment the next line
#ARCH=bsd_with_getifaddrs

# for early BSD systems without getifaddrs(), uncomment the next line
#ARCH=bsd


# for solaris, uncomment the next two lines
# LIBS=-lsocket -lnsl
# ARCH=sun

${TGT}: Makefile ${TGT}.c
        ${CC} -Wall -g -D${ARCH} -DPREFIX=\"${PREFIX}\" ${TGT}.c -o ${TGT} ${LIBS}

install: ${TGT}
        if [ ! -d ${BINDIR} ]; then mkdir -p ${BINDIR};fi
        if [ ! -d ${CONFDIR} ]; then mkdir -p ${CONFDIR};fi
        cp ${TGT} ${BINDIR}/${TGT}
        ${BINDIR}/${TGT} -C -c /tmp/no-ip2.conf
        mv /tmp/no-ip2.conf ${CONFDIR}/no-ip2.conf

package: ${TGT}
        rm  -f *.bak
        mv ${TGT} binaries/${TGT}-`uname -m`
        scp a-k:/local/bin/noip2 binaries/noip2-`ssh a-k uname -m`
        cd ..; tar zcvf /tmp/${PKG} noip-2.0/*
        scp /tmp/${PKG} a-k:/opt/www/${PKG}
        rm /tmp/${PKG}

clean:
        rm -f *o
        rm -f binaries/*
        rm -f ${TGT}

And to uninstall, I deleted /usr/local/etc/noip.conf and /usr/loca/bin/noip

Then I did src2pkg:
Code:

root@firefly:/home/ethereal1m/src# src2pkg -VV -W noip-duc-linux.tar.gz
Found global src2pkg.conf - Reading /etc/src2pkg/src2pkg.conf         
Found source archive: noip-duc-linux.tar.gz                           
Creating working directories:                                         
  PKG_DIR=/tmp/noip-duc-linux-x86_64-1                               
  SRC_DIR=/tmp/noip-duc-linux-src-1                                   
Unpacking source archive -                                             
./._noip-2.1.9-1                                                       
noip-2.1.9-1/                                                         
noip-2.1.9-1/._binaries                                               
noip-2.1.9-1/binaries/                                                 
noip-2.1.9-1/binaries/._noip2-i686                                     
noip-2.1.9-1/binaries/noip2-i686                                       
noip-2.1.9-1/binaries/._noip2-x86_64                                   
noip-2.1.9-1/binaries/noip2-x86_64                                     
noip-2.1.9-1/._COPYING                                                 
noip-2.1.9-1/COPYING                                                   
noip-2.1.9-1/._debian.noip2.sh                                         
noip-2.1.9-1/debian.noip2.sh                                           
noip-2.1.9-1/._gentoo.noip2.sh                                         
noip-2.1.9-1/gentoo.noip2.sh                                           
noip-2.1.9-1/._LEEME.PRIMERO                                           
noip-2.1.9-1/LEEME.PRIMERO                                             
noip-2.1.9-1/._LIESMICH.ERST.deutsch                                   
noip-2.1.9-1/LIESMICH.ERST.deutsch                                     
noip-2.1.9-1/._LISEZMOI.ENPREMIER                                     
noip-2.1.9-1/LISEZMOI.ENPREMIER                                       
noip-2.1.9-1/._mac.osx.startup                                         
noip-2.1.9-1/mac.osx.startup                                           
noip-2.1.9-1/._Makefile                                               
noip-2.1.9-1/Makefile                                                 
noip-2.1.9-1/._noip2.c                                                 
noip-2.1.9-1/noip2.c                                                   
noip-2.1.9-1/._README.FIRST                                           
noip-2.1.9-1/README.FIRST                                             
noip-2.1.9-1/._README.FIRST-SWE                                       
noip-2.1.9-1/README.FIRST-SWE                                         
noip-2.1.9-1/._README.FIRST.FRANCAIS                                   
noip-2.1.9-1/README.FIRST.FRANCAIS                                     
noip-2.1.9-1/._README.FIRST.ITALIANO                                   
noip-2.1.9-1/README.FIRST.ITALIANO                                     
noip-2.1.9-1/._README.FIRST.JAPANESE                                   
noip-2.1.9-1/README.FIRST.JAPANESE                                     
noip-2.1.9-1/._README.FIRST.pt_BR                                     
noip-2.1.9-1/README.FIRST.pt_BR                                       
noip-2.1.9-1/._README.FIRST_PT                                         
noip-2.1.9-1/README.FIRST_PT                                           
noip-2.1.9-1/._redhat.noip.sh                                         
noip-2.1.9-1/redhat.noip.sh                                           

Correcting source permissions - Done
Checking for patches - None found 
Skipping configuration: Nothing to be done
Continuing - We found at least one Makefile
Compiling sources - Using: 'make'         
Compiler Messages:                       
gcc -Wall -g -Dlinux -DPREFIX=\"/usr/local\" noip2.c -o noip2
Compiling has been - Successful!                             
Checking for Makefile rule: 'install' Okay                   
Creating content in JAIL root - Using: 'make install'       
if [ ! -d /usr/local/bin ]; then mkdir -p /usr/local/bin;fi 
if [ ! -d /usr/local/etc ]; then mkdir -p /usr/local/etc;fi 
cp noip2 /usr/local/bin/noip2                               
/usr/local/bin/noip2 -C -c /tmp/no-ip2.conf                 
make: /usr/local/bin/noip2: Command not found               
make: *** [install] Error 127                               
Safe content creation - Successful!                         
Processing package content:                                 
Correcting package permissions - Done                       
Stripping ELF binaries - Using: strip -p --strip-unneeded Done
Checking for standard documents - Done                       
Creating slack-desc - From default text                     
Searching for links in: noip-duc-linux-x86_64-1 - None found 
Rechecking package correctness -                             
Checking for misplaced dirs -                               
  Notice - Package contains /usr/local directory, but PRE_FIX is: /usr
  You may need to patch the Makefile(s) to correct the installation prefix.
  FATAL! This build installs faulty directories or files.                 
  You must fix the build as suggested above, or override this action with:
  FAIL_ON_BAD_DIRS=NO from the command-line or in your src2pkg.conf file.

I don't understand why I got the following errors:
Code:

make: /usr/local/bin/noip2: Command not found               
make: *** [install] Error 127

And also I don't understand why it is complaining that PRE_FIX is /usr whereas according to MAKEFILE PRE_FIX is /usr/local. Where did it get a change?

Regards,
ethereal1m

crts 04-09-2010 06:19 AM

Hi,

I am not familiar with src2pkg, however,
Quote:

And also I don't understand why it is complaining that PRE_FIX is /usr whereas according to MAKEFILE PRE_FIX is /usr/local. Where did it get a change?
PREFIX is /usr/local and PRE_FIX is /usr. That's two different variables. I did not see PRE_FIX in your Makefile. Is it possible that PRE_FIX is set by src2pkg?

P.S.: I assume you posted the complete Makefile and not just an excerpt.

crts 04-09-2010 06:24 AM

As for your error
Code:

cp noip2 /usr/local/bin/noip2                               
/usr/local/bin/noip2 -C -c /tmp/no-ip2.conf                 
make: /usr/local/bin/noip2: Command not found               
make: *** [install] Error 127                               
Safe content creation - Successful!                         
Processing package content:                                 
Correcting package permissions - Done

This looks like a sanity check. /usr/local/bin/noip2 probably just did not have execute permissions and it was automatically corrected. If it would not have been copied to /usr/local/bin then cp would have thrown an error.

Hope this helps.

crts 04-09-2010 06:40 AM

Hi again,

just downloaded src2pkg. according to that script you should be able to set PRE_FIX by the --prefix, --pre_fix or -p option. All should work the same way. So try something like
Code:

src2pkg --prefix=/usr/local <your other options>
If you ommit --prefix it defaults to /usr.

ethereal1m 04-09-2010 12:08 PM

crts .... very nice thanks for clearing things up


All times are GMT -5. The time now is 06:10 AM.