summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Klausen <kristian@klausen.dk>2020-02-26 14:08:00 +0100
committerChristian Rebischke <chris@shibumi.dev>2020-03-01 01:07:20 +0100
commit8a4b17cf5fcdc2a549eaafc820e6f0497d0a9d7a (patch)
treecca48aed10fed1bdfc63354fbbc634ef92692edb
parent18c6ed167084723c423a19eaed5bef130262c03c (diff)
Support specifying a mirror1.5.0
Note: The mirror is only used under the bootstrapping process, the image contains the default mirrorlist with every server uncommented. Fix #87
-rw-r--r--cloud.json5
-rw-r--r--http/install.sh6
-rw-r--r--local.json9
-rw-r--r--vagrant.json9
4 files changed, 18 insertions, 11 deletions
diff --git a/cloud.json b/cloud.json
index 92794be..0871957 100644
--- a/cloud.json
+++ b/cloud.json
@@ -8,7 +8,8 @@
"cpus": "2",
"headless": "true",
"write_zeroes": "",
- "boot_wait": "60s"
+ "boot_wait": "60s",
+ "mirror": ""
},
"builders": [
{
@@ -40,7 +41,7 @@
"boot_command": [
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
"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>"
]
}
],
diff --git a/http/install.sh b/http/install.sh
index e22be6c..84678db 100644
--- a/http/install.sh
+++ b/http/install.sh
@@ -25,9 +25,13 @@ mkswap "${device}1"
mkfs.ext4 -L "rootfs" "${device}2"
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"
genfstab -p /mnt >>/mnt/etc/fstab
swapoff "${device}1"
+arch-chroot /mnt /usr/bin/sed -i 's/^#Server/Server/' /etc/pacman.d/mirrorlist
arch-chroot /mnt /bin/bash
diff --git a/local.json b/local.json
index b0d5677..1b147d7 100644
--- a/local.json
+++ b/local.json
@@ -9,7 +9,8 @@
"cpus": "2",
"headless": "true",
"write_zeroes": "",
- "boot_wait": "60s"
+ "boot_wait": "60s",
+ "mirror": ""
},
"builders": [
{
@@ -45,7 +46,7 @@
"boot_command": [
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
"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",
@@ -74,7 +75,7 @@
"boot_command": [
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
"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",
@@ -95,7 +96,7 @@
"boot_command": [
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
"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>"
]
}
diff --git a/vagrant.json b/vagrant.json
index 30645de..b19a20d 100644
--- a/vagrant.json
+++ b/vagrant.json
@@ -9,7 +9,8 @@
"headless": "true",
"vagrant_cloud_token": "PLACEHOLDER",
"write_zeroes": "",
- "boot_wait": "60s"
+ "boot_wait": "60s",
+ "mirror": ""
},
"builders": [
{
@@ -45,7 +46,7 @@
"boot_command": [
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
"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",
@@ -74,7 +75,7 @@
"boot_command": [
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
"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",
@@ -95,7 +96,7 @@
"boot_command": [
"<enter><wait10><wait10><wait10><wait10><wait10><enter><enter>",
"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>"
]
}