summaryrefslogtreecommitdiff
path: root/ziparch.sh
blob: d4496ca551702aec6f8d9aa9db76e1ae43218f86 (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/bin/sh

# Make complete source distribution archive.

echo "Making Complete Argyll source archive argyll.zip... "

rm -f argyll.zip
rm -rf _zipdir
mkdir _zipdir
NOTFOUND=

for i in `cat adirs bdirs`
do
	echo
	echo "#### Doing Directory $i ####"
	if [ ! -e ${i}/afiles ] ; then
		if [ ! -e ${i}/bfiles ] ; then
			echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Can't find ${i}/afiles or ${i}/bfiles !!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
			NOTFOUND="$NOTFOUND ${i}/afiles ${i}/bfiles"
		fi
	fi

	if [ -e ${i}/afiles ] ; then
		rm -f _ziplist

		for j in `cat $i/afiles`
		do
			# Create any needed temporary directories
			tt=${i}/${j}
			path=${tt%/*}		# extract path without filename
			
			if ! expr _zipdir/${path} : '\b\.\b' > /dev/null  ; then   # if not "."
				if [ ! -e _zipdir/${path} ] ; then                     # if not been created
					mkdir -p _zipdir/${path}
				fi
			fi

			if [ ! -e ${i}/${j} ] ; then
				echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Can't find file ${i}/${j} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
				NOTFOUND="$NOTFOUND ${i}/${j}"
			else 
				dos2unix ${i}/${j}
				cp ${i}/${j} _zipdir/${i}/${j}
				echo ${i}/${j} >> _ziplist
			fi
		done

		cd _zipdir
		zip -9 -m ../argyll.zip `cat ../_ziplist`
		cd ..
		if ! expr ${i} : '\b\.\b' > /dev/null ; then
			rm -r _zipdir/${i}
		fi
	fi

	# same as above, but for "bfiles", if it exists
	if [ -e ${i}/bfiles ] ; then
		rm -f _ziplist

		for j in `cat $i/bfiles`
		do

			# Create any needed temporary directories
			tt=${i}/${j}
			path=${tt%/*}		# extract path without filename
			
			if ! expr _zipdir/${path} : '\b\.\b' > /dev/null  ; then   # if not "."
				if [ ! -e _zipdir/${path} ] ; then                     # if not been created
					mkdir -p _zipdir/${path}
				fi
			fi

			if [ ! -e ${i}/${j} ] ; then
				echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Can't find file ${i}/${j} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
				NOTFOUND="$NOTFOUND ${i}/${j}"
			else 
				dos2unix ${i}/${j}
				cp ${i}/${j} _zipdir/${i}/${j}
				echo ${i}/${j} >> _ziplist
			fi
		done

		cd _zipdir
		zip -9 -m ../argyll.zip `cat ../_ziplist`
		cd ..
		if ! expr ${i} : '\b\.\b' > /dev/null ; then
			rm -r _zipdir/${i}
		fi
	fi
done
rm -r _zipdir
rm _ziplist
if [ "X$NOTFOUND" != "X" ] ; then
    echo "!!!!!! Didn't find $NOTFOUND !!!!!!"
fi
echo "Finished Complete Argyll source archive argyll.zip... "