Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: src/scripts/dpkg_no_scripts.sh

Issue 543099: Change the replacement dpkg to respect comment lines in package.whitelist (Closed)
Patch Set: Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # This script can be used to replace the "dpkg" binary as far as the 7 # This script can be used to replace the "dpkg" binary as far as the
8 # "apt-get install" command is concerned. When "apt-get install foo" 8 # "apt-get install" command is concerned. When "apt-get install foo"
9 # runs it will make two calls to dpkg like: 9 # runs it will make two calls to dpkg like:
10 # dpkg --status-fd ## --unpack --auto-deconfigure /path/to/foo.deb 10 # dpkg --status-fd ## --unpack --auto-deconfigure /path/to/foo.deb
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 set -e 46 set -e
47 47
48 # Returns true if the input file is whitelisted. 48 # Returns true if the input file is whitelisted.
49 # 49 #
50 # $1 - The file to check 50 # $1 - The file to check
51 is_whitelisted() { 51 is_whitelisted() {
52 local whitelist="${SRC_ROOT}/package_scripts/package.whitelist" 52 local whitelist="${SRC_ROOT}/package_scripts/package.whitelist"
53 test -f "$whitelist" || return 53 test -f "$whitelist" || return
54 54
55 local checksum=$(md5sum "$1" | awk '{ print $1 }') 55 local checksum=$(md5sum "$1" | awk '{ print $1 }')
56 local count=$(grep -c "$checksum" "${whitelist}" || /bin/true) 56 local count=$(sed -e "s/#.*$//" "${whitelist}" | grep -c "$checksum" \
57 || /bin/true)
57 test $count -ne 0 58 test $count -ne 0
58 } 59 }
59 60
60 # Returns true if either of the two given files exist and are not whitelisted. 61 # Returns true if either of the two given files exist and are not whitelisted.
61 # 62 #
62 # $1 - The package name. 63 # $1 - The package name.
63 # $2 - The path to the preinst file if it were to exist. 64 # $2 - The path to the preinst file if it were to exist.
64 # $3 - The path to the postinst file if it were to exist. 65 # $3 - The path to the postinst file if it were to exist.
65 has_missing_whitelist() { 66 has_missing_whitelist() {
66 local package=$1 67 local package=$1
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 do_unpack $@ 180 do_unpack $@
180 elif [ $FLAGS_remove -eq $FLAGS_TRUE ]; then 181 elif [ $FLAGS_remove -eq $FLAGS_TRUE ]; then
181 # We log but ignore remove requests. 182 # We log but ignore remove requests.
182 echo "Ignoring remove: $@" 183 echo "Ignoring remove: $@"
183 else 184 else
184 echo "dpkg_no_scripts.sh: Unknown or missing command." 185 echo "dpkg_no_scripts.sh: Unknown or missing command."
185 exit 1 186 exit 1
186 fi 187 fi
187 188
188 exit 0 189 exit 0
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698