releng: Allow specifying a mirror on the kernel command line.

The new mirror= option takes a mirror URL and creates a new mirrorlist.
When setting mirror=auto, the mirror is taken from archiso_http_srv in
order to keep using the mirror selected in the netboot menu.
This commit is contained in:
Thomas Bächler 2013-06-16 11:27:58 +02:00 committed by Gerardo Exequiel Pozzi
parent 5d75049c11
commit 0696e88801
3 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,26 @@
#!/bin/bash
get_cmdline() {
local param
for param in $(< /proc/cmdline); do
case "${param}" in
$1=*) echo "${param##*=}";
return 0
;;
esac
done
}
mirror=$(get_cmdline mirror)
[[ $mirror = auto ]] && mirror=$(get_cmdline archiso_http_srv)
[[ $mirror ]] || exit 0
mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig
cat >/etc/pacman.d/mirrorlist << EOF
#
# Arch Linux repository mirrorlist
# Generated by archiso
#
Server = ${mirror%%/}/\$repo/os/\$arch
EOF

View File

@ -0,0 +1,10 @@
[Unit]
Description=Choose mirror from the kernel command line
ConditionKernelCommandLine=mirror
[Service]
Type=oneshot
ExecStart=/etc/systemd/scripts/choose-mirror
[Install]
WantedBy=multi-user.target

View File

@ -17,4 +17,4 @@ chmod 440 /etc/sudoers.d/g_wheel
sed -i "s/#Server/Server/g" /etc/pacman.d/mirrorlist sed -i "s/#Server/Server/g" /etc/pacman.d/mirrorlist
systemctl enable multi-user.target pacman-init.service systemctl enable multi-user.target pacman-init.service choose-mirror.service