Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/bin/bash -p | |
| 2 | |
| 3 # Copyright 2015 The Chromium Authors. All rights reserved. | |
| 4 # Use of this source code is governed by a BSD-style license that can be | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 # Using codesign, sign the installer tools. After signing, the signatures are | |
| 8 # verified. | |
| 9 | |
| 10 set -eu | |
| 11 | |
| 12 # Environment sanitization. Set a known-safe PATH. Clear environment variables | |
| 13 # that might impact the interpreter's operation. The |bash -p| invocation | |
| 14 # on the #! line takes the bite out of BASH_ENV, ENV, and SHELLOPTS (among | |
| 15 # other features), but clearing them here ensures that they won't impact any | |
| 16 # shell scripts used as utility programs. SHELLOPTS is read-only and can't be | |
| 17 # unset, only unexported. | |
| 18 export PATH="/usr/bin:/bin:/usr/sbin:/sbin" | |
| 19 unset BASH_ENV CDPATH ENV GLOBIGNORE IFS POSIXLY_CORRECT | |
| 20 export -n SHELLOPTS | |
| 21 | |
| 22 ME="$(basename "${0}")" | |
| 23 readonly ME | |
| 24 | |
| 25 if [[ ${#} -ne 3 ]]; then | |
| 26 echo "usage: ${ME} packaging_dir codesign_keychain codesign_id" >& 2 | |
| 27 exit 1 | |
| 28 fi | |
| 29 | |
| 30 packaging_dir="${1}" | |
| 31 codesign_keychain="${2}" | |
| 32 codesign_id="${3}" | |
| 33 | |
| 34 enforcement_flags="restrict,library-validation,kill" | |
|
Greg K
2015/11/23 15:28:39
I'm all about setting library-validation on the in
Mark Mentovai
2015/11/23 15:42:28
Greg Kerr wrote:
| |
| 35 | |
| 36 executables=(goobspatch xzdec) | |
| 37 libraries=(liblzma_decompress.dylib) | |
| 38 declare -a everything | |
| 39 | |
| 40 for executable in "${executables[@]}"; do | |
| 41 sign_path="${packaging_dir}/${executable}" | |
| 42 everything+=("${sign_path}") | |
| 43 | |
| 44 codesign --sign "${codesign_id}" --keychain "${codesign_keychain}" \ | |
| 45 "${sign_path}" --options "${enforcement_flags}" | |
| 46 done | |
| 47 | |
| 48 for library in "${libraries[@]}"; do | |
| 49 sign_path="${packaging_dir}/${library}" | |
| 50 everything+=("${sign_path}") | |
| 51 | |
| 52 codesign --sign "${codesign_id}" --keychain "${codesign_keychain}" \ | |
| 53 "${sign_path}" | |
| 54 done | |
| 55 | |
| 56 for sign_path in "${everything[@]}"; do | |
| 57 codesign --verify --deep -vvvvvv "${sign_path}" | |
| 58 done | |
| OLD | NEW |