summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2021-03-29 12:36:56 +0800
committerIru Cai <mytbk920423@gmail.com>2021-03-29 13:47:51 +0800
commit73a73be078f8d20401063a85ed5544ca6db98015 (patch)
treedccc76bd1539b6a3f66e2e75dbc2ee91a98c5ec0
parent5bb9d3187ba628159c3741f0ce77621ea7b0d7a1 (diff)
downloadliveusb-builder-73a73be078f8d20401063a85ed5544ca6db98015.tar.xz
add iso_extract function based on bsdtar
-rw-r--r--functions.sh14
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"
}