From 7f0a8b69ee5fff4a416536d662045d3ac4afa1f9 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 22 Apr 2014 06:26:44 -0600 Subject: [PATCH] Move "possible config locations" list to the top of check-config.sh Docker-DCO-1.1-Signed-off-by: Andrew Page (github: tianon) Upstream-commit: 2c4cebe916299c7485e929e49ebc6d263e3769cf Component: engine --- components/engine/contrib/check-config.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/components/engine/contrib/check-config.sh b/components/engine/contrib/check-config.sh index cbdb90bcce..498ede8af3 100755 --- a/components/engine/contrib/check-config.sh +++ b/components/engine/contrib/check-config.sh @@ -4,7 +4,13 @@ set -e # bits of this were adapted from lxc-checkconfig # see also https://github.com/lxc/lxc/blob/lxc-1.0.2/src/lxc/lxc-checkconfig.in -: ${CONFIG:=/proc/config.gz} +possibleConfigs=( + '/proc/config.gz' + "/boot/config-$(uname -r)" + "/usr/src/linux-$(uname -r)/.config" + '/usr/src/linux/.config' +) +: ${CONFIG:="${possibleConfigs[0]}"} if ! command -v zgrep &> /dev/null; then zgrep() { @@ -74,11 +80,7 @@ check_flags() { if [ ! -e "$CONFIG" ]; then wrap_warning "warning: $CONFIG does not exist, searching other paths for kernel config..." - for tryConfig in \ - '/proc/config.gz' \ - "/boot/config-$(uname -r)" \ - '/usr/src/linux/.config' \ - ; do + for tryConfig in "${possibleConfigs[@]}"; do if [ -e "$tryConfig" ]; then CONFIG="$tryConfig" break