Your best bet is to generate a list and use it to build your archive -
save a bit of effort and create your omit list:

# cd /site1/omit
# find . > /tmp/siteXX-omit.lst

Then use this list to filter out any unwanted files from /share and /append:

# cd /share
# find . | grep -v -f /tmp/siteXX-omit.lst | xargs tar -czpvf /site1/siteXX.tgz
# cd /append
# find . | grep -v -f /tmp/xiteXX-omit.lst | xargs tar -rzpvf /site1/siteXX.tgz

Then, for cleanliness' sake:

# rm /tmp/siteXX-omit.lst

Hope this helps

On Sat, Nov 19, 2016 at 3:44 AM, BSD <b...@cpscoatings.net> wrote:
> On Fri, 18 Nov 2016 14:07:45 +1100
> Aaron Mason <simplersolut...@gmail.com> wrote:
>
>> It's a bit long winded, but here's a possibility:
>>
>> # cd /
>> # tar zcpvf siteXX.tgz /share/* /siteX/*
>> <output omitted>
>> # tar ztf siteXX.tgz | grep '^/share' | xargs rm -f
>>
>> Though I'm not entirely sure what you mean by "on a per site basis" in
>> this context, can you elaborate please, especially if the above
>> solution is not what you need.
>>
>> On Fri, Nov 18, 2016 at 10:20 AM, BSD <b...@cpscoatings.net> wrote:
>> > Does misc@ have an alternative method for "gtar --delete"?
>
> Sorry for any vagueness! I don't wish to delete any files from /share,
> but have a subset of /share in siteXX.tgz. Also should have mentioned
> that /share, /append, and /omit cannot be in the path because
> siteXX.tgz is plopped on / during an install.
>
> What I have so far is to first create an archive using files in /share.
>
> # cd /share
> # tar -cpvf /site1/siteXX.tgz *
> <output omitted>
>
> Then I append to that archive using files in /site1/append.
>
> # cd /site1/append/
> # tar -rpvf /site1/siteXX.tgz *
> <output omitted>
>
> Next is where I am stuck. Removing files from the archive that are
> FROM /share that are not wanted in /site1/siteXX.tgz. I planned to have
> an empty file of the same name in /site1/omit for each file to delete
> from the archive.
>
> # cd /site1/omit/
> # tar --delete /site1/siteXX.tgz *
>       ^^^^^^^^
>       invalid flag
>
> Or perhaps I need to have a list of the files that gets appended and
> redacted before ever creating the archive.
>
> Hope this picture got clearer...
>



-- 
Aaron Mason - Programmer, open source addict
I've taken my software vows - for beta or for worse

Reply via email to