From 1ba34f76afe0d0812fe6a9c5529959fcc6feab68 Mon Sep 17 00:00:00 2001 From: Dan Walkes Date: Wed, 29 Jan 2014 19:39:54 +0100 Subject: [PATCH] Add RedHat install scripts --- RedHat/opencv_latest.sh | 41 +++++++++++++++++++++++++++++ get_latest_version_download_file.sh | 19 +++++++++++++ 2 files changed, 60 insertions(+) create mode 100755 RedHat/opencv_latest.sh create mode 100644 get_latest_version_download_file.sh diff --git a/RedHat/opencv_latest.sh b/RedHat/opencv_latest.sh new file mode 100755 index 0000000..953b9ad --- /dev/null +++ b/RedHat/opencv_latest.sh @@ -0,0 +1,41 @@ +sudo yum -y install wget +. `dirname $0`/../get_latest_version_download_file.sh +if [ $? -ne 0 ]; then + exit $?; +fi +echo "Installing OpenCV" $version +mkdir -p OpenCV +cd OpenCV +echo "Installing Dependencies" +sudo yum -y install http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm +set -e +sudo yum -y groupinstall "Development Tools" +sudo yum -y install unzip opencv opencv-devel gtk2-devel +if [ ! -f $downloadfile ]; then + echo "Downloading OpenCV" $version + wget -O $downloadfile http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/$version/$downloadfile/download +fi +if [ ! -d opencv-$version ]; then + echo "Installing OpenCV" $version + echo $downloadfile | grep ".zip" + if [ $? -eq 0 ]; then + unzip $downloadfile + else + tar -xvf $downloadfile + fi +fi +cd opencv-$version +cmake --version | grep " 2.6" +if [ $? -eq 0 ]; then + # Delete lines beginning with string(MD5 based on incompatibility with cmake 2.6. See + # http://answers.opencv.org/question/24095/building-opencv-247-on-centos-6/ + sed -i '/string(MD5/d' cmake/cl2cpp.cmake +fi +mkdir -p build +cd build +cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local .. +make -j 4 +sudo make install +sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf' +sudo ldconfig +echo "OpenCV" $version "ready to be used" diff --git a/get_latest_version_download_file.sh b/get_latest_version_download_file.sh new file mode 100644 index 0000000..5907778 --- /dev/null +++ b/get_latest_version_download_file.sh @@ -0,0 +1,19 @@ +# Dan Walkes +# 2014-01-29 +# Find the latest version and download file link from the OpenCV sourceforge page + +version="$(wget -q -O - http://sourceforge.net/projects/opencvlibrary/files/opencv-unix | egrep -m1 -o '\"[0-9](\.[0-9])+' | cut -c2-)" +downloadfilelist="opencv-$version.tar.gz opencv-$version.zip" +downloadfile= +for file in $downloadfilelist; +do + wget --spider http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/$version/$file/download + if [ $? -eq 0 ]; then + downloadfile=$file + fi +done +if [ -z "$downloadfile" ]; then + echo "Could not find download file on sourceforge page. Please find the download file for version $version at" + echo "http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/$version/ and update this script" + exit 1 +fi