X-Git-Url: http://git.pld-linux.org/?a=blobdiff_plain;f=license-installer.sh;h=07b3cb1db5ac904a33b7d86461871382f32eb696;hb=6dc16e8fa01a1638ec749af8c2d4a0bcdff707b9;hp=0d3933c3f6bc65b102af083357ea833a1890ac76;hpb=f8f36cf977ba9fd2eb9eff6d714014bf2ad1a369;p=packages%2Facroread.git diff --git a/license-installer.sh b/license-installer.sh index 0d3933c..07b3cb1 100644 --- a/license-installer.sh +++ b/license-installer.sh @@ -1,45 +1,26 @@ #!/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 - ( cd $SRPMDIR + ( if echo "$3" | grep '://' >/dev/null; then + cd $SRPMDIR wget --passive-ftp -t0 "$3" else - cp -f "$3" . + cp -f "$3" $SRPMDIR fi - rpm2cpio `basename "$3"` | ( cd $TMPDIR; cpio -i @BASE_NAME@.spec ) + rpm2cpio `basename "$3"` | ( cd $SPECDIR; cpio -i @BASE_NAME@.spec ) if [ '@COPYSOURCES@' != '@'COPYSOURCES'@' ]; then - for i in @COPYSOURCES@; do - rpm2cpio $i | ( cd $TMPDIR; cpio -i $i ) - done + rpm2cpio `basename "$3"` | ( cd $SOURCEDIR; cpio -i @COPYSOURCES@ ) fi ) - cp -i $TMPDIR/@BASE_NAME@.spec $SPECDIR/@BASE_NAME@.spec || exit 1 - if [ '@COPYSOURCES@' != '@'COPYSOURCES'@' ]; then - for i in @COPYSOURCES@; do - cp -i $TMPDIR/$i $SOURCEDIR/$i || exit 1 - done - fi else cp -i "$3" $SPECDIR || exit 1 if [ '@COPYSOURCES@' != '@'COPYSOURCES'@' ]; then @@ -49,25 +30,16 @@ if [ "$1" = "--with" -a "$2" = "license_agreement" ]; then fi fi ( cd $SPECDIR - /usr/bin/builder -nm -nc -ncs --with license_agreement --opts --target=@TARGET_CPU@ @BASE_NAME@.spec + nd= + if [ '@USE_DISTFILES@' = 'no' ]; then + nd=-nd + fi + /usr/bin/builder --define _topdir $tmp $nd -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 - BACKUP=1 - fi - done - fi - fi else if [ "@LICENSE@" != '@'LICENSE'@' ]; then cat @LICENSE@