From 518316924aeaaf4fc77d818566ce7954d85c3fef Mon Sep 17 00:00:00 2001 From: jalr Date: Sat, 19 May 2018 18:36:59 +0200 Subject: [PATCH] Implement DNS for initramfs --- .gitlab-ci.yml | 4 ++-- packer/initramfs/labsync | 14 +++++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b6a2991..c685a20 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,8 +3,8 @@ image: docker:latest variables: GIT_STRATEGY: fetch PACKER_VERSION: 1.2.0 - ANNOUNCE: http://10.105.255.0:6969/announce - WEBSEED: http://10.105.255.0/labsync/$CI_COMMIT_REF_NAME/$CI_PIPELINE_ID/images + ANNOUNCE: http://labsync.lab.fablab-nea.de:6969/announce + WEBSEED: http://labsync.lab.fablab-nea.de/labsync/$CI_COMMIT_REF_NAME/$CI_PIPELINE_ID/images DOCKER_IMAGE: ${CI_REGISTRY_IMAGE}/labsync-builder stages: diff --git a/packer/initramfs/labsync b/packer/initramfs/labsync index 8d4102f..8d2ee35 100755 --- a/packer/initramfs/labsync +++ b/packer/initramfs/labsync @@ -75,9 +75,21 @@ labsync_premount() { if [ -z "$labsync_localboot" ]; then labsync_info "Configuring networking" configure_networking + labsync_configure_dns fi } +labsync_configure_dns() { + for c in /run/net-*.conf; do + ( + . "$c" + if ! [ -z "$IPV4DNS0" ]; then + echo "nameserver $IPV4DNS0" >> /etc/resolv.conf + fi + ) + done +} + labsync_mount_root() { export PATH="/usr/local/bin:$PATH" @@ -86,7 +98,7 @@ labsync_mount_root() { vg_name="vglab" if [ -z "$labsync_localboot" ]; then labsync_info "Downloading torrent file from ${labsync_torrent}" - while ! wget -T 10 -O /tmp/torrent "${labsync_torrent}"; do sleep 1; done + while ! aria2c -t 10 --follow-torrent=false --dir /tmp -o torrent "${labsync_torrent}"; do sleep 1; done aria2c -S /tmp/torrent > /tmp/torrent_info squashfs_file="$(sed -n '/idx|path\/length/,${s/\s*1|\(.*\)$/\1/p}' /tmp/torrent_info)" image_size_bytes="$(sed -n 's/Total Length: .*(\([0-9,]*\)).*$/\1/p' /tmp/torrent_info | tr -d ',')"