]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Ubuntu fixes at kvmx-create
authorSilvio Rhatto <rhatto@riseup.net>
Tue, 27 Oct 2020 18:22:11 +0000 (15:22 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Tue, 27 Oct 2020 18:22:11 +0000 (15:22 -0300)
kvmx-create

index ba25147f972c7e349f27c1436c4ae065985c2cd0..7137060fabf208b0dac6dfd2d90c0d56fa395fc5 100755 (executable)
@@ -180,7 +180,7 @@ function kvmx_create_custom {
   host_distro="`head -n 1 /etc/issue | cut -d ' ' -f 1 | tr '[:upper:]' '[:lower:]'`"
 
   # Determine distro and kernel package name
-  if echo $mirror | grep 'ubuntu'; then
+  if echo $mirror | grep -q 'ubuntu'; then
     distro="ubuntu"
     kernel_package="linux-image-generic"
 
@@ -246,6 +246,18 @@ function kvmx_create_custom {
   tac $WORK/etc/hosts | $SUDO tee $WORK/etc/hosts.new > /dev/null
   kvmx_sudo_run mv $WORK/etc/hosts.new $WORK/etc/hosts
 
+  # Ubuntu needs this fix so we can continue
+  if [ "$distro" == "ubuntu" ]; then
+    # Points to ../run/systemd/resolve/stub-resolv.conf
+    kvmx_sudo_run rm $WORK/etc/resolv.conf
+
+    # Temporary resolver: OpenNIC
+    cat <<-EOF | $SUDO tee $WORK/etc/resolv.conf > /dev/null
+nameserver 45.71.185.100
+nameserver 172.98.193.42
+EOF
+  fi
+
   # Fstab
   echo "/dev/vda2 / ext4 errors=remount-ro 0 1" | $SUDO tee $WORK/etc/fstab > /dev/null
 
@@ -326,6 +338,11 @@ EOF
   kvmx_sudo_run umount $WORK/dev/pts
   kvmx_sudo_run umount $WORK/dev
 
+  # Give some time to Ubuntu
+  if [ "$distro" == "ubuntu" ]; then
+    sleep 10
+  fi
+
   # Run basic provision
   __kvmx_create_custom_second_stage