Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Fixing installation of bash script

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
)

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

Fixing installation of bash script

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