Skip to content
Snippets Groups Projects
Commit 0696e888 authored by Thomas Bächler's avatar Thomas Bächler Committed by Gerardo Exequiel Pozzi
Browse files

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.
parent 5d75049c
No related branches found
No related tags found
No related merge requests found
#!/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
[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
......@@ -17,4 +17,4 @@ chmod 440 /etc/sudoers.d/g_wheel
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment