Skip to content

Instantly share code, notes, and snippets.

@wilsonianb
Created March 5, 2018 17:02
Show Gist options
  • Save wilsonianb/24ff21ae1a8c6191b11286cb088faa4e to your computer and use it in GitHub Desktop.
Save wilsonianb/24ff21ae1a8c6191b11286cb088faa4e to your computer and use it in GitHub Desktop.
Rebuild rpm deb package to exclude payload signatures on source and debuginfo rpms
FROM ubuntu:xenial
RUN apt-get update
RUN apt-get install -y rpm devscripts yum-utils
RUN apt-get source rpm
RUN apt-get build-dep -y rpm
RUN sed -i '383s/.*/ if (strstr(sigt1->fileName, "src") == NULL \&\& strstr(sigt1->fileName, "debuginfo") == NULL) {/' rpm-4.12.0.1+dfsg1/sign/rpmgensig.c
RUN sed -i '387s/.*/ }/' rpm-4.12.0.1+dfsg1/sign/rpmgensig.c
RUN cd rpm-4.12.0.1+dfsg1 && dpkg-buildpackage -b -us -uc
RUN dpkg -i librpmsign3_4.12.0.1+dfsg1-3build3_amd64.deb
RUN echo '%echo Generating a basic OpenPGP key\n\
Key-Type: RSA\n\
Key-Length: 1024\n\
Name-Real: Brandon\n\
Name-Comment: with no passphrase\n\
Name-Email: [email protected]\n\
Expire-Date: 0\n'\
>> gpgkey
RUN gpg --batch --gen-key gpgkey
RUN gpg --armor --export [email protected] > mykey.asc
RUN rpm --import mykey.asc
RUN echo '%_signature gpg\n\
%_gpg_name Brandon\n\
%_gpg_path /root/.gnupg\n\
%_gpg_digest_algo sha256'\
>> /root/.rpmmacros
RUN rpm -Uvh https://mirrors.ripple.com/ripple-repo-el7.rpm
RUN yumdownloader --enablerepo=ripple-stable --releasever=el7 rippled
RUN yumdownloader --enablerepo=ripple-stable --source --releasever=el7 rippled
COPY rippled-debuginfo-0.90.0-0.1.rc2.fc27.x86_64.rpm .
RUN rpm --addsign rippled*.rpm
RUN rpm -Kv rippled*.rpm
# build image
# sudo docker build -t rpm-ubuntu .
# extract rpm
# sudo docker run --rm -v $(pwd):/out/ --entrypoint "/bin/cp" rpm-ubuntu librpmsign3_4.12.0.1+dfsg1-3build3_amd64.deb /out/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment