debian_postinst.in 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. case "$1" in
  3. configure)
  4. PLATFORM=`uname`
  5. ULTRAINFER_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@
  6. echo "=============== Information ======================"
  7. echo "UltraInfer Library Path: $ULTRAINFER_LIBRARY_PATH"
  8. echo "Platform: $PLATFORM"
  9. echo "=================================================="
  10. # Find all the .so files' path
  11. ALL_SO_FILES=`find $ULTRAINFER_LIBRARY_PATH -name "*.so*"`
  12. for SO_FILE in $ALL_SO_FILES;do
  13. LIBS_DIRECOTRIES[${#LIBS_DIRECOTRIES[@]}]=${SO_FILE%/*}
  14. done
  15. # Remove the duplicate directories
  16. LIBS_DIRECOTRIES=($(awk -v RS=' ' '!a[$1]++' <<< ${LIBS_DIRECOTRIES[@]}))
  17. IMPORT_PATH=""
  18. for LIB_DIR in ${LIBS_DIRECOTRIES[@]};do
  19. echo "Found Library Directory: $LIB_DIR"
  20. echo ${LIB_DIR} >> @CMAKE_INSTALL_PREFIX@/@CPACK_PACKAGE_NAME@.conf
  21. done
  22. if [ ! -d /etc/ld.so.conf.d ]; then
  23. mkdir -p /etc/ld.so.conf.d
  24. fi
  25. ln -sf @CMAKE_INSTALL_PREFIX@/@CPACK_PACKAGE_NAME@.conf /etc/ld.so.conf.d
  26. ldconfig
  27. echo "UltraInfer is successfully installed and configured."
  28. echo "Now please get started with UltraInfer examples at $ULTRAINFER_LIBRARY_PATH/examples."
  29. echo "And don't forget to set ULTRAINFER_INSTALL_DIR=$ULTRAINFER_LIBRARY_PATH in cmake when building examples."
  30. ;;
  31. *)
  32. echo "postinst called with unknown argument \`$1'" >&2
  33. exit 1
  34. esac