Commit 8a4b17cf authored by Kristian Klausen's avatar Kristian Klausen 🎉 Committed by Christian Rebischke
Browse files

Support specifying a mirror

Note: The mirror is only used under the bootstrapping process, the
image contains the default mirrorlist with every server uncommented.

Fix #87
parent 18c6ed16
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
"cpus": "2", "cpus": "2",
"headless": "true", "headless": "true",
"write_zeroes": "", "write_zeroes": "",
"boot_wait": "60s" "boot_wait": "60s",
"mirror": ""
}, },
"builders": [ "builders": [
{ {
...@@ -40,7 +41,7 @@ ...@@ -40,7 +41,7 @@
"boot_command": [ "boot_command": [
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>", "<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
"curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-cloud}.sh'<enter><wait>", "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-cloud}.sh'<enter><wait>",
"bash install.sh < <(cat install-{cloud,common}.sh) && systemctl reboot<enter>" "MIRROR='{{user `mirror`}}' bash install.sh < <(cat install-{cloud,common}.sh) && systemctl reboot<enter>"
] ]
} }
], ],
......
...@@ -25,9 +25,13 @@ mkswap "${device}1" ...@@ -25,9 +25,13 @@ mkswap "${device}1"
mkfs.ext4 -L "rootfs" "${device}2" mkfs.ext4 -L "rootfs" "${device}2"
mount "${device}2" /mnt mount "${device}2" /mnt
pacstrap /mnt base linux grub openssh sudo polkit haveged netctl python reflector if [ -n "${MIRROR}" ]; then
echo "Server = ${MIRROR}" >/etc/pacman.d/mirrorlist
fi
pacstrap -M /mnt base linux grub openssh sudo polkit haveged netctl python reflector
swapon "${device}1" swapon "${device}1"
genfstab -p /mnt >>/mnt/etc/fstab genfstab -p /mnt >>/mnt/etc/fstab
swapoff "${device}1" swapoff "${device}1"
arch-chroot /mnt /usr/bin/sed -i 's/^#Server/Server/' /etc/pacman.d/mirrorlist
arch-chroot /mnt /bin/bash arch-chroot /mnt /bin/bash
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
"cpus": "2", "cpus": "2",
"headless": "true", "headless": "true",
"write_zeroes": "", "write_zeroes": "",
"boot_wait": "60s" "boot_wait": "60s",
"mirror": ""
}, },
"builders": [ "builders": [
{ {
...@@ -45,7 +46,7 @@ ...@@ -45,7 +46,7 @@
"boot_command": [ "boot_command": [
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>", "<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
"curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>", "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>",
"bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>" "MIRROR='{{user `mirror`}}' bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>"
] ]
}, { }, {
"type": "qemu", "type": "qemu",
...@@ -74,7 +75,7 @@ ...@@ -74,7 +75,7 @@
"boot_command": [ "boot_command": [
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>", "<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
"curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>", "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>",
"bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>" "MIRROR='{{user `mirror`}}' bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>"
] ]
}, { }, {
"type": "vmware-iso", "type": "vmware-iso",
...@@ -95,7 +96,7 @@ ...@@ -95,7 +96,7 @@
"boot_command": [ "boot_command": [
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>", "<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
"curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>", "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>",
"bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>" "MIRROR='{{user `mirror`}}' bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>"
] ]
} }
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
"headless": "true", "headless": "true",
"vagrant_cloud_token": "PLACEHOLDER", "vagrant_cloud_token": "PLACEHOLDER",
"write_zeroes": "", "write_zeroes": "",
"boot_wait": "60s" "boot_wait": "60s",
"mirror": ""
}, },
"builders": [ "builders": [
{ {
...@@ -45,7 +46,7 @@ ...@@ -45,7 +46,7 @@
"boot_command": [ "boot_command": [
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>", "<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
"curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>", "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>",
"bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>" "MIRROR='{{user `mirror`}}' bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>"
] ]
}, { }, {
"type": "qemu", "type": "qemu",
...@@ -74,7 +75,7 @@ ...@@ -74,7 +75,7 @@
"boot_command": [ "boot_command": [
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>", "<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
"curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>", "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>",
"bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>" "MIRROR='{{user `mirror`}}' bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>"
] ]
}, { }, {
"type": "vmware-iso", "type": "vmware-iso",
...@@ -95,7 +96,7 @@ ...@@ -95,7 +96,7 @@
"boot_command": [ "boot_command": [
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>", "<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
"curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>", "curl -O 'http://{{.HTTPIP}}:{{.HTTPPort}}/install{,-common,-chroot}.sh'<enter><wait>",
"bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>" "MIRROR='{{user `mirror`}}' bash install.sh < <(cat install-{chroot,common}.sh) && systemctl reboot<enter>"
] ]
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment