1 | #!/bin/bash
|
---|
2 | #
|
---|
3 | # Deliver packages to Fedora
|
---|
4 | #
|
---|
5 | # $Id$
|
---|
6 | #
|
---|
7 |
|
---|
8 | (
|
---|
9 | dname=`dirname $0`
|
---|
10 | prem=`echo $dname |cut -c1`
|
---|
11 | if [ ${prem} == "/" ]; then
|
---|
12 | export TOOLHOME=$dname
|
---|
13 | else
|
---|
14 | export TOOLHOME=${PWD}/$dname
|
---|
15 | fi
|
---|
16 |
|
---|
17 | . $TOOLHOME/common-env
|
---|
18 | . $TOOLHOME/distro-env
|
---|
19 | . $TOOLHOME/fc-env
|
---|
20 |
|
---|
21 | # We need to get $VER and $TAG
|
---|
22 | if [ "$1" = "" ]; then
|
---|
23 | LAST=`cat ${TOPDIR}/LAST`
|
---|
24 | else
|
---|
25 | LAST=$1
|
---|
26 | shift
|
---|
27 | fi
|
---|
28 | VER=`echo $LAST | cut -d- -f1`
|
---|
29 | TAG=`echo $LAST | cut -d- -f2`
|
---|
30 | echo "Working on ${VER}-$TAG"
|
---|
31 |
|
---|
32 | if [ "$1" = "" ]; then
|
---|
33 | c="mondo-doc mindi mindi-busybox mondo"
|
---|
34 | else
|
---|
35 | if [ "$1" = "all" ]; then
|
---|
36 | c="mindi-kernel mondo-doc mindi mindi-busybox mondo"
|
---|
37 | else
|
---|
38 | c="$*"
|
---|
39 | fi
|
---|
40 | fi
|
---|
41 |
|
---|
42 | export pkg=""
|
---|
43 | echo "Working under $TOPBUILDDIR"
|
---|
44 | cd $TOPBUILDDIR
|
---|
45 |
|
---|
46 | ppkg=""
|
---|
47 | spkg=""
|
---|
48 |
|
---|
49 | for p in $c; do
|
---|
50 | # s= stable; t = trunk; 1-9 = official version
|
---|
51 | src=${TOPDIR}/${VER}-$TAG/$p-[1-9st]*.tar.gz
|
---|
52 | pv=`basename $src .tar.gz`
|
---|
53 | tag=`echo $pv | sed "s/-\([0-9]*.*\)/\2/"`
|
---|
54 | spkg="$spkg ${TOPBUILDDIR}/SRPMS/$pv-${tag}${suf}.src.rpm"
|
---|
55 | ppkg="$ppkg $pv-${tag}${suf}.src.rpm"
|
---|
56 | done
|
---|
57 |
|
---|
58 | echo "Packages delivery to ${ACCOUNT}"
|
---|
59 | cat > /tmp/mkmondo << EOF
|
---|
60 | rm -f /tmp/mondorescue.log
|
---|
61 | for p in $ppkg ; do
|
---|
62 | rpm -ivh \$p
|
---|
63 | s=\`rpm -qlp \$p | egrep '\.spec'\`
|
---|
64 | # Use dist for fc
|
---|
65 | perl -pi -e "s/define Release:[ \t]+([0-9]+)..*/define Release: $1%{?dist}/" rpm/SPECS/\$s
|
---|
66 | perl -pi -e 's/ Bruno Cornec <bruno@mondorescue.org>..*/ Bruno Cornec <bruno@mondorescue.org> %{version}-%{release}/' rpm/SPECS/\$s
|
---|
67 | rm -rf rpm/BUILD/*
|
---|
68 | rpmbuild -ba rpm/SPECS/\$s 2>&1 | tee -a /tmp/mondorescue.log
|
---|
69 | done
|
---|
70 | apkg=\`egrep "^Wrote:" /tmp/mondorescue.log | grep -v debug | cut -d: -f2\`
|
---|
71 | aspkg=\`echo \$apkg | egrep "\.src.rpm"\`
|
---|
72 | mkdir -p \$DSTDIR
|
---|
73 | mv \$aspkg \$DSTDIR
|
---|
74 | rm -f \$ppkg
|
---|
75 | EOF
|
---|
76 | chmod 755 /tmp/mkmondo
|
---|
77 | scp -p ${spkg} /tmp/mkmondo ${ACCOUNT}:
|
---|
78 | scp -p /tmp/mkmondo ${ACCOUNT}:
|
---|
79 | echo "Packages rebuild on ${DSTNODE}"
|
---|
80 | ssh ${ACCOUNT} ${DSTNODE} "./mkmondo"
|
---|
81 | ) 2>&1 | tee /tmp/pk2mdv.log
|
---|