about summary refs log tree commit diff
path: root/tools/nixery
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-09-22T16·45+0100
committerVincent Ambo <github@tazj.in>2019-09-22T17·04+0100
commit7b987530d1e1d25c74b6f8a85a9a25ef61a32c15 (patch)
treefdf54f8594d56c16bb5ba7d4f8fdb078c2bf11ef /tools/nixery
parent21a17b33f49f3f016e35e535af0b81fdb53f0846 (diff)
refactor(build-image): Minor tweak to layer construction script
Diffstat (limited to 'tools/nixery')
-rw-r--r--tools/nixery/build-image/build-image.nix4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/nixery/build-image/build-image.nix b/tools/nixery/build-image/build-image.nix
index 9cfb806e47b1..012cc7f36d26 100644
--- a/tools/nixery/build-image/build-image.nix
+++ b/tools/nixery/build-image/build-image.nix
@@ -179,7 +179,7 @@ let
         # The server application compares binary MD5 hashes and expects base64
         # encoding instead of hex.
         layerMd5=$(openssl dgst -md5 -binary $layer | openssl enc -base64)
-        layerSize=$(wc -c $layer | cut -d ' ' -f1)
+        layerSize=$(stat --printf '%s' $layer)
 
         jq -n -c --arg sha256 $layerSha256 --arg md5 $layerMd5 --arg size $layerSize --arg path $layer \
           '{ size: ($size | tonumber), sha256: $sha256, md5: $md5, path: $path }' >> fs-layers
@@ -203,7 +203,7 @@ let
   configMetadata = fromJSON (readFile (runCommand "config-meta" {
     buildInputs = with pkgs; [ jq openssl ];
   } ''
-    size=$(wc -c ${configJson} | cut -d ' ' -f1)
+    size=$(stat --printf '%s' ${configJson})
     sha256=$(sha256sum ${configJson} | cut -d ' ' -f1)
     md5=$(openssl dgst -md5 -binary ${configJson} | openssl enc -base64)
     jq -n -c --arg size $size --arg sha256 $sha256 --arg md5 $md5 \