| #!/bin/sh |
| |
| # 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. |
| |
| # This script is called after an AutoUpdate or USB install. This script is a |
| # simple wrapper to convert from the hardcoded command line to the new |
| # executable command line. |
| |
| # NOTE: This script is called by installers like `chromeos-install` or |
| # `update_engine` from inside the mounted rootfs of the target image. So it is |
| # perfectly fine to modify this script without caring about backward/forward |
| # compatibility. But it can never be migrated to a non-shell script because it |
| # is being called by the original installer and that can break things badly. |
| |
| INSTALL_ROOT=$(dirname "$0") |
| |
| # Set up the mount points userland needs/expects. |
| MOUNTS="/proc /dev /sys /tmp /run /var /mnt/stateful_partition" |
| |
| cleanup() { |
| local d |
| for d in ${MOUNTS}; do |
| umount -lf "./${d}" || : |
| done |
| } |
| |
| main() { |
| cd "${INSTALL_ROOT}" || exit 1 |
| |
| trap cleanup EXIT |
| |
| local d |
| for d in ${MOUNTS}; do |
| mount -n --bind "${d}" "./${d}" |
| mount --make-slave "./${d}" |
| done |
| |
| local install_dev="$1" |
| shift |
| chroot . /usr/bin/cros_installer --type="postinst" \ |
| --install_dev="${install_dev}" --install_dir="/" "$@" |
| } |
| main "$@" |