Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Software] checkinstall breaks cp?

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
Vbbab
Posts: 2
Joined: 2023-11-24 07:25
Has thanked: 1 time

[Software] checkinstall breaks cp?

#1 Post by Vbbab »

Hi everyone,

I was experimenting with using checkinstall with a custom install script, and ran into a really weird problem that I'm not sure whether it's caused by a bug in checkinstall or my inability to properly use it. Specifically, for one of my own projects, the "install" script simply involves copying a build folder to /usr/local, so I made the following install.sh file:

Code: Select all

cp -rv myproj /usr/local/ # myproj is the directory I'm trying to copy
To use checkinstall, I run the following command as root in the directory of the install.sh file and go through the regular prompts:

Code: Select all

checkinstall ./install.sh
However, during the install step of checkinstall, this very strange error happens:

Code: Select all

cp: cannot stat '/usr/local/myproj': No such file or directory
This makes no sense for me, because of course /usr/local/myproj doesn't exist -- that's the point of the script! But since the script works when I simply run it as root, and without checkinstall, I suspect that cp is doing some post-copy verification here or something and that's somehow failing (perhaps due to the temporary environment set up by checkinstall?).

If anyone could help me figure out what's going on here, that would be greatly appreciated. Please let me know if you need any more info!
Thank you!

Aki
Global Moderator
Global Moderator
Posts: 2979
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 75 times
Been thanked: 407 times

Re: [Software] checkinstall breaks cp?

#2 Post by Aki »

Hello,

You can make the checkinstall script be more verbose and generate a transcript of the activies done; for example:

Code: Select all

script checkinstall.log
bash -xv $(which checkinstall) install.sh
exit
Then, you can analyse or share the transcript named checkinstall.log.

Hope this helps.

note: moved from "General Question" to "Programming" sub-forum.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Vbbab
Posts: 2
Joined: 2023-11-24 07:25
Has thanked: 1 time

Re: [Software] checkinstall breaks cp?

#3 Post by Vbbab »

Hm.. that's strange; looking at the install section, I don't really see anything that indicates what might have gone wrong:

Code: Select all

========================= Installation results ===========================
+ /usr/bin/installwatch --logfile=/var/tmp/tmp.gbi2aWzL4K/newfiles.tmp --exclude=/home/xxx/myproj,/dev,/proc,/tmp,/var/tmp --root=/var/tmp/tmp.gbi2aWzL4K --transl=1 --backup=1 --dbglvl=0 /var/tmp/tmp.gbi2aWzL4K/installscript.sh
cp: cannot stat '/usr/local/myproj': No such file or directory
+ '[' 1 -eq 0 ']'
+ INSTALL_FAILED=1
Tell me if you need me to post other parts of the script; I have a weird prompt that kinda messes up parts of the log.

Aki
Global Moderator
Global Moderator
Posts: 2979
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 75 times
Been thanked: 407 times

Re: [Software] checkinstall breaks cp?

#4 Post by Aki »

Hello,

It is quite difficult to try to understand without the whole picture (the whole software project).

Therefore, that's a wild guess. This is a mockup of your project:

Code: Select all

$ ls -la ./myproj/
totale 16
drwxr-xr-x 2 aki aki 4096 25 nov 20.55 .
drwxr-xr-x 6 aki aki 4096 25 nov 20.54 ..
-rwxr--r-- 1 aki aki   24 25 nov 20.54 hello.sh
-rwxr--r-- 1 aki aki   26 25 nov 20.55 install.sh

$ cd myproj

$ cat install.sh 
cp -rv myproj /usr/local/

$ cat hello.sh 
#! /bin/sh
echo HELLO!

$ ./install.sh 
cp: cannot stat 'myproj': No such file or directory
Hope this helps.

EDIT:
your install script named "install.sh" is at fault. It works if you change it in:

Code: Select all

# Commented out
# cp -rv myproj /usr/local/

mkdir -p /usr/local/myproj/
cp -rv ./* /usr/local/myproj/
Here it is:

Code: Select all

~/myproj$ su -l -c "cd $PWD; checkinstall ./install.sh"
Password: 

checkinstall 1.6.3, Copyright 2010 Felipe Eduardo Sanchez Diaz Duran
           This software is released under the GNU GPL.


The package documentation directory ./doc-pak does not exist. 
Should I create a default set of package docs?  [y]: n

Please write a description for the package.
End your description with an empty line or EOF.
>> hello package
>> 
*****************************************
**** Debian package creation selected ***
*****************************************

This package will be built according to these values: 

0 -  Maintainer: [ root@debian-aki ]
1 -  Summary: [ hello package ]
2 -  Name:    [ myproj ]
3 -  Version: [ 20231125 ]
4 -  Release: [ 1 ]
5 -  License: [ GPL ]
6 -  Group:   [ checkinstall ]
7 -  Architecture: [ amd64 ]
8 -  Source location: [ myproj ]
9 -  Alternate source location: [  ]
10 - Requires: [  ]
11 - Recommends: [  ]
12 - Suggests: [  ]
13 - Provides: [ myproj ]
14 - Conflicts: [  ]
15 - Replaces: [  ]

Enter a number to change any of them or press ENTER to continue: 

Installing with ./install.sh...

========================= Installation results ===========================
'./description-pak' -> '/usr/local/myproj/description-pak'
'./hello.sh' -> '/usr/local/myproj/hello.sh'
'./install.sh' -> '/usr/local/myproj/install.sh'

======================== Installation successful ==========================

Copying files to the temporary directory...OK

Stripping ELF binaries and libraries...OK

Compressing man pages...OK

Building file list...OK

Building Debian package...OK

Installing Debian package...OK

Erasing temporary files...OK

Deleting temp dir...OK


**********************************************************************

 Done. The new package has been installed and saved to

 /home/aki/myproj/myproj_20231125-1_amd64.deb

 You can remove it from your system anytime using: 

      dpkg -r myproj

[..]
**********************************************************************

 Done. The new package has been installed and saved to

 /home/aki/myproj/myproj_20231125-1_amd64.deb

 You can remove it from your system anytime using: 

      dpkg -r myproj

**********************************************************************

~/myproj$ dpkg -c myproj_20231125-1_amd64.deb 
drwxr-xr-x root/root         0 2023-11-25 22:45 ./
drwxr-xr-x root/root         0 2023-11-25 22:45 ./usr/
drwxr-xr-x root/root         0 2023-11-25 22:45 ./usr/local/
drwxr-xr-x root/root         0 2023-11-25 22:45 ./usr/local/myproj/
-rw-r--r-- root/root        14 2023-11-25 22:45 ./usr/local/myproj/description-pak
-rwxr--r-- root/root        24 2023-11-25 22:45 ./usr/local/myproj/hello.sh
-rwxr--r-- root/root        86 2023-11-25 22:45 ./usr/local/myproj/install.sh
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Post Reply