summaryrefslogtreecommitdiffstats
path: root/helper
diff options
context:
space:
mode:
authorroot2013-05-31 16:10:53 +0200
committerroot2013-05-31 16:10:53 +0200
commit7a456f2d51ffbb9e77edfa24c65cf193cc439d70 (patch)
tree4fd5a4999642e5869068911438440f36614f0a2e /helper
parentAlso move hidden files when mounting temp partition (diff)
downloadtm-scripts-7a456f2d51ffbb9e77edfa24c65cf193cc439d70.tar.gz
tm-scripts-7a456f2d51ffbb9e77edfa24c65cf193cc439d70.tar.xz
tm-scripts-7a456f2d51ffbb9e77edfa24c65cf193cc439d70.zip
[vmplayer] More error checks
[stage31] more error checks in stage31 (and then drop to shell) [fileutil] Add option to tarcopy to ignore failed reads
Diffstat (limited to 'helper')
-rw-r--r--helper/fileutil.inc14
1 files changed, 12 insertions, 2 deletions
diff --git a/helper/fileutil.inc b/helper/fileutil.inc
index fcb551eb..fb1c8382 100644
--- a/helper/fileutil.inc
+++ b/helper/fileutil.inc
@@ -25,6 +25,16 @@ install_package() {
# copy list of files using tar
tarcopy () {
+ if [ $# -gt 0 -a "x$1" == "x-i" ]; then
+ shift
+ local IGNORE_ERROR="--ignore-failed-read"
+ else
+ local IGNORE_ERROR=
+ fi
+ if [ "x$IGNORE_TAR_ERROR" != "x" ]; then
+ unset IGNORE_TAR_ERROR
+ IGNORE_ERROR="--ignore-failed-read"
+ fi
[ $# -ne 2 ] && perror "Sanity check failed: tarcopy needs exactly two params, but $# were given."
local FROM=$(trim "$1")
local TO=$(trim "$2")
@@ -37,9 +47,9 @@ tarcopy () {
[ -z "$TO" ] && perror "tarcopy called with empty destination."
[ ! -d "$TO" ] && { mkdir -p "$TO" || perror "could not create destination "$TO" for tar-copy."; }
# TODO count files copied? would remove the need to do it everywhere :)
- tar -cpP $FROM | tar -xp -C "$TO" 2> /dev/null
+ tar $IGNORE_ERROR -cpP $FROM | tar -xp -C "$TO" 2> /dev/null
local PS=(${PIPESTATUS[*]})
- [ "x${PS[0]}" != "x0" ] && perror "packing-part of tar-copy from '$SHORT' to '$TO' failed. (${PS[0]})"
+ [ "x$IGNORE_ERROR" == "x" -a "x${PS[0]}" != "x0" ] && perror "packing-part of tar-copy from '$SHORT' to '$TO' failed. (${PS[0]})"
[ "x${PS[1]}" != "x0" ] && perror "unpacking-part of tar-copy from '$SHORT' to '$TO' failed. (${PS[1]})"
}