summaryrefslogtreecommitdiffstats
path: root/helper/fileutil.inc
diff options
context:
space:
mode:
authorSimon Rettberg2013-02-25 17:39:59 +0100
committerSimon Rettberg2013-02-25 17:39:59 +0100
commit8989b603a3b3478f93980bee008612374ddc0322 (patch)
treee70bc13d4bd880d76ab5421dc2df8c6bbd4608ae /helper/fileutil.inc
parentMerge branch 'master' of ssh://openslx/openslx-ng/tm-scripts (diff)
downloadtm-scripts-8989b603a3b3478f93980bee008612374ddc0322.tar.gz
tm-scripts-8989b603a3b3478f93980bee008612374ddc0322.tar.xz
tm-scripts-8989b603a3b3478f93980bee008612374ddc0322.zip
fix build_core
Diffstat (limited to 'helper/fileutil.inc')
-rw-r--r--helper/fileutil.inc16
1 files changed, 9 insertions, 7 deletions
diff --git a/helper/fileutil.inc b/helper/fileutil.inc
index 3c165d99..3e1ea56a 100644
--- a/helper/fileutil.inc
+++ b/helper/fileutil.inc
@@ -1,16 +1,18 @@
# copy list of files using tar
tarcopy () {
[ $# -ne 2 ] && perror "Sanity check failed: tarcopy needs exactly two params, but $# were given."
- if [ -z $1 ]; then
- pwarning "tarcopy called with empty input list (dest was '$2')"
+ local FROM=$(trim "$1")
+ local TO=$(trim "$2")
+ if [ -z "$FROM" ]; then
+ pwarning "tarcopy called with empty input list (dest was '$TO')"
return
fi
- local SHORT=$1
+ local SHORT=$FROM
[ ${#SHORT} -gt 23 ] && SHORT=$(echo "$SHORT" | cut -c-18)...$(echo "$SHORT" | cut -c$[${#SHORT} - 4]-)
- [ -z $2 ] && perror "tarcopy called with empty destination."
- tar -cp "$1" | tar -xp -C "$2"
+ [ -z "$TO" ] && perror "tarcopy called with empty destination."
+ tar -cp $FROM | tar -xp -C "$TO"
local PS=(${PIPESTATUS[*]})
- [ "x${PS[0]}" != "x0" ] && perror "packing-part of tar-copy from '$SHORT' to '$2' failed. (${PS[0]})"
- [ "x${PS[1]}" != "x0" ] && perror "unpacking-part of tar-copy from '$SHORT' to '$2' failed. (${PS[1]})"
+ [ "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]})"
}