74 lines
2.9 KiB
Bash
74 lines
2.9 KiB
Bash
|
#!/bin/sh
|
||
|
#
|
||
|
# s/\$([A-Z]*)/${\1}/
|
||
|
# s/; */; \\/
|
||
|
# s/then/then \\/
|
||
|
# s/else/else \\/
|
||
|
#
|
||
|
NAME=$(basename `pwd`)
|
||
|
VER_REL=$(rpm -q --qf "%{VERSION}\n" --specfile ${NAME}.spec | head -1)
|
||
|
ARCHIVEFILE=$(cat ${NAME}.spec | grep Source | sed -r 's/^Source[0..9]*:\s*//' | xargs basename)
|
||
|
ARCHIVEFILE=$(rpm --queryformat "${ARCHIVEFILE}\n" --specfile ${NAME}.spec | head -n 1)
|
||
|
TEMPDIR=`mktemp -d`
|
||
|
#TREEPATH=$(echo "$ARCHIVEFILENAME" | cut -f 1 -d '.')
|
||
|
TREEPATH="$NAME-$VER_REL"
|
||
|
echo "$NAME $ARCHIVEFILE $TREEPATH"
|
||
|
|
||
|
echo "Making archive file ${ARCHIVEFILE} `pwd`" ; \
|
||
|
if [ "${NAME#smeserver}" = "${NAME}" ] || [ "${NAME#e-smith}" = "${NAME}" ] ; then \
|
||
|
echo "Building for SME package"; \
|
||
|
echo "Making archive ${ARCHIVEFILE}"; \
|
||
|
TEMPDIR=`mktemp -d`; \
|
||
|
mkdir -p ${TEMPDIR}/${TREEPATH}; \
|
||
|
cp -r root ${TEMPDIR}/${TREEPATH}; \
|
||
|
if test -f createlinks ; then cp createlinks ${TEMPDIR}/${TREEPATH} ; fi ; \
|
||
|
if test -f COPYING ; then cp COPYING ${TEMPDIR}/${TREEPATH} ; fi ; \
|
||
|
if test -f LICENSE ; then cp LICENSE ${TEMPDIR}/${TREEPATH} ; fi ; \
|
||
|
if test -f Copying ; then cp Copying ${TEMPDIR}/${TREEPATH} ; fi ; \
|
||
|
if test -f Artistic ; then cp Artistic ${TEMPDIR}/${TREEPATH} ; fi ; \
|
||
|
if test -f *.c ; then cp *.c ${TEMPDIR}/${TREEPATH} ; fi ; \
|
||
|
rm -f ${ARCHIVEFILE}; \
|
||
|
tar -czf ${ARCHIVEFILE} -C ${TEMPDIR} ${TREEPATH}; \
|
||
|
ls -l ${ARCHIVEFILE}; \
|
||
|
find ${TEMPDIR} -delete; \
|
||
|
else \
|
||
|
echo "3rd party package should already be there"; \
|
||
|
if [ ! -e "${ARCHIVEFILE}" ] ; then \
|
||
|
$(error "Can't find 3rd party archive: ${ARCHIVEFILE} "); \
|
||
|
else \
|
||
|
echo "Found 3rd party ${ARCHIVEFILE}"; \
|
||
|
fi ; \
|
||
|
fi
|
||
|
|
||
|
#EXT=tar.gz
|
||
|
#echo "Making archive file ${ARCHIVEFILE} `pwd`" ; \
|
||
|
#if [ "${NAME#smeserver}" != "${NAME}" ] || [ "${NAME#e-smith}" != "${NAME}" ] ; then \
|
||
|
#echo "Building for SME package"; \
|
||
|
#GOTSOURCE='1'; \
|
||
|
#else \
|
||
|
#echo "Building for 3rd party package"; \
|
||
|
#GOTSOURCE='0'; \
|
||
|
#fi ; \
|
||
|
#echo "GOTSOURCE:${GOTSOURCE} TEMPDIR:${TEMPDIR}" ; \
|
||
|
#if [ ${GOTSOURCE} = '0' ]; then \
|
||
|
#if [ ! -e ${ARCHIVEFILE} ] ; then echo "Can't find 3rd party archive: ${ARCHIVEFILE} "; \
|
||
|
#GOTSOURCE='1'; \
|
||
|
#else \
|
||
|
#echo "Found ${ARCHIVEFILE}"; \
|
||
|
#fi \
|
||
|
#fi ; \
|
||
|
#if [ ${GOTSOURCE} = '1' ]; then \
|
||
|
#echo "Making archive ${ARCHIVEFILE}"; \
|
||
|
#mkdir -p ${TEMPDIR}/${TREEPATH}; \
|
||
|
#cp -r root ${TEMPDIR}/${TREEPATH}; \
|
||
|
#if test -f createlinks ; then cp createlinks ${TEMPDIR}/${TREEPATH} ; fi ; \
|
||
|
#if test -f COPYING ; then cp COPYING ${TEMPDIR}/${TREEPATH} ; fi ; \
|
||
|
#if test -f LICENSE ; then cp LICENSE ${TEMPDIR}/${TREEPATH} ; fi ; \
|
||
|
#if test -f Copying ; then cp Copying ${TEMPDIR}/${TREEPATH} ; fi ; \
|
||
|
#if test -f Artistic ; then cp Artistic ${TEMPDIR}/${TREEPATH} ; fi ; \
|
||
|
#if test -f *.c ; then cp *.c ${TEMPDIR}/${TREEPATH} ; fi ; \
|
||
|
#rm -f ${ARCHIVEFILE}; \
|
||
|
#tar -czf ${ARCHIVEFILE} -C ${TEMPDIR} ${TREEPATH}; \
|
||
|
#ls -l ${ARCHIVEFILE}; \
|
||
|
#fi ; \
|
||
|
#find ${TEMPDIR} -delete;
|