jpm-optimize-signed-build.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. # -*- mode: sh; tab-width: 4; coding: utf-8 -*-
  3. # vim: ts=4 noet ai ft=sh
  4. # The state-of-the-art optimization against a signed Firefox add-on without
  5. # breaking the signature.
  6. #
  7. # This file is part of JPM.sh.
  8. # Copyright (C) 2016 the Desktopd developers
  9. #
  10. # This program is free software: you can redistribute it and/or modify
  11. # it under the terms of the GNU Affero General Public License as
  12. # published by the Free Software Foundation, either version 3 of the
  13. # License, or (at your option) any later version.
  14. #
  15. # This program is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU Affero General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU Affero General Public License
  21. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  22. # JPM.sh directories
  23. gBinDir=`dirname "$0"`
  24. gBinDir=`cd "$gBinDir" ; pwd`
  25. gLibDir=${gBinDir}/../lib
  26. gDepsDir=${gBinDir}/../deps
  27. # Include needed scripts
  28. . "$gLibDir/console.sh"
  29. [ -f "$1" ] || {
  30. jpmConsoleError "No such file: $1"
  31. exit 1
  32. }
  33. which advzip >/dev/null 2>&1 && {
  34. jpmConsoleNotice "Recompressing the archive with 'advzip'..."
  35. # Insanely slow `deflate` compression
  36. advzip -k -z -4 -i 2000 "$1"
  37. :;} || {
  38. jpmConsoleError "Required but not found: advzip (AdvanceCOMP)"
  39. exit 1
  40. }