开发者

How to cancel a rpm installation

We are 开发者_运维技巧developing an application in python, and we are using RPM to install it. But sometimes, an error can happen during installation, and I can detect it. The question is, is there any way to cancel an installation if something is wrong? I tried to execute a "rpm -e package_name" command, but it's imposible because the system doesn't allow to run two RPM in parallel, so RPM is waiting my code to finish, and my code is waiting to first RPM to launch its own "rpm -e"

Thanks a lot in advance!!


Preferred approach is to separate installation of the package itself and initialization of the package data/settings. Let RPM handle installation of package files. RPM itself will handle file conflicts and similar things. Just specify requirements (Requires:) properly.

Then you can require a initial setup by the administrator before the application can be used. This is quite common approach with databases and similar applications.

However from your comment in other answer I am guessing your application is doing one ugly thing and that is: it is modifying files installed by RPM. That is not acceptable. You should always separate:

  • code and shared data (icons, etc)
  • runtime files (temporary files, cache, user-generated data)

Code and shared data is read-only for the application. It can be touched only by installer (be it rpm or some other package manager). Runtime files (usually found in /var/lib or somewhere in $HOME) can be changed at will and application should handle updates between versions as best it can of course. Packages should be designed so that:

  • rpm handles code and shared data installation/uninstallation
  • application handles runtime files updates and cleanup

In other words: rpm should not touch runtime files and application should not try to touch rpm-controlled files.

For example databases require administrators to dump databases before update, then restore them after new database is installed (new database can have different internal format of storing data). This is the last approach when no automatic conversion can take place.


Do not attempt to abort installation of a rpm package. Either fail to start installing, or notify the user of the error when they attempt to run the software.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜