From 9b1907d400e4b0c00faed51ef6b404252c5a0b62 Mon Sep 17 00:00:00 2001 From: navid Date: Fri, 5 Oct 2007 09:56:44 +0000 Subject: added support for GPG encryption of reports git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@417 ef72aa8b-4018-0410-8976-d6e080ef94d8 --- src/Makefile | 17 ++++++++++++++--- src/gpgkeys/gpg.template | 2 +- src/setup.py | 2 +- src/sos-internal.spec | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/sos.spec | 4 +++- 5 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 src/sos-internal.spec (limited to 'src') diff --git a/src/Makefile b/src/Makefile index fd0094e2..bcfa5324 100644 --- a/src/Makefile +++ b/src/Makefile @@ -70,16 +70,27 @@ clean: @rm -fv *~ .*~ changenew ChangeLog.old $(NAME)-$(VERSION).tar.bz2 sosreport.1.gz gpgkeys/rhsupport.* @rm -rfv build/* -rpm: mo - @test -f sos.spec +internal-rpm: gpgkey + @test -f sos-internal.spec + @mkdir -p $(TOPDIR)/SOURCES $(TOPDIR)/SRPMS $(TOPDIR)/RPMS $(TOPDIR)/BUILD $(SRCDIR)/dist + cp gpgkeys/rhsupport.pub gpgkeys/rhsupport.key $(TOPDIR)/SOURCES + rpmbuild -ba --define="_topdir $(TOPDIR)" sos-internal.spec + @mv $(TOPDIR)/RPMS/noarch/$(NAME)-internal-*.rpm $(TOPDIR)/SRPMS/$(NAME)-internal-*.rpm dist/ + cp gpgkeys/rhsupport.key dist/ + +rpm: mo gpgkey @mkdir -p $(TOPDIR)/SOURCES $(TOPDIR)/SRPMS $(TOPDIR)/RPMS $(TOPDIR)/BUILD $(SRCDIR)/dist + cp gpgkeys/rhsupport.pub $(TOPDIR)/SOURCES + + @test -f sos.spec + # this builds an RPM from the current working copy @cd $(TOPDIR)/BUILD ; \ rm -rf $(NAME)-$(VERSION) ; \ ln -s $(SRCDIR) $(NAME)-$(VERSION) ; \ tar --gzip --exclude=.svn --exclude=svn-commit.tmp --exclude=$(NAME)-$(VERSION)/build --exclude=$(NAME)-$(VERSION)/dist \ - --exclude gpgkeys/rhsupport.key \ + --exclude gpgkeys/rhsupport.pub --exclude gpgkeys/rhsupport.key \ -chSpf $(TOPDIR)/SOURCES/$(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION) ; \ rm -f $(NAME)-$(VERSION) diff --git a/src/gpgkeys/gpg.template b/src/gpgkeys/gpg.template index 4df26886..261f5b31 100644 --- a/src/gpgkeys/gpg.template +++ b/src/gpgkeys/gpg.template @@ -4,7 +4,7 @@ Key-Length: 1024 Subkey-Type: ELG-E Subkey-Length: 1024 Name-Real: Red Hat Support -Name-Comment: wi +Name-Comment: SoS Encryption Key Name-Email: support@redhat.com Expire-Date: 0 Passphrase: redhat diff --git a/src/setup.py b/src/setup.py index 3272531f..b64c3593 100644 --- a/src/setup.py +++ b/src/setup.py @@ -9,6 +9,6 @@ setup( packages = ['sos', 'sos.plugins'], scripts = [], package_dir = {'': 'lib',}, - data_files = [ ('/usr/sbin', ['sosreport', 'extras/sysreport/sysreport.legacy']), ('/usr/bin', ['extras/rh-upload-core']), ('/usr/share/sos', ['gpgkeys/rhsupport.pub']), ('/usr/share/sysreport', ['extras/sysreport/text.xsl', 'extras/sysreport/functions', 'extras/sysreport/sysreport-fdisk']), ('/usr/share/man/man1', ['sosreport.1']), ('/usr/share/locale/en', []), ('/usr/share/locale/it', []), ('/usr/share/locale/en/LC_MESSAGES', ['locale/en/LC_MESSAGES/sos.mo']), ('/usr/share/locale/it/LC_MESSAGES', ['locale/it/LC_MESSAGES/sos.mo']), ('/usr/share/locale/fr/LC_MESSAGES', ['locale/fr/LC_MESSAGES/sos.mo']), ('/usr/share/locale/ar/LC_MESSAGES', ['locale/ar/LC_MESSAGES/sos.mo']) + data_files = [ ('/usr/sbin', ['sosreport', 'extras/sysreport/sysreport.legacy']), ('/usr/bin', ['extras/rh-upload-core']), ('/usr/share/sysreport', ['extras/sysreport/text.xsl', 'extras/sysreport/functions', 'extras/sysreport/sysreport-fdisk']), ('/usr/share/man/man1', ['sosreport.1']), ('/usr/share/locale/en', []), ('/usr/share/locale/it', []), ('/usr/share/locale/en/LC_MESSAGES', ['locale/en/LC_MESSAGES/sos.mo']), ('/usr/share/locale/it/LC_MESSAGES', ['locale/it/LC_MESSAGES/sos.mo']), ('/usr/share/locale/fr/LC_MESSAGES', ['locale/fr/LC_MESSAGES/sos.mo']), ('/usr/share/locale/ar/LC_MESSAGES', ['locale/ar/LC_MESSAGES/sos.mo']) ] ) diff --git a/src/sos-internal.spec b/src/sos-internal.spec new file mode 100644 index 00000000..86f0cc73 --- /dev/null +++ b/src/sos-internal.spec @@ -0,0 +1,45 @@ +%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} + +%define name sos-internal +%define version 1.0 +%define release 0 + +Summary: Red Hat Support GPG private key +Name: %{name} +Version: %{version} +Release: %{release}%{?dist} +Group: Application/Tools + +Source0: rhsupport.pub +Source1: rhsupport.key +License: GPL +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot +BuildArch: noarch +Url: http://sos.108.redhat.com/ + +%description +Sos is a set of tools that gathers information about system +hardware and configuration. The information can then be used for +diagnostic purposes and debugging. Sos is commonly used to help +support technicians and developers. + +%install +rm -rf ${RPM_BUILD_ROOT} +install -D -m600 %{SOURCE0} ${RPM_BUILD_ROOT}/usr/share/sos/rhsupport.pub +install -D -m644 %{SOURCE1} ${RPM_BUILD_ROOT}/usr/share/sos/rhsupport.key + +%clean +rm -rf ${RPM_BUILD_ROOT} + +%post +/usr/bin/gpg --import /usr/share/sos/rhsupport.pub +/usr/bin/gpg --allow-secret-key-import --import /usr/share/sos/rhsupport.key + +%files +%defattr(-,root,root,-) +/usr/share/sos/rhsupport.pub +/usr/share/sos/rhsupport.key + +%changelog +* Wed Sep 4 2007 Navid Sheikhol-Eslami - 1.0 +- the GPG key will be regenerated every time this package is built diff --git a/src/sos.spec b/src/sos.spec index 58a3f67b..973be121 100644 --- a/src/sos.spec +++ b/src/sos.spec @@ -10,13 +10,14 @@ Summary: A set of tools to gather troubleshooting information from a system Name: %{name} Version: %{version} Release: %{release}%{?dist} +Group: Application/Tools # The source for this package was pulled from upstream's svn. Use the # following commands to generate the tarball: # svn --username guest export https://sos.108.redhat.com/svn/sos/tags/r1-7 sos-1.7 # tar -czvf sos-1.7.tar.gz sos-1.7 Source0: %{name}-%{version}.tar.gz +Source1: rhsupport.pub License: GPL -Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot BuildArch: noarch Url: http://sos.108.redhat.com/ @@ -38,6 +39,7 @@ python setup.py build %install rm -rf ${RPM_BUILD_ROOT} +install -D -m644 %{SOURCE1} ${RPM_BUILD_ROOT}/usr/share/sos/rhsupport.pub python setup.py install --optimize 1 --root=$RPM_BUILD_ROOT ln -s /usr/sbin/sosreport $RPM_BUILD_ROOT/usr/sbin/sysreport -- cgit