Created
May 4, 2017 14:28
-
-
Save GeoffWilliams/62f4758c46e4e3a3a8a6f81e4935576c to your computer and use it in GitHub Desktop.
Generate dummy/fake RPMs - great for acceptance testing systems
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# From: https://www.redhat.com/archives/rpm-list/2006-November/msg00062.html | |
# | |
# Generate dummy/fake RPMs - great for acceptance testing systems | |
# | |
NAME=$1 | |
# | |
# GEnerate Provides: | |
PROVIDES="Provides: ${1}" | |
# | |
# Generate Spec file | |
SPECFILE=$(mktemp) | |
cat <<EOF > ${SPECFILE} | |
#----------- spec file starts --------------- | |
Name: ${NAME} | |
Version: 1.0.0 | |
Release: 0 | |
Vendor: dummy | |
Group: dummy | |
Summary: Provides %{name} | |
License: %{vendor} | |
# in Provides: you add whatever you want to fool the system | |
Buildroot: %{_tmppath}/%{name}-%{version}-root | |
${PROVIDES} | |
%description | |
%{summary} | |
%files | |
EOF | |
# | |
# Build it | |
BUILD_LOG=$(mktemp) | |
rpmbuild --define '_rpmdir /tmp' -bb "${SPECFILE}" > "${BUILD_LOG}" | |
if [ $? != 0 ] | |
then | |
echo "ERROR: Could nto build dummy rpm!" | |
fi | |
PKG=$(awk '/^Wrote:/ { print $2 }' < "${BUILD_LOG}" ) | |
rm "${BUILD_LOG}" | |
# | |
# Install it: | |
#rpm -Uvh "${PKG}" | |
rm "${SPECFILE}" | |
echo "DONE! created ${PKG} and moved it here..." | |
mv $PKG . |
This is for rpmbuild
before dnf
existed.
Oh right... no worries anyway, I found it under the package copr-rpmbuild
. I guess before dnf existed that would still be installed in the same way using yum.
And hey, thanks for the script! It worked like a charm for creating an android-tools dummy to keep using the ones bundled with Android Studio.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi there! I don't have rpmbuild installed, and searching in dnf shows mutliple options. Which one do you have installed?