forked from coreos/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_image_content.sh
69 lines (58 loc) · 1.99 KB
/
test_image_content.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
GLSA_WHITELIST="201412-09"
glsa_image() {
if glsa-check-$BOARD -t all | grep -v "$GLSA_WHITELIST"; then
echo "The above GLSAs apply to $ROOT"
return 1
fi
return 0
}
test_image_content() {
local root="$1"
local returncode=0
info "Checking $1"
local check_root="${BUILD_LIBRARY_DIR}/check_root"
if ! ROOT="$root" "$check_root" libs; then
warn "test_image_content: Failed dependency check"
warn "This may be the result of having a long-lived SDK with binary"
warn "packages that predate portage 2.2.18. If this is the case try:"
echo " emerge-$BOARD -agkuDN --rebuilt-binaries=y -j9 @world"
echo " emerge-$BOARD -a --depclean"
#returncode=1
fi
local blacklist_dirs=(
"$root/usr/share/locale"
)
for dir in "${blacklist_dirs[@]}"; do
if [ -d "$dir" ]; then
warn "test_image_content: Blacklisted directory found: $dir"
# Only a warning for now, size isn't important enough to kill time
# playing whack-a-mole on things like this this yet.
#error "test_image_content: Blacklisted directory found: $dir"
#returncode=1
fi
done
# Check that there are no conflicts between /* and /usr/*
if ! ROOT="$root" "$check_root" usr; then
error "test_image_content: Failed /usr conflict check"
returncode=1
fi
# Check that there are no #! lines pointing to non-existant locations
if ! ROOT="$root" "$check_root" shebang; then
warn "test_image_content: Failed #! check"
# Only a warning for now. We still have to actually remove all of the
# offending scripts.
#error "test_image_content: Failed #! check"
#returncode=1
fi
if ! sudo ROOT="$root" "$check_root" symlink; then
error "test_image_content: Failed symlink check"
returncode=1
fi
if ! ROOT="$root" glsa_image; then
returncode=1
fi
return $returncode
}