diff options
author | Simon Rettberg | 2013-02-22 19:29:50 +0100 |
---|---|---|
committer | Simon Rettberg | 2013-02-22 19:29:50 +0100 |
commit | 6d4a6b5304ec40a31d60277d7299596125148d0e (patch) | |
tree | ef3293e51c401655f56a019c6b1e70b98d4bb9fd /helper/fileutil.inc | |
parent | Check if passwd/group/shadow exists when trying to add a user (diff) | |
download | tm-scripts-6d4a6b5304ec40a31d60277d7299596125148d0e.tar.gz tm-scripts-6d4a6b5304ec40a31d60277d7299596125148d0e.tar.xz tm-scripts-6d4a6b5304ec40a31d60277d7299596125148d0e.zip |
[helper] Fix password replacement sed expression in add_user, fix return value checking in tarcopy
Diffstat (limited to 'helper/fileutil.inc')
-rw-r--r-- | helper/fileutil.inc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/helper/fileutil.inc b/helper/fileutil.inc index 40bc42d5..3c165d99 100644 --- a/helper/fileutil.inc +++ b/helper/fileutil.inc @@ -6,12 +6,11 @@ tarcopy () { return fi local SHORT=$1 - [ ${#SHORT} -gt 18 ] && SHORT=$(echo "$SHORT" | cut -c-13)...$(echo "$SHORT" | cut -c${#SHORT}-) + [ ${#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" - local PS1=$PIPESTATUS[0] - local PS2=$PIPESTATUS[1] - [ $PS1 -ne 0 ] && perror "packing-part of tar-copy from '$SHORT' to '$2' failed." - [ $PS2 -ne 0 ] && perror "unpacking-part of tar-copy from '$SHORT' to '$2' failed." + 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]})" } |