From: Vojtech Trefny <vtrefny(a)redhat.com>
Hide curl 404 errors when downloading .treeinfo/updates.img/product.img
and debug/inst.debug/rd.debug not specified by user.
Signed-off-by: Vojtech Trefny <vtrefny(a)redhat.com>
---
dracut/anaconda-lib.sh | 8 ++++++++
dracut/anaconda-netroot.sh | 10 +++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index f5f205a..e625609 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
@@ -191,6 +192,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 742ee98..e5b02a9 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"
@@ -65,17 +66,20 @@ case $repo in
http*|ftp*)
. /lib/url-lib.sh
info "anaconda fetching installer from $repo"
- treeinfo=$(fetch_url $repo/.treeinfo) && \
+ treeinfo=$(fetch_url $repo/.treeinfo 2> /tmp/treeinfo_err) && \
stage2=$(config_get stage2 mainimage < $treeinfo)
+ [ -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="images/install.img"
fi
if runtime=$(fetch_url $repo/$stage2) || runtime=$(fetch_url
$repo/LiveOS/squashfs.img); then
# NOTE: Should be the same as anaconda_auto_updates()
- updates=$(fetch_url $repo/images/updates.img)
+ updates=$(fetch_url $repo/images/updates.img 2> /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)
+ product=$(fetch_url $repo/images/product.img 2> /tmp/product_err)
+ [ -z "$product" ] && debug_msg $(cat /tmp/product_err)
[ -n "$product" ] && unpack_updates_img $product /updates
anaconda_mount_sysroot $runtime
else
--
To view this commit on github, visit
https://github.com/rhinstaller/anaconda/commit/ace2b999b452c8d45e238b528a...