ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

Fixing installation of bash script

asked 2019-04-01 05:53:30 -0500

aPonza gravatar image

updated 2019-04-11 11:07:29 -0500

Playing with catkin_lint, I found out about this mistake:

$ catkin lint -W2 --pkg my_pkg
my_pkg: warning: file 'scripts/foo.sh' is executable but not installed

but in my CMakelists I have:

install(DIRECTORY scripts/
    DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}  # with or without a "/scripts" here the result doesn't change
    PATTERN ".svn" EXCLUDE
)

and have also tried with:

install(FILES
    scripts/foo.sh
  DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}  # with or without a "/scripts" here the result doesn't change
)

All these methods still leave the warning on the catkin lint side!

In all four cases I get a correct installation of the script in the install directory, but I have to manually chmod +x it. The output from rosrun is:

$ rosrun my_pkg foo.sh
[rosrun] Couldn't find executable named foo.sh below /home/<user>/catkin_ws/install/share/my_pkg
[rosrun] Found the following, but they're either not files,
[rosrun] or not executable:
[rosrun]   /home/<user>/catkin_ws/install/share/my_pkg/foo.sh   # or ...my_pkg/scripts/foo.sh
edit retag flag offensive close merge delete

Comments

This could just be a limitation of catkin_lint. Perhaps posting an issue on the tracker would be in order.

Or, it could be because for shell scripts, the type should be set to PROGRAMS, not FILES or DIRECTORY.

gvdhoorn gravatar image gvdhoorn  ( 2019-04-11 15:52:36 -0500 )edit

I was being wary of opening another issue for nothing like last time, and for a good reason it seems. Again, thanks!

aPonza gravatar image aPonza  ( 2019-04-12 03:30:08 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2019-04-12 03:31:55 -0500

aPonza gravatar image

updated 2021-07-05 11:33:26 -0500

lucasw gravatar image

The correct syntax is with PROGRAMS instead of FILES and using the BIN destination, not the SHARE one.

install(PROGRAMS scripts/foo.sh
  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}/scripts
)
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2019-04-01 05:53:30 -0500

Seen: 1,262 times

Last updated: Jul 05 '21