0

I am trying to install an rpm package using the command as under:

rpm -Uvh --root=/mnt/bank_a rpm/app_name.rpm --nodeps

It is an application package which is part of root filesystem installation for a mounted device under linux hence the root flag is essential to specify the install path.

--prefix can not be used since it is a non relocatable package. The nodeps flag is used to suppress the error below(sh exists as a soft link to bash under /bin folder ):

Failed dependencies: /bin/sh is needed by xxx

But the pre scriplet fails for me with below error

error: %pre(app_name.rpm) scriptlet failed, exit status 255 error: install: %pre scriptlet failed (2), skipping app_name.rpm

I do not understand why --root and --nodeps won't work together or what is the right thing to do here.

Mukul Mehra
  • 91
  • 1
  • 9

2 Answers2

1

The right thing to do at this point is not use RPM. By messing with the root, and then saying "I don't care about dependencies," you're in no man's land. The scripts are trying to do things they cannot, and you're not providing enough information to actually tell you what's wrong.

The easiest solution is to go to a temporary directory and runrpm2cpio your.rpm | cpio -div and then copy the resulting file tree where it needs to be installed.

So I'm not accused of not answering the actual question, you can do --noscripts, but then you'll be here tomorrow asking why the program didn't work when you didn't use the support infrastructure that is RPMs to get it done in the first place.

Aaron D. Marasco
  • 6,506
  • 3
  • 26
  • 39
  • Well the thing is, the rpm installation works fine if the --nodeps flag is used alone and if the root flag is not used. Since the rootfs is under my control, I have pretty much checked out and ensured that the dependencies of package are there on the target before the user space would trigger the application. However, I have not been able to make it work for a mounted partition. And for that I need to know how to use the --root option with nodeps. The script is creating a group and user in the %pre section and removing some files in the %post section – Mukul Mehra Jul 13 '20 at 21:34
  • Another possible way is to run `rpm` from the target root filesystem, for example, via `chroot`. That's how I did a lot of times when working with RPM-based distributions. – 0andriy Jul 20 '20 at 18:47
  • `chroot` requires a lot more built up around it (_e.g._ glibc and your shell). – Aaron D. Marasco Jul 20 '20 at 22:23
0

You can use rpm -ivh abc.rpm --nodeps --force