Tuesday, August 30, 2011

Tar Directory Structure

16:37:31 <blkperl> hmm so how do you tell tar from 1998 to only tar the directory structure
16:38:29 <haus> port update tar?
16:38:42 <haus> or...yum update tar
16:38:43 <anakha> I don't think that's an option :)
16:41:22 <marut> mkdir tmp && cd tmp && ( cd .. && find . -type d ) | xargs mkdir -p && rmdir tmp && tar -cvf dirstructure.tar .


...rewind...


mkdir tmp && cd tmp && ( cd .. && find . -type d ) | xargs mkdir -p && rmdir tmp && tar -cvf dirstructure.tar .

...oh yeah.

Monday, August 22, 2011

pkginfo y u no read stdin





package_file="$(mkfifo tempfifo && (gunzip -c "packagename.pkg.gz" > tempfifo &) && pkginfo -d tempfifo | awk '/application / {print $2}')"

Wednesday, August 17, 2011

ZFS chmod -R and what not to do

Suppose you need to recursively apply a ZFS ACE to a directory structure. This is what you should not start by doing:

find . -type d -exec chmod -R A+group:videocat:r-x---a-R-c--s:-d----:allow {} \;

The problem is the -R. Guess what that does. :)

Chant fix!


for each in `find . -type d`; do while ls -dV $each | grep videocat > /dev/null; do chmod A0- $each; done; done;