diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2018-08-09 20:22:41 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2018-08-09 20:22:56 -0400 |
commit | eca51a2f1745041eb366cc72e92154f825d2717c (patch) | |
tree | 23e3b087d978d44d2d7b2497c94f38c6c0d4d0d5 /osi-extract | |
parent | 53817698fc4765049f86816fcb925324ca117e48 (diff) |
stuff
Diffstat (limited to 'osi-extract')
-rwxr-xr-x | osi-extract | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/osi-extract b/osi-extract new file mode 100755 index 0000000..b978a51 --- /dev/null +++ b/osi-extract @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# 2018 Luke Shumaker +{ + set -euE + image=$1 + src=$(realpath -ms -- "$2") + dst=$3 + + mountpoint=$(mktemp -dt -- "${0##*/}.XXXXXXXXXX") + trap "rmdir -- ${mountpoint@Q}" EXIT + + sudo unshare --mount sh -c "mount --make-rslave / && mount ${image@Q} ${mountpoint@Q} && cp -aT -- ${mountpoint@Q}/${src@Q} ${dst@Q}" +} |