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 | YOUPATH=/cds/linux/i386/update/lvermgeo
|
---|
15 |
|
---|
16 | ##
|
---|
17 |
|
---|
18 | function out()
|
---|
19 | {
|
---|
20 | echo $1 >> $PATCHFILE
|
---|
21 | #echo -e "\n" >> $PATCHFILE
|
---|
22 | }
|
---|
23 |
|
---|
24 | DESCRDIR=/usr/src/packages/PATCH/
|
---|
25 |
|
---|
26 |
|
---|
27 |
|
---|
28 | PAKET=`rpm --queryformat %{NAME} -qp $1`
|
---|
29 | SUFFIX=`rpm --queryformat %{VERSION}-%{RELEASE} -qp $1`
|
---|
30 | SUMMARY=`rpm --queryformat %{SUMMARY} -qp $1`
|
---|
31 | DESCRIPTION=`rpm --queryformat %{DESCRIPTION} -qp $1`
|
---|
32 | ARCH=`rpm --queryformat %{ARCH} -qp $1`
|
---|
33 | GROUP=`rpm --queryformat %{GROUP} -qp $1`
|
---|
34 | SIZE=`rpm --queryformat %{SIZE} -qp $1`
|
---|
35 |
|
---|
36 | RELEASE=`date +%Y%m%d%H%M`
|
---|
37 |
|
---|
38 | RPMFILEBASENAME=`basename $1`
|
---|
39 |
|
---|
40 | # Name of patch-description file
|
---|
41 | PATCHFILE="$DESCRDIR/patch-$PAKET-$SUFFIX"
|
---|
42 |
|
---|
43 | if [ -e $PATCHFILE ]
|
---|
44 | then
|
---|
45 | rm $PATCHFILE
|
---|
46 | fi
|
---|
47 | out "##"
|
---|
48 | out "## Patch Description for $PAKET"
|
---|
49 | out "##"
|
---|
50 | out
|
---|
51 | out "Kind: recommended"
|
---|
52 | out "Shortdescription.english: $SUMMARY"
|
---|
53 | out "Longdescription.english:"
|
---|
54 | out "$DESCRIPTION"
|
---|
55 | out " "
|
---|
56 | out "Hsilgne.noitpircsedgnol:"
|
---|
57 | out "UpdateOnlyInstalled: false"
|
---|
58 | out "Size: $SIZE"
|
---|
59 | out "MinYaST1Version:"
|
---|
60 | out "MinYaST2Version:"
|
---|
61 | out
|
---|
62 | out "Packages:"
|
---|
63 | out "##"
|
---|
64 | out "Filename: $PAKET.rpm"
|
---|
65 | out "Label: $PAKET"
|
---|
66 | out "Series: $ARCH"
|
---|
67 | out "DepAND:"
|
---|
68 | out "DepOR:"
|
---|
69 | out "DepExcl:"
|
---|
70 | out "Flag:"
|
---|
71 | out "Category:"
|
---|
72 | out "RpmGroup: $GROUP"
|
---|
73 | out "Copyright: see package"
|
---|
74 | out "AuthorAddress:"
|
---|
75 | out "Version: $SUFFIX"
|
---|
76 | out "StartCommand:"
|
---|
77 | out "Obsoletes:"
|
---|
78 | out "Segakcap:"
|
---|
79 |
|
---|
80 |
|
---|
81 | gpg --clearsign $PATCHFILE
|
---|
82 |
|
---|
83 | mv $PATCHFILE.asc $PATCHFILE
|
---|
84 |
|
---|
85 | if (rpm --checksig $1 | grep -q "gpg OK")
|
---|
86 | then
|
---|
87 | # publish
|
---|
88 | echo "Kopiere Dateien ..."
|
---|
89 | scp $PATCHFILE $YOUSERVER:$YOUPATH/patches
|
---|
90 | ssh $YOUSERVER "cd $YOUPATH/patches; ls -1 -A > directory.3"
|
---|
91 | scp $1 $YOUSERVER:$YOUPATH/rpm/$ARCH/
|
---|
92 | ssh $YOUSERVER "cd $YOUPATH/rpm/$ARCH/; ln -sf $RPMFILEBASENAME $PAKET.rpm; ls -1 -A > directory.3"
|
---|
93 | else
|
---|
94 | echo "rpm Signature _not_ Ok. stop"
|
---|
95 | exit 1
|
---|
96 | fi
|
---|
97 |
|
---|
98 |
|
---|
99 |
|
---|
100 |
|
---|
101 |
|
---|