[rhel7-branch 1/1] Fix hiding curl 404 errors outside debug mode
vojtechtrefny
installerbot-noreply at redhat.com
Wed Sep 2 12:51:16 UTC 2015
From: Vojtech Trefny <vtrefny at redhat.com>
Hide curl 404 errors when downloading .treeinfo/updates.img/product.img
and debug/inst.debug/rd.debug not specified by user.
Resolves: rhbz#1182776
Signed-off-by: Vojtech Trefny <vtrefny at redhat.com>
---
dracut/anaconda-lib.sh | 8 ++++++++
dracut/anaconda-netroot.sh | 7 ++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index 7a46058..ca79476 100755
--- a/dracut/anaconda-lib.sh
+++ b/dracut/anaconda-lib.sh
@@ -1,6 +1,7 @@
#!/bin/bash
command -v unpack_img >/dev/null || . /lib/img-lib.sh
+command -v getarg >/dev/null || . /lib/dracut-lib.sh
# config_get SECTION KEY < FILE
# read an .ini-style config file, find the KEY in the given SECTION, and return
@@ -181,6 +182,13 @@ tell_user() {
fi
}
+# print something only in if debug/inst.debug/rd.debug
+debug_msg() {
+ if getargbool 0 rd.debug || getargbool 0 debug || getargbool 0 inst.debug; then
+ echo $* >&2
+ fi
+}
+
dev_is_cdrom() {
udevadm info --query=property --name=$1 | grep -q 'ID_CDROM=1'
}
diff --git a/dracut/anaconda-netroot.sh b/dracut/anaconda-netroot.sh
index a438500..101ba15 100755
--- a/dracut/anaconda-netroot.sh
+++ b/dracut/anaconda-netroot.sh
@@ -3,6 +3,7 @@
# runs in the "online" hook, every time an interface comes online.
command -v getarg >/dev/null || . /lib/dracut-lib.sh
+. /lib/anaconda-lib.sh
# initqueue/online hook passes interface name as $1
netif="$1"
@@ -73,7 +74,7 @@ case $repo in
info "anaconda fetching installer from $repo"
treeinfo=$(fetch_url $repo/.treeinfo 2> /tmp/treeinfo_err) && \
stage2=$(config_get stage2 mainimage < $treeinfo)
- [ -z "$treeinfo" ] && info $(cat /tmp/treeinfo_err)
+ [ -z "$treeinfo" ] && debug_msg $(cat /tmp/treeinfo_err)
if [ -z "$treeinfo" -o -z "$stage2" ]; then
warn "can't find installer mainimage path in .treeinfo"
stage2="LiveOS/squashfs.img"
@@ -81,10 +82,10 @@ case $repo in
if runtime=$(fetch_url $repo/$stage2); then
# NOTE: Should be the same as anaconda_auto_updates()
updates=$(fetch_url $repo/images/updates.img 2> /tmp/updates_err)
- [ -z "$updates" ] && info $(cat /tmp/updates_err)
+ [ -z "$updates" ] && debug_msg $(cat /tmp/updates_err)
[ -n "$updates" ] && unpack_updates_img $updates /updates
product=$(fetch_url $repo/images/product.img 2> /tmp/product_err)
- [ -z "$product" ] && info $(cat /tmp/product_err)
+ [ -z "$product" ] && debug_msg $(cat /tmp/product_err)
[ -n "$product" ] && unpack_updates_img $product /updates
/sbin/dmsquash-live-root $runtime
fi
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/a4787a1a2a67e7b5c7633ec55a754abbfb4d7dfe
More information about the anaconda-patches
mailing list