Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / sbin / | server ip : 172.67.156.115 your ip : 172.70.80.170 H O M E |
Filename | /usr/sbin/tarcat |
Size | 936 |
Permission | rwxr-xr-x |
Owner | root : root |
Create time | 27-Apr-2025 09:50 |
Last modified | 04-Feb-2014 21:15 |
Last accessed | 05-Jul-2025 16:07 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
#! /bin/sh
# Usage: tarcat volume1 volume2 ...
# concatenates a GNU tar multi-volume archive into a single tar archive.
# Author: Bruno Haible <[email protected]>, Sergey Poznyakoff <[email protected]>
# dump_type FILE [N]
# Print type character from block N (default 0) of tar archive FILE
dump_type() {
dd if="$1" skip=${2:-0} bs=512 count=1 2>/dev/null |
tr '\0' ' ' |
cut -c157
}
case `dump_type "$1"` in
[gx]) PAX=1;;
esac
cat "$1"
shift
for f
do
SKIP=0
T=`dump_type "$f"`
if [ -n "$PAX" ]; then
if [ "$T" = "g" ]; then
# Global extended header.... 2 blocks
# Extended header........... 2 blocks
# Ustar header.............. 1 block
# FIXME: This calculation is will fail for very long file names.
SKIP=5
fi
else
if [ "$T" = "V" ]; then
T=`dump_type "$f" 1`
fi
if [ "$T" = "M" ]; then
SKIP=$(($SKIP + 1))
fi
fi
dd skip=$SKIP if="$f"
done
# Usage: tarcat volume1 volume2 ...
# concatenates a GNU tar multi-volume archive into a single tar archive.
# Author: Bruno Haible <[email protected]>, Sergey Poznyakoff <[email protected]>
# dump_type FILE [N]
# Print type character from block N (default 0) of tar archive FILE
dump_type() {
dd if="$1" skip=${2:-0} bs=512 count=1 2>/dev/null |
tr '\0' ' ' |
cut -c157
}
case `dump_type "$1"` in
[gx]) PAX=1;;
esac
cat "$1"
shift
for f
do
SKIP=0
T=`dump_type "$f"`
if [ -n "$PAX" ]; then
if [ "$T" = "g" ]; then
# Global extended header.... 2 blocks
# Extended header........... 2 blocks
# Ustar header.............. 1 block
# FIXME: This calculation is will fail for very long file names.
SKIP=5
fi
else
if [ "$T" = "V" ]; then
T=`dump_type "$f" 1`
fi
if [ "$T" = "M" ]; then
SKIP=$(($SKIP + 1))
fi
fi
dd skip=$SKIP if="$f"
done