OLD | NEW |
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 if [ -n "$fallback_packages" ]; then | 105 if [ -n "$fallback_packages" ]; then |
106 dpkg --root="$FLAGS_root" --configure $fallback_packages | 106 dpkg --root="$FLAGS_root" --configure $fallback_packages |
107 fi | 107 fi |
108 } | 108 } |
109 | 109 |
110 do_unpack() { | 110 do_unpack() { |
111 local dpkg_status="$FLAGS_root/var/lib/dpkg/status" | 111 local dpkg_status="$FLAGS_root/var/lib/dpkg/status" |
112 local dpkg_info="$FLAGS_root/var/lib/dpkg/info/" | 112 local dpkg_info="$FLAGS_root/var/lib/dpkg/info/" |
113 | 113 |
| 114 if [ ! -d "$dpkg_info" ] |
| 115 then |
| 116 mkdir -p "$dpkg_info" |
| 117 fi |
| 118 |
114 for p in "$@"; do | 119 for p in "$@"; do |
115 local package=$(dpkg-deb --field "$p" Package) | 120 local package=$(dpkg-deb --field "$p" Package) |
116 local tmpdir=$(mktemp -d) | 121 local tmpdir=$(mktemp -d) |
117 | 122 |
118 dpkg-deb --control "$p" "$tmpdir" | 123 dpkg-deb --control "$p" "$tmpdir" |
119 | 124 |
120 local preinst="${tmpdir}/preinst" | 125 local preinst="${tmpdir}/preinst" |
121 local postinst="${tmpdir}/postinst" | 126 local postinst="${tmpdir}/postinst" |
122 if has_missing_whitelist "$package" "$preinst" "$postinst"; then | 127 if has_missing_whitelist "$package" "$preinst" "$postinst"; then |
123 if [ $FLAGS_dpkg_fallback -eq $FLAGS_TRUE ]; then | 128 if [ $FLAGS_dpkg_fallback -eq $FLAGS_TRUE ]; then |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 do_unpack $@ | 175 do_unpack $@ |
171 elif [ $FLAGS_remove -eq $FLAGS_TRUE ]; then | 176 elif [ $FLAGS_remove -eq $FLAGS_TRUE ]; then |
172 # We log but ignore remove requests. | 177 # We log but ignore remove requests. |
173 echo "Ignoring remove: $@" | 178 echo "Ignoring remove: $@" |
174 else | 179 else |
175 echo "dpkg_no_scripts.sh: Unknown or missing command." | 180 echo "dpkg_no_scripts.sh: Unknown or missing command." |
176 exit 1 | 181 exit 1 |
177 fi | 182 fi |
178 | 183 |
179 exit 0 | 184 exit 0 |
OLD | NEW |