From b9379b3ae2e567f9423233b69b1da5c167e8d895 Mon Sep 17 00:00:00 2001 From: Samuel Vasko Date: Thu, 10 Apr 2014 13:11:41 +0200 Subject: [PATCH] Computing hashes --- scripts/pack.ps1 | 8 ++++++-- scripts/utils.ps1 | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/pack.ps1 b/scripts/pack.ps1 index 2e1bf1a..71e2329 100644 --- a/scripts/pack.ps1 +++ b/scripts/pack.ps1 @@ -32,7 +32,7 @@ Param( [string]$cmderRoot = "..", # Vendor folder locaton - [string]$saveTo = "." + [string]$saveTo = "..\build" ) . "$PSScriptRoot\utils.ps1" @@ -41,12 +41,16 @@ $ErrorActionPreference = "Stop" $targets = @{ "cmder.zip" = $null; "cmder.7z" = $null; - "cmder_mini.zip" = "-x!`"..\vendor\msysgit`""; + "cmder_mini.zip" = "-x!`"vendor\msysgit`""; } +Delete-Existing "..\Version*" + $version = Invoke-Expression "git describe --abbrev=0 --tags" New-Item -ItemType file "$cmderRoot\Version $version" foreach ($t in $targets.GetEnumerator()) { Create-Archive $cmderRoot "$saveTo\$($t.Name)" $t.Value + $hash = (Digest-MD5 "$saveTo\$($t.Name)") + Add-Content "$saveTo\hashes.txt" $hash } \ No newline at end of file diff --git a/scripts/utils.ps1 b/scripts/utils.ps1 index a7f016f..36fdcd6 100644 --- a/scripts/utils.ps1 +++ b/scripts/utils.ps1 @@ -42,4 +42,8 @@ function Flatten-Directory ($name) { Rename-Item $name -NewName "$($name)_moving" Move-Item -Path "$($name)_moving\$child" -Destination $name Remove-Item -Recurse "$($name)_moving" +} + +function Digest-MD5 ($path) { + return Invoke-Expression "md5sum $path" } \ No newline at end of file