From 73a73be078f8d20401063a85ed5544ca6db98015 Mon Sep 17 00:00:00 2001 From: Iru Cai Date: Mon, 29 Mar 2021 12:36:56 +0800 Subject: add iso_extract function based on bsdtar --- functions.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/functions.sh b/functions.sh index dba6d9d..a3b3a8d 100644 --- a/functions.sh +++ b/functions.sh @@ -135,6 +135,20 @@ umount_iso() { udevil umount "$ISOMNT" } +# iso_extract: extract files from iso image to destination path +# usage: iso_extract +iso_extract() { + local isofile="$1" + local patterns=() + shift + while [ "$#" -gt 1 ]; do + patterns+=("$1") + shift + done + local dest="$1" + bsdtar -x -f "$isofile" -C "$dest" "${patterns[@]}" +} + getuuid() { lsblk -n -o UUID "$1" } -- cgit v1.2.3