[rhel7-branch 1/5] anaconda-lib.sh: add tell_user() and dev_is_cdrom()
wgwoods
installerbot-noreply at redhat.com
Wed Jul 22 21:56:56 UTC 2015
From: Will Woods <wwoods at redhat.com>
Add a couple of utility functions:
* tell_user() sends a message to the log and the screen via plymouth; if
plymouth isn't running we send it to the console instead.
* dev_is_cdrom() tells you whether the given device is a CDROM
(according to udev).
Related: rhbz#1122104
(cherry picked from commit abfa908d089d18ce8d72ac818b62b33a1a12647a)
---
dracut/anaconda-lib.sh | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index 9e74e3d..7a46058 100755
--- a/dracut/anaconda-lib.sh
+++ b/dracut/anaconda-lib.sh
@@ -165,6 +165,26 @@ when_any_cdrom_appears() {
>> $rulesfile
}
+plymouth_running() {
+ type plymouth >/dev/null 2>&1 && plymouth --ping 2>/dev/null
+}
+
+# print something to the display (and put it in the log so we know what's up)
+tell_user() {
+ if plymouth_running; then
+ # NOTE: if we're doing graphical splash but we don't have all the
+ # font-rendering libraries, no message will appear.
+ plymouth display-message --text="$*"
+ echo "$*" # this goes to journal only
+ else
+ echo "$*" >&2 # this goes to journal+console
+ fi
+}
+
+dev_is_cdrom() {
+ udevadm info --query=property --name=$1 | grep -q 'ID_CDROM=1'
+}
+
# dracut doesn't bring up the network unless:
# a) $netroot is set (i.e. you have a network root device), or
# b) /tmp/net.ifaces exists.
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/3fda43fa9f9ff5af1b0154b1c8cb0ea602f63f67
More information about the anaconda-patches
mailing list