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?
2 Answers
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.

- 1,862
- 1
- 15
- 21
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.

- 2,968
- 4
- 28
- 37