#!/bin/bash
[% c("var/set_default_env") -%]

[% FOREACH lang = c('var/locales') %]
  [% SET lang = tmpl(lang) %]
  [% SET filename = c("var/input_filename") _ '/' _ lang _ '.xpi'; %]
  shasum=$(grep '[% c("var/ff_arch") %]/xpi/[% lang %].xpi$' SHA512SUMS-[% c("version") %] | sed 's|  [% c("var/ff_arch") %]/xpi/[% lang %].xpi$||')
  echo "$shasum  [% filename %]" | sha512sum -c
[% END %]

mkdir -p [% dest_dir %]/[% c("filename") %]
[% FOREACH lang = c('var/locales') %]
  [% SET lang = tmpl(lang) %]
  [% SET filename = c("var/input_filename") _ '/' _ lang _ '.xpi'; %]
  cp -a [% filename %] [% dest_dir %]/[% c("filename") %]/
[% END %]
