Re: How to add an entry in the rpm database (without a package onhand)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/15/06, James Olin Oden <james.oden@xxxxxxxxx> wrote:
On 11/15/06, Igor Pasemnik <ipasemnik@xxxxxxxxxxxxxxxxxxx> wrote:
> I assume you want to satisfy some requires from some other packages,
> although you mentioned without rpm and/or creating one, here is how easy
> it is to bypass using --nodeps and satisfy whatever requirements that
> other package has, assuming you really want to bypass the requirements,
> here is a minimal spec file, say something like dummy.spec, build it as
> root or non-root with the following stanza:

I was making this really hard.  This is a much easier solution.
Hmmm...some times you have to with their problem rather than the
question they asked.

Yeah, and one could with a little creativity wrap this up in a simple
shell script that
creates the package on the fly and installs, so this user could have:

   addRPMEntry some_silly_requirement


Attached is a hand grenade...enjoy...james
#
# Generate name:
NAME="dummy-provider-${RANDOM}"
while rpm -q "${NAME}" > /dev/null 2>&1
do
	NAME="dummy-provider-${RANDOM}"
done

#
# GEnerate Provides:
PROVIDES="Provides: ${1}"

#
# Generate Spec file
SPECFILE=$(mktemp)
cat <<EOF > ${SPECFILE}
#----------- spec file starts ---------------
Name:                   ${NAME}
Version:                1.0.0
Release:                1.0.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}"

_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/rpm-list

[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux