Hi,

I'd like to unpack tar archives in tup. Here is what I came up with:

$ cat Tupfile
run ./Tupfile.sh

$ cat Tupfile.sh
#!/bin/bash
shopt -s nullglob
for i in *.tar *.tgz *.tar.gz *.tbz *.tar.bz; do
echo ": $i |> tar -xmf $i |> $(tar -tf $i | tac | awk 'BEGIN {ORS = " "} a !~ $0; { a = $0 }')"
done

Note that reversing the file together with the awk one-liner just takes care that only those lines that contain leaves remain in the tar -tf output, e.g. converting

$ tar -tf  sometar.tar
./
./somedir/
./somedir/somefile
./somefile

to

$ tar -tf sometar.tar | tac | awk 'BEGIN {ORS = " "} a !~ $0; { a = $0 }')"
./somefile ./somedir/somefile

This works pretty well and seems to be a rather generic solution as long as the tar archives are relative, but fails when they contain empty directories: Then, tup complains that directories may only be created temporarily. Obviously, targets may only be files in tup, not directories.

My question (finally :-)) Is there a compelling reason why tup doesn't accept directories as targets?

Thanks and regards,

Chris

--
--
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
--- You received this message because you are subscribed to the Google Groups "tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to