How to know system is currently installing ISO
I am creating an RPM. This RPM will be packed with the CentOS ISO and will install when CentOs is installed. This can also be installed using normal rpm installation method. But rpm installation need to behave differently if it is installed from ISO and installed by rpm normal installation method. So, the question is how do I know whether the开发者_StackOverflow中文版 system is currently installing the ISO.
Thanks in advance.
You could check if /dev/cdrom is mounted and if the /mnt/cdrom contains the installation disc in the %pre /%post scripts.
Strictly speaking, RPMs should be agnostic to how they are installed, so the chances are if you need this in the RPM it's probably a flawed design and what you are trying to do can be done in some other way.
I would suggest looking at anaconda / kickstart scripts.
Definitely a flawed design.
There should never be any user interaction with an RPM install which is what I bet you are trying to do.
If you are installing from a live OS, you can check the existence of /dev/live or liveimg in kernel command line,
i.e.
[[ $(grep -c liveimg /proc/cmdline) != 0 ]] || [ -b readlink -f /dev/live
]
精彩评论