summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@chromium.org>2015-04-08 13:43:01 -0400
committerchrome-bot <chrome-bot@chromium.org>2015-09-08 18:43:42 -0700
commit907bc34086d21482e48adddc5da20f48e1a3c0a1 (patch)
tree39b86ebfdcd3674ecb3342fc4ac7ed8611cd8d8a
parent69898e6c513fd5b9e74de12714d2edbd17a4a56a (diff)
downloadvboot-907bc34086d21482e48adddc5da20f48e1a3c0a1.tar.gz
keygeneration: fix some portability aspects
The "function" keyword is not portable -- use the normal function style. The awk command uses a non-portable regex (the word anchor \>). Rework it to avoid regexes entirely. BUG=chromium:475101 TEST=keyset_version_check.sh works on a POSIX system BRANCH=None Change-Id: I5446f63aa9181d06da1898aafb8fab17f5042989 Reviewed-on: https://chromium-review.googlesource.com/296562 Commit-Ready: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: David Riley <davidriley@chromium.org>
-rw-r--r--scripts/keygeneration/common.sh8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/keygeneration/common.sh b/scripts/keygeneration/common.sh
index b15a2f24..07a7b2c6 100644
--- a/scripts/keygeneration/common.sh
+++ b/scripts/keygeneration/common.sh
@@ -54,7 +54,7 @@ INSTALLER_KERNEL_KEYBLOCK_MODE=10 # Only allow in Dev + Recovery.
# likely to cause problems than just keeping an eye out for any differences. If
# you feel the need to change this file, check the history of that other file
# to see what may need updating here too.
-function make_pair {
+make_pair() {
local base=$1
local alg=$2
local key_version=${3:-1}
@@ -94,7 +94,7 @@ function make_pair {
# 0x02 Developer switch on
# 0x04 Not recovery mode
# 0x08 Recovery mode
-function make_keyblock {
+make_keyblock() {
local base=$1
local flags=$2
local pubkey=$3
@@ -120,7 +120,9 @@ VERSION_FILE="key.versions"
# ARGS: <VERSION_TYPE> [VERSION_FILE]
get_version() {
- awk -F= '/^'$1'\>/ { print $NF }' "${2:-${VERSION_FILE}}"
+ local key="$1"
+ local file="${2:-${VERSION_FILE}}"
+ awk -F= -vkey="${key}" '$1 == key { print $NF }' "${file}"
}
# Loads the current versions prints them to stdout and sets the global version