This repository has been archived by the owner on Oct 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makebindist.sh
75 lines (61 loc) · 1.43 KB
/
makebindist.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
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
#!/bin/sh
match () {
local SUBFILE="$1"
local DIRNAME="$2"
CMPRES=`expr "${SUBFILE}" : "${DIRNAME}"`
RETVAL="$?"
if [ "${RETVAL}" -eq 0 ]; then
if [ -d "${SUBFILE}" ]; then
echo "`pwd`/${SUBFILE}/"
rm -r "${SUBFILE}"
else
echo "`pwd`/${SUBFILE}"
rm "${SUBFILE}"
fi
elif [ "${RETVAL}" -eq 1 ]; then
if [ -d "${SUBFILE}" ]; then
recursiveRmdir "${DIRNAME}" "${SUBFILE}"
fi
fi
}
recursiveRmdir () {
local DIRNAME="$1"
#local DIRNAMELEN="${#DIRNAME}"
shift 1
while [ ! $# -eq 0 ]; do
local FILE="$1"
shift 1
if [ -d "${FILE}" ]; then
pushd "${FILE}" > /dev/null
for SUBFILE in .*; do
if [ ! "${SUBFILE}" = ".." ] && [ ! "${SUBFILE}" = "." ]; then
match "${SUBFILE}" "${DIRNAME}"
fi
done
for SUBFILE in *; do
if [ ! "${SUBFILE}" = "*" ]; then
match "${SUBFILE}" "${DIRNAME}"
fi
done
popd > /dev/null
else
match "${FILE}" "${DIRNAME}"
fi
done
}
TEMPDIR=disttemp.~
echo "Cleaning temp dir..."
rm -r $TEMPDIR
mkdir $TEMPDIR
echo "Copying files..."
cp -r dist/* $TEMPDIR
echo "Setting execute permissions for shell scripts..."
chmod a+x $TEMPDIR/*.sh
echo "Removing CVS directories..."
recursiveRmdir "^CVS$" "$TEMPDIR"
echo "Building zip file..."
cd $TEMPDIR
rm ../releases/current-bin.zip
zip -9 -r ../releases/current-bin.zip *
cd ..
echo "Done! Zip file generated in releases/current-bin.zip"