| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | # Usage: tarcat volume1 volume2 ... |
| 3 | # concatenates a GNU tar multi-volume archive into a single tar archive. |
| 4 | # Author: Bruno Haible <[email protected]>, Sergey Poznyakoff <[email protected]> |
| 5 | |
| 6 | # dump_type FILE [N] |
| 7 | # Print type character from block N (default 0) of tar archive FILE |
| 8 | dump_typescip-shell shell tar 1.35+dfsg-4 dump_type().() { |
| 9 | ddscip-shell system . . dd. if="$1" skip=${2:-0} bs=512 count=1 2>/dev/nullscip-shell filesystem . . `/dev/null`. | |
| 10 | trscip-shell system . . tr. '\0' ' ' | |
| 11 | cutscip-shell system . . cut. -c157 |
| 12 | } |
| 13 | |
| 14 | case `dump_typescip-shell shell tar 1.35+dfsg-4 dump_type(). "$1"` in |
| 15 | [gx]) PAX=1;; |
| 16 | esac |
| 17 | |
| 18 | catscip-shell system . . cat. "$1" |
| 19 | shift |
| 20 | for f |
| 21 | do |
| 22 | SKIP=0 |
| 23 | T=`dump_typescip-shell shell tar 1.35+dfsg-4 dump_type(). "$f"` |
| 24 | if [scip-shell system . . `[`. -n "$PAX" ]; then |
| 25 | if [scip-shell system . . `[`. "$T" = "g" ]; then |
| 26 | # Global extended header.... 2 blocks |
| 27 | # Extended header........... 2 blocks |
| 28 | # Ustar header.............. 1 block |
| 29 | # FIXME: This calculation is will fail for very long file names. |
| 30 | SKIP=5 |
| 31 | fi |
| 32 | else |
| 33 | if [scip-shell system . . `[`. "$T" = "V" ]; then |
| 34 | T=`dump_typescip-shell shell tar 1.35+dfsg-4 dump_type(). "$f" 1` |
| 35 | fi |
| 36 | if [scip-shell system . . `[`. "$T" = "M" ]; then |
| 37 | SKIP=$(($SKIP + 1)) |
| 38 | fi |
| 39 | fi |
| 40 | ddscip-shell system . . dd. skip=$SKIP if="$f" |
| 41 | done |
| 42 |