Question

What I'm trying to do is create an RPM that I will run after a fresh install of the OS. I want it to run a custom script I have created that currently copies over a bunch of things to the OS and configures different services and such, as well as installs a bunch of rpms. If this can be done, then all I will need is the single rpm file on my flash drive that contains everything inside (and all I would need to type is rpm -i xxx.rpm) instead of the whole mess of directories and files that I currently have (where I currently type install.sh). Can this be done?

Was it helpful?

Solution

Whenever you install a rpm, the %post-scriplet will get invoked after the successful installation. Thus if you call your script under the %post-install scriplet, it will get executed after every rpm installation.

OTHER TIPS

Yes. Put as much as you can in /etc's ".d" directories, so that after un-installation everything is restored. This also has the advantage that doing a "rpm -ql" will give you a good idea of what settings this RPM modifies.

For the settings that require editing config files, follow Ashok's advice and put customizations in the post-install section. Better yet, create two scripts that modify and revert the settings, install them somewhere appropriate (probably under /usr/share out of the path), and call them from the post-in and post-un sections respectively.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top