全新安装操作系统后是否可以构建用于系统配置的 RPM?

发布于 2024-12-15 22:59:04 字数 204 浏览 6 评论 0原文

我想做的是创建一个 RPM,我将在全新安装操作系统后运行它。我希望它运行我创建的自定义脚本,该脚本当前将一堆东西复制到操作系统并配置不同的服务等,以及安装一堆 rpm。如果可以做到这一点,那么我所需要的只是闪存驱动器上包含所有内容的单个 rpm 文件(我需要输入的只是 rpm -i xxx.rpm),而不是那些乱七八糟的目录和文件。我目前有(我当前输入 install.sh)。这可以做到吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

嘿哥们儿 2024-12-22 22:59:04

每当您安装 rpm 时,成功安装后都会调用 %post-scriplet。因此,如果您在 %post-install scriplet 下调用脚本,它将在每次 rpm 安装后执行。

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.

泛泛之交 2024-12-22 22:59:04

是的。尽可能多地放入 /etc 的“.d”目录中,以便卸载后一切都会恢复。这还有一个优点,即执行“rpm -ql”将使您很好地了解此 RPM 修改了哪些设置。

对于需要编辑配置文件的设置,请遵循 Ashok 的建议,并将自定义内容放在安装后部分中。更好的是,创建两个脚本来修改和恢复设置,将它们安装在适当的位置(可能在路径外的 /usr/share 下),并分别从 post-in 和 post-un 部分调用它们。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文