summaryrefslogtreecommitdiff
path: root/osi-extract
blob: 2cd27706416d6d4c76ac73f62dad91b795eea5c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/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"
}