mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-26 00:08:28 +00:00
Only copy changed files when extracting a mod
This commit is contained in:
parent
4bd9da569a
commit
b5819d517d
@ -609,44 +609,55 @@ doExtractMod(){
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
find "$modsrcdir" -type d -printf "$moddestdir/%P\0" | xargs -0 -r mkdir -p
|
find "$modsrcdir" -type d -printf "$moddestdir/%P\0" | xargs -0 -r mkdir -p
|
||||||
find "$modsrcdir" -type f ! \( -name '*.z' -or -name '*.z.uncompressed_size' \) -printf "%P\0" | xargs -0 -r tar -c -C "$modsrcdir" | tar -x -C "$moddestdir"
|
|
||||||
|
find "$modsrcdir" -type f ! \( -name '*.z' -or -name '*.z.uncompressed_size' \) -printf "%P\n" | while read f; do
|
||||||
|
if [ ! -f "$moddestdir/$f" -o "$modsrcdir/$f" -nt "$moddestdir/$f" ]; then
|
||||||
|
printf "%10d %s " "`stat -c '%s' "$modsrcdir/$f"`" "$f"
|
||||||
|
cp "$modsrcdir/$f" "$moddestdir/$f"
|
||||||
|
echo -ne "\r\\033[K"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
find "$modsrcdir" -type f -name '*.z' -printf "%P\n" | while read f; do
|
find "$modsrcdir" -type f -name '*.z' -printf "%P\n" | while read f; do
|
||||||
printf "%10d %s " "`stat -c '%s' "$modsrcdir/$f"`" "${f%.z}"
|
if [ ! -f "$moddestdir/${f%.z}" -o "$modsrcdir/$f" -nt "$moddestdir/${f%.z}" ]; then
|
||||||
perl -M'Compress::Raw::Zlib' -e '
|
printf "%10d %s " "`stat -c '%s' "$modsrcdir/$f"`" "${f%.z}"
|
||||||
my $sig;
|
perl -M'Compress::Raw::Zlib' -e '
|
||||||
read(STDIN, $sig, 8) or die "Unable to read compressed file";
|
my $sig;
|
||||||
if ($sig != "\xC1\x83\x2A\x9E\x00\x00\x00\x00"){
|
read(STDIN, $sig, 8) or die "Unable to read compressed file";
|
||||||
die "Bad file magic";
|
if ($sig != "\xC1\x83\x2A\x9E\x00\x00\x00\x00"){
|
||||||
}
|
die "Bad file magic";
|
||||||
my $data;
|
|
||||||
read(STDIN, $data, 24) or die "Unable to read compressed file";
|
|
||||||
my ($chunksizelo, $chunksizehi,
|
|
||||||
$comprtotlo, $comprtothi,
|
|
||||||
$uncomtotlo, $uncomtothi) = unpack("(LLLLLL)<", $data);
|
|
||||||
my @chunks = ();
|
|
||||||
my $comprused = 0;
|
|
||||||
while ($comprused < $comprtotlo) {
|
|
||||||
read(STDIN, $data, 16) or die "Unable to read compressed file";
|
|
||||||
my ($comprsizelo, $comprsizehi,
|
|
||||||
$uncomsizelo, $uncomsizehi) = unpack("(LLLL)<", $data);
|
|
||||||
push @chunks, $comprsizelo;
|
|
||||||
$comprused += $comprsizelo;
|
|
||||||
}
|
|
||||||
foreach my $comprsize (@chunks) {
|
|
||||||
read(STDIN, $data, $comprsize) or die "File read failed";
|
|
||||||
my ($inflate, $status) = new Compress::Raw::Zlib::Inflate();
|
|
||||||
my $output;
|
|
||||||
$status = $inflate->inflate($data, $output, 1);
|
|
||||||
if ($status != Z_STREAM_END) {
|
|
||||||
die "Bad compressed stream; status: " . ($status);
|
|
||||||
}
|
}
|
||||||
if (length($data) != 0) {
|
my $data;
|
||||||
die "Unconsumed data in input"
|
read(STDIN, $data, 24) or die "Unable to read compressed file";
|
||||||
|
my ($chunksizelo, $chunksizehi,
|
||||||
|
$comprtotlo, $comprtothi,
|
||||||
|
$uncomtotlo, $uncomtothi) = unpack("(LLLLLL)<", $data);
|
||||||
|
my @chunks = ();
|
||||||
|
my $comprused = 0;
|
||||||
|
while ($comprused < $comprtotlo) {
|
||||||
|
read(STDIN, $data, 16) or die "Unable to read compressed file";
|
||||||
|
my ($comprsizelo, $comprsizehi,
|
||||||
|
$uncomsizelo, $uncomsizehi) = unpack("(LLLL)<", $data);
|
||||||
|
push @chunks, $comprsizelo;
|
||||||
|
$comprused += $comprsizelo;
|
||||||
}
|
}
|
||||||
print $output;
|
foreach my $comprsize (@chunks) {
|
||||||
}
|
read(STDIN, $data, $comprsize) or die "File read failed";
|
||||||
' <"$modsrcdir/$f" >"$moddestdir/${f%.z}"
|
my ($inflate, $status) = new Compress::Raw::Zlib::Inflate();
|
||||||
echo -ne "\r\\033[K"
|
my $output;
|
||||||
|
$status = $inflate->inflate($data, $output, 1);
|
||||||
|
if ($status != Z_STREAM_END) {
|
||||||
|
die "Bad compressed stream; status: " . ($status);
|
||||||
|
}
|
||||||
|
if (length($data) != 0) {
|
||||||
|
die "Unconsumed data in input"
|
||||||
|
}
|
||||||
|
print $output;
|
||||||
|
}
|
||||||
|
' <"$modsrcdir/$f" >"$moddestdir/${f%.z}"
|
||||||
|
touch -c -r "$modsrcdir/$f" "$moddestdir/${f%.z}"
|
||||||
|
echo -ne "\r\\033[K"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
perl -e '
|
perl -e '
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user