osi-tools/osi-extract

17 lines
389 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright (C) 2018 Luke Shumaker
# SPDX-License-Identifier: AGPL-3.0-or-later
{
set -euE
source ./lib/osi.sh
arg_image=$1
arg_src=$(realpath -ms -- "$2")
arg_dst=$3
mountpoint=$(mktemp -dt -- "${0##*/}.XXXXXXXXXX")
trap "rmdir -- ${mountpoint@Q}" EXIT
sudo -- ./osi-mount --user -- "$arg_image" "$mountpoint" cp -aT -- "$mountpoint/$arg_src" "$arg_dst"
}