forked from zba/dtc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dist
executable file
·30 lines (25 loc) · 804 Bytes
/
dist
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
#!/bin/sh
set -e
set -x
VERS=`head -n 1 debian/changelog | cut -d'(' -f2 | cut -d')' -f1 | cut -d'-' -f1`
PKGNAME=`head -n 1 debian/changelog | cut -d' ' -f1`-core
if [ -e /etc/redhat-release ] ; then
MKTEMP="mktemp -d -p /tmp"
else
MKTEMP="mktemp -d -t"
fi
TMPDIR=`${MKTEMP} ${PKGNAME}.XXXXXX`
DIRNAME=${PKGNAME}-${VERS}
MYCWD=`pwd`
mkdir -p ${TMPDIR}/${DIRNAME}
cp -auxf * ${TMPDIR}/${DIRNAME}
mv ${TMPDIR}/${DIRNAME}/dtc.spec ${TMPDIR}/${DIRNAME}/dtc-core.spec
sed -i "s/__VERSION__/${VERS}/" ${TMPDIR}/${DIRNAME}/${PKGNAME}.spec
mv ${TMPDIR}/${DIRNAME}/${PKGNAME}.spec ${TMPDIR}/${DIRNAME}/${PKGNAME}-core.spec
rm -rf ${TMPDIR}/${DIRNAME}/debian
rm -rf ${TMPDIR}/${DIRNAME}/.git
cd ${TMPDIR}
tar -czf ${DIRNAME}.tar.gz ${DIRNAME}
cd ${MYCWD}
mv ${TMPDIR}/${DIRNAME}.tar.gz ..
rm -rf ${TMPDIR}