summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElan Ruusamäe2006-04-22 18:35:46 (GMT)
committercvs2git2012-06-24 12:13:13 (GMT)
commit4bbcd5718fb4b2c7257733de6685f97f5cb54816 (patch)
treecd4d8327c6222c069cba9bc23edb483185433b8a
parent066d48b7e02155ccaae2c046586027591b7ac115 (diff)
downloadfonts-TTF-microsoft-4bbcd5718fb4b2c7257733de6685f97f5cb54816.zip
fonts-TTF-microsoft-4bbcd5718fb4b2c7257733de6685f97f5cb54816.tar.gz
- use temp dir for rpm topdir avoiding overwriting any file
Changed files: license-installer.sh -> 1.10
-rw-r--r--license-installer.sh43
1 files changed, 9 insertions, 34 deletions
diff --git a/license-installer.sh b/license-installer.sh
index d089f89..31a81f7 100644
--- a/license-installer.sh
+++ b/license-installer.sh
@@ -1,25 +1,13 @@
#!/bin/sh
if [ "$1" = "--with" -a "$2" = "license_agreement" ]; then
- TMPDIR=`rpm --eval "%{tmpdir}"`; export TMPDIR
- SPECDIR=`rpm --eval "%{_specdir}"`; export SPECDIR
- SRPMDIR=`rpm --eval "%{_srcrpmdir}"`; export SRPMDIR
- SOURCEDIR=`rpm --eval "%{_sourcedir}"`; export SOURCEDIR
- BUILDDIR=`rpm --eval "%{_builddir}"`; export BUILDDIR
- RPMDIR=`rpm --eval "%{_rpmdir}"`; export RPMDIR
- BACKUP=0
- mkdir -p $TMPDIR $SPECDIR $SRPMDIR $RPMDIR $SRPMDIR $SOURCEDIR $BUILDDIR
- if [ -f $SPECDIR/@BASE_NAME@.spec ]; then
- BACKUP=1
- mv -f $SPECDIR/@BASE_NAME@.spec $SPECDIR/@BASE_NAME@.spec.prev
- fi
- if [ '@COPYSOURCES@' != '@'COPYSOURCES'@' ]; then
- for i in @COPYSOURCES@; do
- if [ -f $SOURCEDIR/$i ]; then
- mv -f $SOURCEDIR/$i $SOURCEDIR/$i.prev
- BACKUP=1
- fi
- done
- fi
+ tmp=$(mktemp -d)
+ SPECDIR=`rpm --define "_topdir $tmp" --eval "%{_specdir}"`
+ SRPMDIR=`rpm --define "_topdir $tmp" --eval "%{_srcrpmdir}"`
+ SOURCEDIR=`rpm --define "_topdir $tmp" --eval "%{_sourcedir}"`
+ BUILDDIR=`rpm --define "_topdir $tmp" --eval "%{_builddir}"`
+ RPMDIR=`rpm --define "_topdir $tmp" --eval "%{_rpmdir}"`
+ mkdir -p $SPECDIR $SRPMDIR $RPMDIR $SRPMDIR $SOURCEDIR $BUILDDIR
+
if echo "$3" | grep '\.src\.rpm$' >/dev/null; then
(
if echo "$3" | grep '://' >/dev/null; then
@@ -27,7 +15,6 @@ if [ "$1" = "--with" -a "$2" = "license_agreement" ]; then
wget --passive-ftp -t0 "$3"
else
cp -f "$3" $SRPMDIR
- cd $SRPMDIR
fi
rpm2cpio `basename "$3"` | ( cd $SPECDIR; cpio -i @BASE_NAME@.spec )
if [ '@COPYSOURCES@' != '@'COPYSOURCES'@' ]; then
@@ -43,24 +30,12 @@ if [ "$1" = "--with" -a "$2" = "license_agreement" ]; then
fi
fi
( cd $SPECDIR
- /usr/bin/builder -nm -nc -ncs --with license_agreement --target @TARGET_CPU@ @BASE_NAME@.spec
+ /usr/bin/builder --define _topdir $tmp -nm -nc -ncs --with license_agreement --target @TARGET_CPU@ @BASE_NAME@.spec
if [ "$?" -ne 0 ]; then
exit 2
fi
RPMNAMES="$RPMDIR/@BASE_NAME@-@VERSION@-@RELEASE@wla.@TARGET_CPU@.rpm"
rpm -Uhv $RPMNAMES || echo -e "Install manually the file(s):\n $RPMNAMES" )
- if [ "$BACKUP" -eq 1 ]; then
- if [ -f $SPECDIR/@BASE_NAME@.spec.prev ]; then
- mv -f $SPECDIR/@BASE_NAME@.spec.prev $SPECDIR/@BASE_NAME@.spec
- fi
- if [ '@COPYSOURCES@' != '@'COPYSOURCES'@' ]; then
- for i in @COPYSOURCES@; do
- if [ -f $SOURCEDIR/$i ]; then
- mv -f $SOURCEDIR/$i.prev $SOURCEDIR/$i
- fi
- done
- fi
- fi
else
if [ "@LICENSE@" != '@'LICENSE'@' ]; then
cat @LICENSE@