diff options
author | Iru Cai <mytbk920423@gmail.com> | 2021-03-29 12:36:56 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2021-03-29 13:47:51 +0800 |
commit | 73a73be078f8d20401063a85ed5544ca6db98015 (patch) | |
tree | dccc76bd1539b6a3f66e2e75dbc2ee91a98c5ec0 | |
parent | 5bb9d3187ba628159c3741f0ce77621ea7b0d7a1 (diff) | |
download | liveusb-builder-73a73be078f8d20401063a85ed5544ca6db98015.tar.xz |
add iso_extract function based on bsdtar
-rw-r--r-- | functions.sh | 14 |
1 files changed, 14 insertions, 0 deletions
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 <isofile> <patterns> <dest> +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" } |