summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2014-08-05 14:53:19 (EDT)
committer P. J. McDermott <pj@pehjota.net>2014-08-05 14:53:19 (EDT)
commit30e5050c234f1b8ecefc91a9cae37cb21c79c299 (patch)
tree8425dcabb39657e7279ee6902e9d02a050490e57
parent5889d6abc223303766077ac5c75257b16b7adcb1 (diff)
installers/pc: Save mirror address to /etc/hosts
If the user gives a network interface a static configuration, /etc/resolv.conf may be overwritten with values invalid for the current network.
-rwxr-xr-xinstallers/pc.sh5
1 files changed, 5 insertions, 0 deletions
diff --git a/installers/pc.sh b/installers/pc.sh
index 39e1e94..5729743 100755
--- a/installers/pc.sh
+++ b/installers/pc.sh
@@ -60,8 +60,13 @@ main()
"${0%installers/pc.sh}./miniprokit.sh" install \
-a "${host_arch}" -P "${host_plat}" \
${mirror:+-m} ${mirror} "${mountpoint}"
+ mirror="$(printf '%s\n' "${mirror}" | \
+ sed 's|^.*://||; s|^.*@||; s|/.*$||g;')"
+ printf '%s %s\n' "$(nslookup "${mirror}" | sed -n 's/Address: //p' | \
+ head -n 1)" "${mirror}" >"${mountpoint}/etc/hosts"
"${0%installers/pc.sh}./miniprokit.sh" shell "${mountpoint}" \
<"${0%pc.sh}data/pc.sh"
+ rm "${mountpoint}/etc/hosts"
umount_fs "${mountpoint}"
}