forked from ziegeer/droned
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patharchive.sh
executable file
·36 lines (26 loc) · 1.06 KB
/
archive.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
###############################################################################
# Quickly make a source distribution that should work on ALL POSIX systems
# that have a bourne shell
###############################################################################
#Reference For POSIX Commands
#http://manuals.ts.fujitsu.com/file/8867/posix_k.pdf
#where am i really from?
PROG=`readlink -f $0`
LOCATION=`dirname $PROG`
cd ${LOCATION} #make sure we are in the right place
VERSION=`tr -d '\n' < VERSION`
#create a scatch space
mkdir -p ${LOCATION}/.tmp/droned-${VERSION}
#filter out hidden src/version control dirs
pax -w -x ustar -s '!^.*/\..*$!!' . > ${LOCATION}/.tmp/out.tar
#now that hidden src control files have been removed re-archive
cd ${LOCATION}/.tmp/droned-${VERSION}
pax -r -f ${LOCATION}/.tmp/out.tar
cd $LOCATION/.tmp
#compression utilities are not guaranteed, although i haven't seen a system
#without gzip or bzip2 in a long time.
pax -w -x ustar droned-${VERSION} > ${LOCATION}/droned-${VERSION}.tar
cd ${LOCATION}
#clean up
rm -rf ${LOCATION}/.tmp