1 | #!/bin/sh
|
---|
2 | # $Id: $
|
---|
3 | # dass IT GmbH
|
---|
4 | #
|
---|
5 | # This script reads some information out of rpm packages and generates Suse patch files, signs and
|
---|
6 | # checks signature of package and finally puts patch descriptions and rpms onto the you server
|
---|
7 | #
|
---|
8 | # Parameter: binary rpm file
|
---|
9 | # TODO: Make patches consisting of more than one rpm, proceed some more rpm attributes into patch file
|
---|
10 |
|
---|
11 | ## customize THIS:
|
---|
12 |
|
---|
13 | YOUSERVER=lxcdtower
|
---|
14 | # There must be subirectories named patches and rpm below this path
|
---|
15 | YOUPATH=/cds/linux/i386/update/lvermgeo
|
---|
16 |
|
---|
17 | SIGNID="build@lvermgeo.rlp.de"
|
---|
18 |
|
---|
19 | ##
|
---|
20 |
|
---|
21 | function out()
|
---|
22 | {
|
---|
23 | echo $1 >> $PATCHFILE
|
---|
24 | #echo -e "\n" >> $PATCHFILE
|
---|
25 | }
|
---|
26 |
|
---|
27 |
|
---|
28 | #DESCRDIR=/usr/src/packages/PATCH/
|
---|
29 | DESCRDIR=/tmp
|
---|
30 |
|
---|
31 | PAKET=`rpm --queryformat %{NAME} -qp $1`
|
---|
32 | SUFFIX=`rpm --queryformat %{VERSION}-%{RELEASE} -qp $1`
|
---|
33 | SUMMARY=`rpm --queryformat %{SUMMARY} -qp $1`
|
---|
34 | DESCRIPTION=`rpm --queryformat %{DESCRIPTION} -qp $1`
|
---|
35 | ARCH=`rpm --queryformat %{ARCH} -qp $1`
|
---|
36 | GROUP=`rpm --queryformat %{GROUP} -qp $1`
|
---|
37 | SIZE=`rpm --queryformat %{SIZE} -qp $1`
|
---|
38 |
|
---|
39 | RELEASE=`date +%Y%m%d%H%M`
|
---|
40 |
|
---|
41 | RPMFILEBASENAME=`basename $1`
|
---|
42 |
|
---|
43 | # Name of patch-description file
|
---|
44 | PATCHFILE="$DESCRDIR/patch-$PAKET-$SUFFIX"
|
---|
45 |
|
---|
46 | if [ -e $PATCHFILE ]
|
---|
47 | then
|
---|
48 | rm $PATCHFILE
|
---|
49 | fi
|
---|
50 | out "##"
|
---|
51 | out "## Patch Description for $PAKET"
|
---|
52 | out "##"
|
---|
53 | out
|
---|
54 | out "Kind: recommended"
|
---|
55 | out "Shortdescription.english: $SUMMARY"
|
---|
56 | out "Longdescription.english:"
|
---|
57 | out "$DESCRIPTION"
|
---|
58 | out " "
|
---|
59 | out "Hsilgne.noitpircsedgnol:"
|
---|
60 | out "UpdateOnlyInstalled: false"
|
---|
61 | out "Size: $SIZE"
|
---|
62 | out "MinYaST1Version:"
|
---|
63 | out "MinYaST2Version:"
|
---|
64 | out
|
---|
65 | out "Packages:"
|
---|
66 | out "##"
|
---|
67 | out "Filename: $PAKET.rpm"
|
---|
68 | out "Label: $PAKET"
|
---|
69 | out "Series: $ARCH"
|
---|
70 | out "DepAND:"
|
---|
71 | out "DepOR:"
|
---|
72 | out "DepExcl:"
|
---|
73 | out "Flag:"
|
---|
74 | out "Category:"
|
---|
75 | out "RpmGroup: $GROUP"
|
---|
76 | out "Copyright: see package"
|
---|
77 | out "AuthorAddress:"
|
---|
78 | out "Version: $SUFFIX"
|
---|
79 | out "StartCommand:"
|
---|
80 | out "Obsoletes:"
|
---|
81 | out "Segakcap:"
|
---|
82 |
|
---|
83 |
|
---|
84 |
|
---|
85 | #for i in $SIGNID
|
---|
86 | #do
|
---|
87 | # echo Please enter Passphrase for gpg ID $SIGNID:
|
---|
88 | # read PASS
|
---|
89 | # echo $PASS | gpg -u $SIGNID --passphrase-fd 0 --clearsign $PATCHFILE
|
---|
90 |
|
---|
91 | gpg -u $SIGNID --clearsign $PATCHFILE
|
---|
92 | mv $PATCHFILE.asc $PATCHFILE
|
---|
93 | rpm --addsign $1
|
---|
94 |
|
---|
95 | #done
|
---|
96 |
|
---|
97 | if (rpm --checksig $1 | grep -q "gpg OK")
|
---|
98 | then
|
---|
99 | # publish
|
---|
100 | echo "Kopiere Dateien ..."
|
---|
101 | scp $PATCHFILE $YOUSERVER:$YOUPATH/patches
|
---|
102 | ssh $YOUSERVER "cd $YOUPATH/patches; ls -1 -A > directory.3"
|
---|
103 | scp $1 $YOUSERVER:$YOUPATH/rpm/$ARCH/
|
---|
104 | ssh $YOUSERVER "cd $YOUPATH/rpm/$ARCH/; ln -sf $RPMFILEBASENAME $PAKET.rpm; ls -1 -A > directory.3"
|
---|
105 | else
|
---|
106 | echo "rpm Signature _not_ Ok. stop"
|
---|
107 | exit 1
|
---|
108 | fi
|
---|