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:
parent
5d75049c11
commit
0696e88801
26
configs/releng/root-image/etc/systemd/scripts/choose-mirror
Executable file
26
configs/releng/root-image/etc/systemd/scripts/choose-mirror
Executable 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
|
@ -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
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user