mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-08 05:26:58 +02:00
The functions are shared between build_image and mod_image_for_test.sh. BUG=None TEST=build_image Change-Id: Ib6d860a6818abee380dde97460f57943cc0a070c Reviewed-on: http://gerrit.chromium.org/gerrit/6444 Reviewed-by: Richard Barnette <jrbarnette@chromium.org> Tested-by: Richard Barnette <jrbarnette@chromium.org>
36 lines
1.1 KiB
Bash
Executable File
36 lines
1.1 KiB
Bash
Executable File
# Copyright (c) 2011 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 global array variable is used to remember options from
|
|
# mount_image so that unmount_image can do its job.
|
|
MOUNT_GPT_OPTIONS=( )
|
|
|
|
# mount_image - Mount the root, stateful, and optionally ESP partitions
|
|
# in a Chromium OS image.
|
|
# $1: path to image to be mounted
|
|
# $2: path to root fs mount point
|
|
# $3: path to stateful fs mount point
|
|
# $4: path to ESP fs mount point; if empty the ESP will not be mounted
|
|
mount_image() {
|
|
local image_dir="$(dirname $1)"
|
|
local image="$(basename $1)"
|
|
MOUNT_GPT_OPTIONS=( -r "$2" -s "$3" )
|
|
|
|
if [ $# -ge 4 ]; then
|
|
MOUNT_GPT_OPTIONS=( "${MOUNT_GPT_OPTIONS[@]}" -e "$4" )
|
|
fi
|
|
|
|
"${SCRIPTS_DIR}/mount_gpt_image.sh" --from="$image_dir" --image="$image" \
|
|
"${MOUNT_GPT_OPTIONS[@]}"
|
|
}
|
|
|
|
# unmount_image - Unmount the file systems mounted in the previous
|
|
# call to mount_image.
|
|
# No arguments
|
|
unmount_image() {
|
|
"${SCRIPTS_DIR}/mount_gpt_image.sh" -u "${MOUNT_GPT_OPTIONS[@]}"
|
|
|
|
MOUNT_GPT_OPTIONS=( )
|
|
}
|