Re: How do I exclude a directory using tar in OpenBSD?

2011-06-05 Thread Nico Kadel-Garcia
On Thu, Jun 2, 2011 at 8:34 AM, David Vasek va...@fido.cz wrote:
 On Thu, 2 Jun 2011, Nico Kadel-Garcia wrote:

 GNU tools have become the industry standard, for a stack of reasons.

 I've had similar issues with the cp command, and its lack of cp
 -a.

 I've had similar issues with pax(1) command missing from systems based on
 GNU industry standard, and their lack of pax -rw.
 But why should one care about POSIX if we can choose to follow that great
 GNU industry standard now.

 Regards,
 David

I've got my Fedora 15 testing environment open in front of me for
other reasons. pax -rw works fine. Where is that feature not
available?

Note also that POSIX compliance does not say you *can't* have a
feature. Frankly, I'd love to see POSIX include these features for
cp and tar for their next updated standards. It would make
cross-platform work notably easier, especially for backup utilitiies
like Amanda and rsnapshot (both of which I've done on UNIX and Linux
systems).



Re: How do I exclude a directory using tar in OpenBSD?

2011-06-05 Thread Abel Abraham Camarillo Ojeda
On Thu, Jun 2, 2011 at 6:59 AM, Nico Kadel-Garcia nka...@gmail.com wrote:
 On Tue, May 31, 2011 at 8:39 AM, Stuart Henderson s...@spacehopper.org 
 wrote:
 On 2011-05-31, Marian Hettwer m...@kernel32.de wrote:
 On Tue, 31 May 2011 10:53:58 +0200, LEVAI Daniel l...@ecentrum.hu
 wrote:
 On Tue, May 31, 2011 at 11:42:24 +0300, Michael Sioutis wrote:
 Hello!

 I can't find it in the man page, and it seems it is not supported (?)
 I am trying to backup some folders and want to exclude some and nth
 will work. I've tried:
 --exclude=/folder/
 --exclude=/folder/
 --exclude /folder
 --exclude folder

 I will get an error: --exclude... directory doesn't exist.

 Excluding will work in Linux.

 That is a GNU extension. You can work this around with find(1) and the
 tar(1)'s '-I' option.



 bsdtar from the FreeBSD project supports --exclude too.
 The OP could as well install gnu tar from packages. bsdtar doens't seem
 to exist...

 At least that's what I do at work (Debian, Solaris, OpenBSD env).
 It's a pain to walk around every nifty details of different unixes...

 The other way you can do it is just use posix-specified options and
 not rely on vendor-specific extensions. But unfortunately many of the
 vendors (*cough*gnu*cough*) don't make it clear which options are
 standard and which are extensions... And, sadly, even some of the
 BSD-derived OS have replaced a bunch of their standard tools with GNU.

 GNU tools have become the industry standard, for a stack of reasons.
 This sort of useful feature for tar, its protective autostripping of
 leading slashes, and its built-in compression access are only a few of
 the reasons its become so popular. Transforming a simple --exclude
 based command line into a set of included targets can become
 extremely awkward, especially when snapshotting a dynamic target (for
 backup purposes) or dealing with file names from a shared file system
 (such as an NFS or Samba published system in international settings)
 that parsing the names can cause. chaos.

 I've had similar issues with the cp command, and its lack of cp
 -a. I've taken to using rsync, first, to generate a target space
 that I can then run the tar or other commands against. With cheaper,
 faster disk these days, it's usually cheaper for me as a programmer to
 do this.



Don't forget to mention the Industry Standard rsync protocol...



Re: How do I exclude a directory using tar in OpenBSD?

2011-06-02 Thread Nico Kadel-Garcia
On Tue, May 31, 2011 at 8:39 AM, Stuart Henderson s...@spacehopper.org wrote:
 On 2011-05-31, Marian Hettwer m...@kernel32.de wrote:
 On Tue, 31 May 2011 10:53:58 +0200, LEVAI Daniel l...@ecentrum.hu
 wrote:
 On Tue, May 31, 2011 at 11:42:24 +0300, Michael Sioutis wrote:
 Hello!

 I can't find it in the man page, and it seems it is not supported (?)
 I am trying to backup some folders and want to exclude some and nth
 will work. I've tried:
 --exclude=/folder/
 --exclude=/folder/
 --exclude /folder
 --exclude folder

 I will get an error: --exclude... directory doesn't exist.

 Excluding will work in Linux.

 That is a GNU extension. You can work this around with find(1) and the
 tar(1)'s '-I' option.



 bsdtar from the FreeBSD project supports --exclude too.
 The OP could as well install gnu tar from packages. bsdtar doens't seem
 to exist...

 At least that's what I do at work (Debian, Solaris, OpenBSD env).
 It's a pain to walk around every nifty details of different unixes...

 The other way you can do it is just use posix-specified options and
 not rely on vendor-specific extensions. But unfortunately many of the
 vendors (*cough*gnu*cough*) don't make it clear which options are
 standard and which are extensions... And, sadly, even some of the
 BSD-derived OS have replaced a bunch of their standard tools with GNU.

GNU tools have become the industry standard, for a stack of reasons.
This sort of useful feature for tar, its protective autostripping of
leading slashes, and its built-in compression access are only a few of
the reasons its become so popular. Transforming a simple --exclude
based command line into a set of included targets can become
extremely awkward, especially when snapshotting a dynamic target (for
backup purposes) or dealing with file names from a shared file system
(such as an NFS or Samba published system in international settings)
that parsing the names can cause. chaos.

I've had similar issues with the cp command, and its lack of cp
-a. I've taken to using rsync, first, to generate a target space
that I can then run the tar or other commands against. With cheaper,
faster disk these days, it's usually cheaper for me as a programmer to
do this.



Re: How do I exclude a directory using tar in OpenBSD?

2011-06-02 Thread David Vasek

On Thu, 2 Jun 2011, Nico Kadel-Garcia wrote:


GNU tools have become the industry standard, for a stack of reasons.



I've had similar issues with the cp command, and its lack of cp
-a.


I've had similar issues with pax(1) command missing from systems based on 
GNU industry standard, and their lack of pax -rw.
But why should one care about POSIX if we can choose to follow that great 
GNU industry standard now.


Regards,
David



Re: OT:Re: How do I exclude a directory using tar in OpenBSD?

2011-06-01 Thread Marian Hettwer
On Tue, 31 May 2011 17:05:55 -0400, Eric Furman
ericfur...@fastmail.net wrote:
 On Tue, 31 May 2011 13:43 +0200, Marian Hettwer m...@kernel32.de
 Obviously not.
 I'm talking about shell scripts which should work in a multi unix
 environment. Namely, in my env, Debian, Solaris and OpenBSD.
 I tend to install gnu sed and gnu grep and gnu diff on all 3 named
 systems.
 I actually see nothing bad about it. Not at all.
 
 And what do you do when you are not in charge of the box you
 need your script to run on? It is not uncommon to work in an
 environment with many thousands of boxes most of which you
 have no control over. You cannot depend on gnu or any other
 tools being installed on them. Better to have your script
 detect which OS it's running on and take appropriate action.
 You are establishing a very bad habit...

I can only partly agree.
In my case, I am in charge of them boxes. And we are talking a thousand
and a bit.
However, if I'm not in charge of the box, I do make sure that my script
will run with the native tools of whatever unix (well, Linux, FreeBSD,
OpenBSD, Solaris) it should run on.
I do disagree with regards to a bad habit.
It isn't. It's pragmatic. That's what you do if you are in charge of
the boxes.

And yep, this is really OT now.

Cheers,
Marian



Re: How do I exclude a directory using tar in OpenBSD?

2011-06-01 Thread Marian Hettwer
On Tue, 31 May 2011 17:02:16 +0200, Otto Moerbeek o...@drijf.net
wrote:
 
 $ pax -vw -f t.tar -x ustar -s /skip.this// .
 
 Should be portable...


Good to know! I put this into my list of one-liners.
Thanks! :)

./Marian



How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread Michael Sioutis
Hello!

I can't find it in the man page, and it seems it is not supported (?)
I am trying to backup some folders and want to exclude some and nth
will work. I've tried:
--exclude=/folder/
--exclude=/folder/
--exclude /folder
--exclude folder

I will get an error: --exclude... directory doesn't exist.

Excluding will work in Linux.

Thanx!
Mike



Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread LEVAI Daniel
On Tue, May 31, 2011 at 11:42:24 +0300, Michael Sioutis wrote:
 Hello!
 
 I can't find it in the man page, and it seems it is not supported (?)
 I am trying to backup some folders and want to exclude some and nth
 will work. I've tried:
 --exclude=/folder/
 --exclude=/folder/
 --exclude /folder
 --exclude folder
 
 I will get an error: --exclude... directory doesn't exist.
 
 Excluding will work in Linux.
 
That is a GNU extension. You can work this around with find(1) and the
tar(1)'s '-I' option.


Daniel

-- 
LIVAI Daniel
PGP key ID = 0x83B63A8F
Key fingerprint = DBEC C66B A47A DFA2 792D  650C C69B BE4C 83B6 3A8F



Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread Aaron Mason
Hi Mike

Try something like this:

tar -cvf backup.tar $(ls / | grep -v -e 'tmp' -e 'boot')

On Tue, May 31, 2011 at 6:42 PM, Michael Sioutis papito@gmail.com wrote:
 Hello!

 I can't find it in the man page, and it seems it is not supported (?)
 I am trying to backup some folders and want to exclude some and nth
 will work. I've tried:
 --exclude=/folder/
 --exclude=/folder/
 --exclude /folder
 --exclude folder

 I will get an error: --exclude... directory doesn't exist.

 Excluding will work in Linux.

 Thanx!
 Mike





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



Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread Marian Hettwer
On Tue, 31 May 2011 10:53:58 +0200, LEVAI Daniel l...@ecentrum.hu
wrote:
 On Tue, May 31, 2011 at 11:42:24 +0300, Michael Sioutis wrote:
 Hello!

 I can't find it in the man page, and it seems it is not supported (?)
 I am trying to backup some folders and want to exclude some and nth
 will work. I've tried:
 --exclude=/folder/
 --exclude=/folder/
 --exclude /folder
 --exclude folder

 I will get an error: --exclude... directory doesn't exist.

 Excluding will work in Linux.

 That is a GNU extension. You can work this around with find(1) and the
 tar(1)'s '-I' option.
 
 

bsdtar from the FreeBSD project supports --exclude too.
The OP could as well install gnu tar from packages. bsdtar doens't seem
to exist...

At least that's what I do at work (Debian, Solaris, OpenBSD env).
It's a pain to walk around every nifty details of different unixes...

Cheers,
Marian



Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread Jeremie Courreges-Anglas

Le 31/05/2011 11:23, Marian Hettwer a C)crit :

On Tue, 31 May 2011 10:53:58 +0200, LEVAI Daniell...@ecentrum.hu
wrote:

On Tue, May 31, 2011 at 11:42:24 +0300, Michael Sioutis wrote:

Hello!

I can't find it in the man page, and it seems it is not supported (?)
I am trying to backup some folders and want to exclude some and nth
will work. I've tried:
--exclude=/folder/
--exclude=/folder/
--exclude /folder
--exclude folder

I will get an error: --exclude... directory doesn't exist.

Excluding will work in Linux.


That is a GNU extension. You can work this around with find(1) and the
tar(1)'s '-I' option.


Also
tar cf /foo.tar /bar/!(folder|other_folder)
using plain ksh


bsdtar from the FreeBSD project supports --exclude too.
The OP could as well install gnu tar from packages. bsdtar doens't seem
to exist...

At least that's what I do at work (Debian, Solaris, OpenBSD env).
It's a pain to walk around every nifty details of different unixes...


I'm wondering where does that logic stop... do you also install GNU ls
to get colors?



Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread Christian Weisgerber
Marian Hettwer m...@kernel32.de wrote:

 bsdtar from the FreeBSD project supports --exclude too.
 The OP could as well install gnu tar from packages. bsdtar doens't seem
 to exist...

bsdtar is available as part of the archivers/libarchive port.

-- 
Christian naddy Weisgerber  na...@mips.inka.de



Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread Marian Hettwer
On Tue, 31 May 2011 11:39:41 +0200, Jeremie Courreges-Anglas
ktulu+m...@wxcvbn.org wrote:
 Le 31/05/2011 11:23, Marian Hettwer a C)crit :
 That is a GNU extension. You can work this around with find(1) and the
 tar(1)'s '-I' option.
 
 Also
 tar cf /foo.tar /bar/!(folder|other_folder)
 using plain ksh

that looks nice.
 
 bsdtar from the FreeBSD project supports --exclude too.
 The OP could as well install gnu tar from packages. bsdtar doens't seem
 to exist...

 At least that's what I do at work (Debian, Solaris, OpenBSD env).
 It's a pain to walk around every nifty details of different unixes...
 
 I'm wondering where does that logic stop... do you also install GNU ls
 to get colors?

Obviously not.
I'm talking about shell scripts which should work in a multi unix
environment. Namely, in my env, Debian, Solaris and OpenBSD.
I tend to install gnu sed and gnu grep and gnu diff on all 3 named
systems.
I actually see nothing bad about it. Not at all.

Cheers,
Marian



Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread Stuart Henderson
On 2011-05-31, Marian Hettwer m...@kernel32.de wrote:
 On Tue, 31 May 2011 10:53:58 +0200, LEVAI Daniel l...@ecentrum.hu
 wrote:
 On Tue, May 31, 2011 at 11:42:24 +0300, Michael Sioutis wrote:
 Hello!

 I can't find it in the man page, and it seems it is not supported (?)
 I am trying to backup some folders and want to exclude some and nth
 will work. I've tried:
 --exclude=/folder/
 --exclude=/folder/
 --exclude /folder
 --exclude folder

 I will get an error: --exclude... directory doesn't exist.

 Excluding will work in Linux.

 That is a GNU extension. You can work this around with find(1) and the
 tar(1)'s '-I' option.
 
 

 bsdtar from the FreeBSD project supports --exclude too.
 The OP could as well install gnu tar from packages. bsdtar doens't seem
 to exist...

 At least that's what I do at work (Debian, Solaris, OpenBSD env).
 It's a pain to walk around every nifty details of different unixes...

The other way you can do it is just use posix-specified options and
not rely on vendor-specific extensions. But unfortunately many of the
vendors (*cough*gnu*cough*) don't make it clear which options are
standard and which are extensions... And, sadly, even some of the
BSD-derived OS have replaced a bunch of their standard tools with GNU.



Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread Marian Hettwer
On Tue, 31 May 2011 12:39:15 + (UTC), Stuart Henderson
s...@spacehopper.org wrote:
 On 2011-05-31, Marian Hettwer m...@kernel32.de wrote:

 bsdtar from the FreeBSD project supports --exclude too.
 The OP could as well install gnu tar from packages. bsdtar doens't seem
 to exist...

 At least that's what I do at work (Debian, Solaris, OpenBSD env).
 It's a pain to walk around every nifty details of different unixes...
 
 The other way you can do it is just use posix-specified options and
 not rely on vendor-specific extensions. But unfortunately many of the
 vendors (*cough*gnu*cough*) don't make it clear which options are
 standard and which are extensions... And, sadly, even some of the
 BSD-derived OS have replaced a bunch of their standard tools with GNU.

You are right. One should rely on posix standards.
However, reality most often proved that there will be GNU-ism all over
the place.
Time for a clean up task? Maybe. Going the easier road of just
installing some gnu tools, why not?

Talking about BSD specifics. I really like the possibility on my
FreeBSD box with bsdtar to not specify -z or -j depending on the
archived tar file. Instead, bsdtar just guesses for me what it'll be.
tar -xvf foo.tar.gz or tar -xvf foo.tar.bz2 is all the same to me.
However, I really try hard not to get the hang of it. This would never
work with any other tar I encountered...
And obviously I wouldn't to this in a shellscript ;)

Cheers,
Marian



Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread Christian Weisgerber
Marian Hettwer m...@kernel32.de wrote:

 You are right. One should rely on posix standards.

Well, the POSIX archiver utility is pax(1).  The combination of
find(1) and pax(1) also lends itself to excluding directories.

 Talking about BSD specifics. I really like the possibility on my
 FreeBSD box with bsdtar to not specify -z or -j depending on the
 archived tar file. [...] This would never work with any other tar
 I encountered...

GNU tar has had this for some time, too.

-- 
Christian naddy Weisgerber  na...@mips.inka.de



OT Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread Diana Eichert

On Tue, 31 May 2011, Jeremie Courreges-Anglas wrote:
SNIP

Le 31/05/2011 11:23, Marian Hettwer a C)crit :

bsdtar from the FreeBSD project supports --exclude too.
The OP could as well install gnu tar from packages. bsdtar doens't seem
to exist...

At least that's what I do at work (Debian, Solaris, OpenBSD env).
It's a pain to walk around every nifty details of different unixes...


I'm wondering where does that logic stop... do you also install GNU ls
to get colors?


Yep, why not?  I admin many systems where I work, the majority Linux
because particular projects require Linux because of peculiar hardware.
I work for the customer, they do not work for me.  The fact I manage
to get some OpenBSD systems in production use is a plus to me.

diana

Past hissy-fits are not a predictor of future hissy-fits.
Nick Holland(06 Dec 2005)



Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread Otto Moerbeek
On Tue, May 31, 2011 at 11:23:16AM +0200, Marian Hettwer wrote:

 On Tue, 31 May 2011 10:53:58 +0200, LEVAI Daniel l...@ecentrum.hu
 wrote:
  On Tue, May 31, 2011 at 11:42:24 +0300, Michael Sioutis wrote:
  Hello!
 
  I can't find it in the man page, and it seems it is not supported (?)
  I am trying to backup some folders and want to exclude some and nth
  will work. I've tried:
  --exclude=/folder/
  --exclude=/folder/
  --exclude /folder
  --exclude folder
 
  I will get an error: --exclude... directory doesn't exist.
 
  Excluding will work in Linux.
 
  That is a GNU extension. You can work this around with find(1) and the
  tar(1)'s '-I' option.
  
  
 
 bsdtar from the FreeBSD project supports --exclude too.
 The OP could as well install gnu tar from packages. bsdtar doens't seem
 to exist...
 
 At least that's what I do at work (Debian, Solaris, OpenBSD env).
 It's a pain to walk around every nifty details of different unixes...
 
 Cheers,
 Marian

$ pax -vw -f t.tar -x ustar -s /skip.this// .

Should be portable...

-Otto



OT:Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread Eric Furman
On Tue, 31 May 2011 13:43 +0200, Marian Hettwer m...@kernel32.de
wrote:
 On Tue, 31 May 2011 11:39:41 +0200, Jeremie Courreges-Anglas
 ktulu+m...@wxcvbn.org wrote:
  Le 31/05/2011 11:23, Marian Hettwer a C)crit :
  That is a GNU extension. You can work this around with find(1) and the
  tar(1)'s '-I' option.
  
  Also
  tar cf /foo.tar /bar/!(folder|other_folder)
  using plain ksh
 
 that looks nice.
  
  bsdtar from the FreeBSD project supports --exclude too.
  The OP could as well install gnu tar from packages. bsdtar doens't seem
  to exist...
 
  At least that's what I do at work (Debian, Solaris, OpenBSD env).
  It's a pain to walk around every nifty details of different unixes...
  
  I'm wondering where does that logic stop... do you also install GNU ls
  to get colors?
 
 Obviously not.
 I'm talking about shell scripts which should work in a multi unix
 environment. Namely, in my env, Debian, Solaris and OpenBSD.
 I tend to install gnu sed and gnu grep and gnu diff on all 3 named
 systems.
 I actually see nothing bad about it. Not at all.

And what do you do when you are not in charge of the box you
need your script to run on? It is not uncommon to work in an
environment with many thousands of boxes most of which you
have no control over. You cannot depend on gnu or any other
tools being installed on them. Better to have your script
detect which OS it's running on and take appropriate action.
You are establishing a very bad habit...



Re: OT:Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread Abel Abraham Camarillo Ojeda
On Tue, May 31, 2011 at 4:05 PM, Eric Furman ericfur...@fastmail.net wrote:
 Better to have your script
 detect which OS it's running on and take appropriate action.



Sure, that's why autoconf is state of art.



Re: OT:Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread gilbert . fernandes
On Tue, May 31, 2011 at 05:05:55PM -0400, Eric Furman wrote:

 And what do you do when you are not in charge of the box you
 need your script to run on?

You write a script that uses a statically compiled
binary, the one you need. There is a tool to create
a .sh script that will contain the binary and your
script. If I remember correctly, that's how Star Office
installed itself : the .sh extracted what was required
and runned. The tool to create such .sh scripts that
contains binaries can then be used.

Your script will extract locally the binary
(make sure where it is somewhere it can run)
and then run, using the statically compiled
binary.

Not pretty but the binary can be updated with
the script and your script will be a little fat
in size :-)

-- 
Gilbert Fernandes



Re: OT:Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread Kevin Chadwick
On Tue, 31 May 2011 23:33:22 +0200
gilbert.fernan...@orange.fr wrote:

 (make sure where it is somewhere it can run)

if there is such a writable place!



Re: OT:Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread gilbert . fernandes
On Tue, May 31, 2011 at 11:05:18PM +, Kevin Chadwick wrote:

 if there is such a writable place!

Yes. When I tried to make such a script, that
contained a static binary, finding such a place
was almost a nightmare. In the end, the admin
of the foreign server took pity of me and installed
locally the binary I required :p

-- 
Gilbert Fernandes



Re: OT:Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread patrick keshishian
On Tue, May 31, 2011 at 3:29 PM,  gilbert.fernan...@orange.fr wrote:
 On Tue, May 31, 2011 at 11:05:18PM +, Kevin Chadwick wrote:

 if there is such a writable place!

 Yes. When I tried to make such a script, that
 contained a static binary, finding such a place
 was almost a nightmare. In the end, the admin
 of the foreign server took pity of me and installed
 locally the binary I required :p

fucking amateurs. if you ran windows you wouldn't have this problem.

--patrick



Re: OT:Re: How do I exclude a directory using tar in OpenBSD?

2011-05-31 Thread gilbert . fernandes
On Tue, May 31, 2011 at 04:11:16PM -0700, patrick keshishian wrote:

 fucking amateurs. if you ran windows you wouldn't have this problem.

Last time I did ran into a window, it did hurt, quite a bit. The window
did broke, but I left around a lot of blood and it was messy. Somewhat.

Why the obsession for running into windows. I tried, and it was not
fun.

Hell. I could have more fun sitting on the mud in front of a 
buldozer. 

Please excuse me. I have one of those in front of my house, and
I need to lie down there for quite some time.

-- 
Gilbert Fernandes