alternative method for "gtar --delete"
Does misc@ have an alternative method for "gtar --delete"? I'm making siteXX.tgz's for multiple sites. There is a directory that is shared between all sites. Then, each site may have a directory of files to append to the archive. I'd also like to be able to remove files from the yet to be zipped archive that come from the shared directory on a per site basis. Just looking to stay within base if possible. Example files: /share/etc/pf.conf /share/etc/vi.exrc /share/usr/X11R6/lib/X11/fonts/TTF/Collection/... /site1/append/install.conf /site1/omit/X11R6/lib/X11/fonts/TTF/Collection/... Any advise in my methods or scheme in general would be appreciated! All the best, Keith Larsen CPS Coatings
Re: alternative method for "gtar --delete"
It's a bit long winded, but here's a possibility: # cd / # tar zcpvf siteXX.tgz /share/* /siteX/* # 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 wrote: > Does misc@ have an alternative method for "gtar --delete"? > > I'm making siteXX.tgz's for multiple sites. There is a directory that > is shared between all sites. Then, each site may have a directory of > files to append to the archive. > > I'd also like to be able to remove files from the yet to be zipped > archive that come from the shared directory on a per site basis. Just > looking to stay within base if possible. > > Example files: > /share/etc/pf.conf > /share/etc/vi.exrc > /share/usr/X11R6/lib/X11/fonts/TTF/Collection/... > /site1/append/install.conf > /site1/omit/X11R6/lib/X11/fonts/TTF/Collection/... > > Any advise in my methods or scheme in general would be appreciated! > > All the best, > > Keith Larsen > CPS Coatings > -- Aaron Mason - Programmer, open source addict I've taken my software vows - for beta or for worse
Re: alternative method for "gtar --delete"
On Fri, 18 Nov 2016 14:07:45 +1100 Aaron Mason wrote: > It's a bit long winded, but here's a possibility: > > # cd / > # tar zcpvf siteXX.tgz /share/* /siteX/* > > # 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 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 * Then I append to that archive using files in /site1/append. # cd /site1/append/ # tar -rpvf /site1/siteXX.tgz * 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...
Re: alternative method for "gtar --delete"
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 wrote: > On Fri, 18 Nov 2016 14:07:45 +1100 > Aaron Mason wrote: > >> It's a bit long winded, but here's a possibility: >> >> # cd / >> # tar zcpvf siteXX.tgz /share/* /siteX/* >> >> # 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 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 * > > > Then I append to that archive using files in /site1/append. > > # cd /site1/append/ > # tar -rpvf /site1/siteXX.tgz * > > > 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
Re: alternative method for "gtar --delete"
Aaron, Thank you for putting me down this path. A few flags aside, this is the solution I was looking for. BTW, OpenBSD's man pages are a cut above the rest; and I'd like to thank everyone involved in the project for such an awesome OS. All the best, Keith Larsen CPS Coatings On Mon, 21 Nov 2016 13:26:29 +1100 Aaron Mason wrote: > 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 wrote: > > On Fri, 18 Nov 2016 14:07:45 +1100 > > Aaron Mason wrote: > > > >> It's a bit long winded, but here's a possibility: > >> > >> # cd / > >> # tar zcpvf siteXX.tgz /share/* /siteX/* > >> > >> # 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 > >> 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 * > > > > > > Then I append to that archive using files in /site1/append. > > > > # cd /site1/append/ > > # tar -rpvf /site1/siteXX.tgz * > > > > > > 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...