forked from SodaqMoja/Microchip_RN487x
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmake-zip.sh
More file actions
25 lines (20 loc) · 738 Bytes
/
make-zip.sh
File metadata and controls
25 lines (20 loc) · 738 Bytes
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
#!/bin/sh
#
# Make a ZIP file for distribution / publishing.
#VERSION=$(git describe --abbrev=0 --tags 2> /dev/null)
VERSION=$(git describe --tags 2> /dev/null)
[ -z "${VERSION}" ] && { echo "ERROR: Cannot determine version. Did you do a git-tag?"; exit 1; }
FILES=$(git ls-files|grep -v .gitignore)
[ -z "${FILES}" ] && { echo "ERROR: No files to put in ZIP."; exit 1; }
DIRNAME="$(basename $(pwd))"
ZIPNAME="${DIRNAME}-${VERSION}"
TDIR=/tmp/$DIRNAME
[ -d "${TDIR}" ] && { echo "ERROR: Directory '${TDIR}' exists. Please remove."; exit 1; }
mkdir -p ${TDIR}
git ls-files |
grep -v .gitignore |
cpio -pmud ${TDIR}/
(cd /tmp && zip -r $ZIPNAME.zip $DIRNAME)
mv /tmp/$ZIPNAME.zip .
ln -sf -T $ZIPNAME.zip ${DIRNAME}.zip
rm -fr ${TDIR}