From aba5029ac0a2568b26618e108c63b442788b8618 Mon Sep 17 00:00:00 2001
From: Ward Fisher <wfisher@unidata.ucar.edu>
Date: Tue, 18 Nov 2014 12:52:41 -0700
Subject: [PATCH] Reorganized postinstall scripts.

---
 CMakeLists.txt                             | 4 ++--
 PostInstall.cmake                          | 2 +-
 fortran_install.sh.in => postinstall.sh.in | 5 +++--
 3 files changed, 6 insertions(+), 5 deletions(-)
 rename fortran_install.sh.in => postinstall.sh.in (96%)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 109fe92e9..43d254c63 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -314,8 +314,8 @@ ENDIF()
 IF(NOT MSVC)
   OPTION(BUILD_FORTRAN "Download and build netcdf-fortran automatically (EXPERIMENTAL)." OFF)
   IF(BUILD_FORTRAN)
-    CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/fortran_install.sh.in"
-      "${CMAKE_BINARY_DIR}/fortran_install.sh"
+    CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/postinstall.sh.in"
+      "${CMAKE_BINARY_DIR}/postinstall.sh"
       @ONLY)
   ENDIF(BUILD_FORTRAN)
 ENDIF()
diff --git a/PostInstall.cmake b/PostInstall.cmake
index 24e6226ca..c3fa9100b 100644
--- a/PostInstall.cmake
+++ b/PostInstall.cmake
@@ -1 +1 @@
-EXECUTE_PROCESS(COMMAND sh -c "${CMAKE_BINARY_DIR}/fortran_install.sh -t cmake")
\ No newline at end of file
+EXECUTE_PROCESS(COMMAND sh -c "${CMAKE_BINARY_DIR}/postinstall.sh -t cmake")
\ No newline at end of file
diff --git a/fortran_install.sh.in b/postinstall.sh.in
similarity index 96%
rename from fortran_install.sh.in
rename to postinstall.sh.in
index c460618ce..26ccf50ee 100755
--- a/fortran_install.sh.in
+++ b/postinstall.sh.in
@@ -45,10 +45,11 @@ esac
 
 if [ ! -d "netcdf-fortran" ]; then
     git clone http://github.com/unidata/netcdf-fortran
-    cd netcdf-fortran
-    git checkout v4.4.1
 fi
 
+cd netcdf-fortran
+git checkout v4.4.1
+
 ###
 # Invoke cmake to build netcdf-fortran
 ###