guest resolv.conf: put both host name servers and public ones
Etienne Dublé
1 year, 6 months ago
287 | 287 |
echo -n "I: draft image - generating fstab... "
|
288 | 288 |
generate_fstab "$layout_dir"
|
289 | 289 |
echo done
|
|
290 |
|
|
291 |
# copy host resolv.conf to help generating a proper one in guest
|
|
292 |
cp /etc/resolv.conf etc/resolv.conf.host
|
290 | 293 |
|
291 | 294 |
mkdir -p opt/debootstick
|
292 | 295 |
cp -a $DBSTCK_DIR/scripts/live opt/debootstick/live
|
34 | 34 |
resolv_conf_orig_status=$(ensure_valid_resolv_conf)
|
35 | 35 |
if [ "$resolv_conf_orig_status" != "ok" ]
|
36 | 36 |
then
|
37 | |
echo -n "I: draft image - generated /etc/resolv.conf (it was missing or incomplete)"
|
|
37 |
echo "I: draft image - generated /etc/resolv.conf (it was missing or incomplete)"
|
38 | 38 |
fi
|
39 | 39 |
|
40 | 40 |
if $target_custom_packages_exists
|
76 | 76 |
# if debootstick has to install one missing package including a DNS
|
77 | 77 |
# resolver (e.g. systemd). In any case this file is needed right
|
78 | 78 |
# know for the package downloading to succeed.
|
|
79 |
# We copy the name servers which were used on the host and also add
|
|
80 |
# a few public ones.
|
|
81 |
# The one on the host may be '127.0.0.1' (e.g. the host may be running
|
|
82 |
# a local service, e.g., for caching) which will work when the image
|
|
83 |
# is being built but not when the target image is booted.
|
|
84 |
# On the other hand the public nameservers may be unreachable because
|
|
85 |
# of firewalling.
|
|
86 |
# That's why we indicate all of them for more robustness.
|
79 | 87 |
cat > /etc/resolv.conf << EOF
|
|
88 |
# the following nameservers are those which were defined
|
|
89 |
# on the machine where debootstick was run
|
|
90 |
# ------------------------------------------------------
|
|
91 |
EOF
|
|
92 |
grep nameserver /etc/resolv.conf.host >> /etc/resolv.conf
|
|
93 |
rm /etc/resolv.conf.host
|
|
94 |
|
|
95 |
cat >> /etc/resolv.conf << EOF
|
|
96 |
|
|
97 |
# the following nameservers are public ones
|
|
98 |
# ------------------------------------------------------
|
80 | 99 |
# cloudflare
|
81 | 100 |
nameserver 1.1.1.1
|
82 | 101 |
# google
|