Commit d1451441 authored by Sergi Hernandez's avatar Sergi Hernandez
Browse files

Merge branch 'ubuntu_18_04' into 'master'

Added add_lib_to_ld_config.sh and remove_lib_from_ld_config.sh user scripts....

See merge request !2
parents 6da64934 5cf63596
Pipeline #12206 failed with stages
in 28 seconds
......@@ -31,3 +31,4 @@ update_repo:
only:
- tags
......@@ -102,7 +102,7 @@ IF (UNIX)
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "labrobotica - labrobotica@iri.upc.edu")
# Uncomment to add the necessary mantainer scripts
# SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/package_scripts/preinst;${CMAKE_SOURCE_DIR}/package_scripts/postinst;${CMAKE_SOURCE_DIR}/package_scripts/prerm;${CMAKE_SOURCE_DIR}/package_scripts/postrm")
SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/scripts/debian/postinst;${CMAKE_SOURCE_DIR}/scripts/debian/prerm")
# Uncomment to add dependencies comma separated
# SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri-<package_name>-dev (>= 1.0~${DISTRIB})")
......
......@@ -84,6 +84,26 @@ Run the commands on _add repository_ and _add key_ from [labrobotica_how_to inst
``` sudo apt update && sudo apt install iri-iriutils-dev ```
## Scripts
The following scripts located in `./scripts/` are provided:
* **add_lib_to_ld_config.sh**: To add the library path to ldconfig
- Usage:
./add_lib_to_ld_config.sh -l <library> [-p]
-l specify library name, for example iriutils"
-p specify if installed from package. Optional."
* **remove_lib_from_ld_config.sh**: To remove the library path from ldconfig
- Usage:
./remove_lib_from_ld_config.sh -l <library> [-p]
-l specify library name, for example iriutils"
-p specify if installed from package. Optional."
These scripts will be added to the PATH variable after installation.
## Disclaimer
Copyright (C) 2009-2018 Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
......
#!/bin/bash
set -e
FILE="/etc/ld.so.conf.d/iri.conf"
LIB=
LOCAL="local/"
usage() {
echo "Usage: $0 -l <library> [-p]"
echo " -l specify library name"
echo " -p specify if installed from package. Optional."
exit 1
}
while getopts ":hl:p" arg; do
case $arg in
l) LIB=$OPTARG;;
p) LOCAL="";;
h) usage;;
*) usage;;
esac
done
if [ -z "$LIB" ]
then
echo "Error: no library specified"
usage
fi
sudo touch $FILE
LINE="/usr/${LOCAL}lib/iri/${LIB}"
echo "Adding ${LINE} to ${FILE}..."
grep -qF -- "$LINE" "$FILE" || echo "$LINE" | sudo tee -a "$FILE" > /dev/null
sudo ldconfig
echo "Done."
#!/bin/bash
set -e
case "$1" in
configure)
echo " Adding iri-scripts-path.sh to /etc/profile.d..."
FILE="/etc/profile.d/iri-scripts-path.sh"
sudo echo "# Expand PATH to include the directory where IRI scripts go." > $FILE
sudo echo "iri_script_path=\"/usr/local/share/iri:/usr/share/iri\"" >> $FILE
sudo echo "if [ -n \"\${PATH##*\${iri_script_path}}\" -a -n \"\${PATH##*\${iri_script_path}:*}\" ]; then" >> $FILE
sudo echo " export PATH=\$PATH:\${iri_script_path}" >> $FILE
sudo echo "fi" >> $FILE
echo " Done. It's necessary a log out for changes to take effect."
echo " Trying to add library to ldconfig..."
/usr/share/iri/add_lib_to_ld_config.sh -l iriutils -p && echo " Done." || echo " /usr/share/iri/add_lib_to_ld_config.sh doesn't exists. Download it from iriutils and execute it."
;;
abort-upgrade)
;;
abort-remove)
;;
abort-deconfigure)
;;
esac
exit 0
#!/bin/bash
set -e
case "$1" in
remove)
echo " Trying to remove library from ldconfig..."
/usr/share/iri/remove_lib_from_ld_config.sh -l iriutils -p && echo " Done." || echo " /usr/share/iri/remove_lib_from_ld_config.sh doesn't exists. Download it from iriutils and execute it."
;;
upgrade)
;;
deconfigure)
;;
failed-upgrade)
;;
esac
exit 0
#!/bin/bash
set -e
FILE="/etc/ld.so.conf.d/iri.conf"
LIB=
LOCAL="local\/"
usage() {
echo "Usage: $0 -l <library> [-p]"
echo " -l specify library name"
echo " -p specify if installed from package. Optional."
exit 1
}
while getopts ":hl:p" arg; do
case $arg in
l) LIB=$OPTARG;;
p) LOCAL="";;
h) usage;;
*) usage;;
esac
done
if [ -z "$LIB" ]
then
echo "Error: no library specified"
usage
fi
sudo touch $FILE
echo "Removing /usr/${LOCAL}lib/iri/${LIB} from ${FILE}..."
LINE="\/usr\/${LOCAL}lib\/iri\/${LIB}"
sudo sed -i "/$LINE/d" $FILE
sudo ldconfig
echo "Done."
......@@ -28,4 +28,10 @@ INSTALL(FILES ${headers} DESTINATION include/iri/${PROJECT_NAME})
INSTALL(FILES ../Findiriutils.cmake DESTINATION ${CMAKE_ROOT}/Modules/)
INSTALL(FILES ../scripts/add_lib_to_ld_config.sh
../scripts/remove_lib_from_ld_config.sh
DESTINATION share/iri
PERMISSIONS OWNER_EXECUTE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE)
ADD_SUBDIRECTORY(examples)
......@@ -74,13 +74,7 @@ void CMutex::exit(void)
CMutex::~CMutex()
{
int error=0;
this->try_enter();
this->exit();
if((error=pthread_mutex_destroy(&this->access))!=0)
{
/* handle exception */
throw CMutexException(_HERE_,"Impossible to destroy the mutex.\n");
}
pthread_mutex_destroy(&this->access);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment