From e32d130b7ea0430cc9ca27c5b036725d38221eca Mon Sep 17 00:00:00 2001
From: Brian Carrier <carrier@sleuthkit.org>
Date: Wed, 6 Feb 2019 11:38:03 -0500
Subject: [PATCH] Update unix_setup version with other versions instead of in
 build-zip

---
 build.xml                                   |  1 -
 release_scripts/update_sleuthkit_version.pl | 40 ++++++++++++++++++---
 unix_setup.sh                               |  4 ++-
 3 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/build.xml b/build.xml
index 5616cb2c66..baeacc0a04 100644
--- a/build.xml
+++ b/build.xml
@@ -102,7 +102,6 @@
         <copy file="${basedir}/NEWS.txt" tofile="${zip-tmp}/${app.name}/NEWS.txt"/>
         <copy file="${basedir}/Running_Linux_OSX.txt" tofile="${zip-tmp}/${app.name}/Running_Linux_OSX.txt"/>
         <copy file="${basedir}/unix_setup.sh" tofile="${zip-tmp}/${app.name}/unix_setup.sh"/>
-        <replaceregexp file="${zip-tmp}/${app.name}/unix_setup.sh" match="TSK_VERSION=(.*)" replace="TSK_VERSION=${TSK_VERSION}" byline="true"/>
         <unzip src="${thirdparty.dir}/gstreamer/windows/i386/0.10.7/gstreamer.zip" dest="${zip-tmp}/${app.name}/gstreamer"/>
             
         
diff --git a/release_scripts/update_sleuthkit_version.pl b/release_scripts/update_sleuthkit_version.pl
index e630e4890b..89b0c42de5 100755
--- a/release_scripts/update_sleuthkit_version.pl
+++ b/release_scripts/update_sleuthkit_version.pl
@@ -31,14 +31,13 @@ sub main {
 	update_tsk_version();
 	update_core_project_properties();
 	update_core_project_xml();
-	
+    update_unix_setup();
+    
 	print "Files updated.  You need to commit and push them\n";
 }
 
 
 
-
-
 ######################################################
 # Utility functions
 
@@ -194,6 +193,39 @@ sub update_core_project_xml {
 }
 
 
+# update the tskversion.xml
+sub update_unix_setup {
+    
+    my $orig = "unix_setup.sh";
+    my $temp = "${orig}-bak";
+    
+    print "Updating the version in ${orig}\n";
+    
+    open (CONF_IN, "<${orig}") or die "Cannot open ${orig}";
+    open (CONF_OUT, ">${temp}") or die "Cannot open ${temp}";
+    
+    my $found = 0;
+    while (<CONF_IN>) {
+        if (/^TSK_VERSION=/) {
+            print CONF_OUT "TSK_VERSION=${VER}\n";
+            $found++;
+        }
+        else {
+            print CONF_OUT $_;
+        }
+    }
+    close (CONF_IN);
+    close (CONF_OUT);
+    
+    if ($found != 1) {
+        die "$found (instead of 1) occurrences of TSK_VERSION found in ${orig}";
+    }
+    
+    unlink ($orig) or die "Error deleting ${orig}";
+    rename ($temp, $orig) or die "Error renaming tmp $orig file";
+    system("git add ${orig}") unless ($TESTING);
+    
+}
 
 
-main();
\ No newline at end of file
+main();
diff --git a/unix_setup.sh b/unix_setup.sh
index 04766c7bc4..328f25c2d0 100755
--- a/unix_setup.sh
+++ b/unix_setup.sh
@@ -2,7 +2,9 @@
 
 # Verifies programs are installed and copies native code into the Autopsy folder structure
 
-TSK_VERSION=4.6.3
+# NOTE: update_sleuthkit_version.pl updates this value and relies
+# on it keeping the same name and whitespace.  Don't change it.
+TSK_VERSION=4.6.5
 
 # Verify PhotoRec was installed
 photorec_filepath=/usr/bin/photorec
-- 
GitLab