Merge branch 'dns4initramfs' into 'master'

Implement DNS for initramfs

See merge request fablab/labsync!24
This commit is contained in:
Simon Bruder 2018-05-19 17:30:22 +00:00
commit ef4326a32e
2 changed files with 15 additions and 3 deletions

View file

@ -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:

View file

@ -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 ',')"