dev_image_util: make file work by default

File is compiled with a path to the default magic database, but since we
install it into /usr/local rather than the normal /usr, that default path
does not work.  Add a smaller wrapper script around `file` to specify the
new database location so people don't have to manually do so.

BUG=chromium-os:27725
TEST=`./build_image --board=x86-alex dev` produced an image where `file /bin/bash` worked

Change-Id: I3862cb368437a14bf1e4b6ccf4e2df3e4f774817
Reviewed-on: https://gerrit.chromium.org/gerrit/19137
Tested-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2012-03-26 19:09:30 -04:00 committed by Gerrit
parent 68da4439ff
commit 51409977a2

View File

@ -1,4 +1,4 @@
# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
# 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.
@ -73,6 +73,18 @@ install_dev_packages() {
${ROOT_FS_DIR}/usr/local/lib/python2.6/site-packages/pygtk.pth"
fi
# File searches /usr/share by default, so add a wrapper script so it
# can find the right path in /usr/local.
local path="${ROOT_FS_DIR}/usr/local/bin/file"
if [[ -x ${path} ]]; then
sudo mv "${path}" "${path}.bin"
sudo_clobber "${path}" <<EOF
#!/bin/sh
exec file.bin -m /usr/local/share/misc/magic.mgc "\$@"
EOF
sudo chmod a+rx "${path}"
fi
# If python is installed on stateful-dev, fix python symlinks.
local python_path="/usr/local/bin/python2.6"
if [ -e "${ROOT_FS_DIR}${python_path}" ]; then