maxomai: dog (dog)
[personal profile] maxomai
Working on open source projects usually requires one to submit patch files and gzipped tarballs to one's compatriots. This isn't a big deal on most UNIX (including Linux) machines. On Windows one can do this with 7Zip, excepting that newlines in Windows are usually represented by \r\n instead of \n. On Macs, one can do this on command line, but it's more Mac-like to do it in Finder.

There are instructions here for setting up just such a service in Finder. Unfortunately it only tells one how to create tarballs, not how to create gzipped tarballs. It also zips normally hidden Mac copy files along with the expected files, which can leave one's compatriots with a mess.

You can fix both of these messes by using the below script instead of the one provided by Mr Miller. All I've done here is change the last line in accordance with this hint. Hope it's useful.

(I know, I know, the code isn't indented. Unfortunately the only way to really ensure indentation in LiveJournal is to play with CSS, and my CSS-fu is weak. You'll have to make it pretty yourself.)


Tarfile="$1.tar.gz"
count=1
cd "${@%/*}"
if [ $# -eq 1 ]; then
while [ -e "$Tarfile" ]
do
let count++
Tarfile="$1 $count.tar"
done
else
Tarfile="Archive.tar"
while [ -e "$Tarfile" ]
do
let count++
Tarfile="Archive $count.tar"
done
fi
COPYFILE_DISABLE=true /usr/bin/tar -chzf "$Tarfile" "${@##*/}"

Profile

maxomai: dog (Default)
maxomai

December 2018

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829
30 31     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 2nd, 2026 03:17 pm
Powered by Dreamwidth Studios