diff options
author | David P <megver83@parabola.nu> | 2020-08-26 16:18:05 -0400 |
---|---|---|
committer | David P <megver83@parabola.nu> | 2020-08-26 16:27:37 -0400 |
commit | 0d5c488921e1911a5ebaf5d1a9ac3eeb1e72b188 (patch) | |
tree | f9c52ed87dec3e5a2b61bac3178d3a989ce31d84 /configs | |
parent | ebbfe24e975da3783b85ab3f2e4a4c8227a3b9ea (diff) |
[openrc] airootfs: add/modify scripts to emulate its systemd counterparts, better than beforev47.1
New:
* add choose-mirror to openrc profiles
* add choose-mirror.start and etc-pacman.d-gnupg.start to openrc profiles
* enable haveged in openrc profiles
Fixed:
* read the kernel cmdline in reflector NM dispatcher script and pacman-init.start
* talkingparabola: a little improvement in .zlogin, discovered by shellcheck
* Makefile: add talkingparabola's choose-mirror to the shellcheck'ed files
Signed-off-by: David P <megver83@parabola.nu>
Diffstat (limited to 'configs')
13 files changed, 107 insertions, 7 deletions
diff --git a/configs/lxde-openrc/airootfs/etc/NetworkManager/dispatcher.d/reflector b/configs/lxde-openrc/airootfs/etc/NetworkManager/dispatcher.d/reflector index a186bbf..17ba099 100755 --- a/configs/lxde-openrc/airootfs/etc/NetworkManager/dispatcher.d/reflector +++ b/configs/lxde-openrc/airootfs/etc/NetworkManager/dispatcher.d/reflector @@ -2,6 +2,9 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -if [ "$2" = up ]; then - /usr/bin/reflector --protocol https --age 1 --sort rate --save /etc/pacman.d/mirrorlist +if [ "$2" == up ] && ! grep -qoP 'mirror=\K\S+' /proc/cmdline; then + # shellcheck disable=SC2034 + XDG_CACHE_HOME=/var/cache/reflector + umask 177 + /usr/bin/reflector --protocol https --latest 15 --sort rate --save /etc/pacman.d/mirrorlist fi diff --git a/configs/lxde-openrc/airootfs/etc/local.d/choose-mirror.start b/configs/lxde-openrc/airootfs/etc/local.d/choose-mirror.start new file mode 100755 index 0000000..fea21b8 --- /dev/null +++ b/configs/lxde-openrc/airootfs/etc/local.d/choose-mirror.start @@ -0,0 +1,6 @@ +#!/bin/bash +# +# SPDX-License-Identifier: GPL-3.0-or-later + +# Choose mirror from the kernel command line +grep -qoP 'mirror=\K\S+' /proc/cmdline && /usr/local/bin/choose-mirror diff --git a/configs/lxde-openrc/airootfs/etc/local.d/etc-pacman.d-gnupg.start b/configs/lxde-openrc/airootfs/etc/local.d/etc-pacman.d-gnupg.start new file mode 100755 index 0000000..f705ece --- /dev/null +++ b/configs/lxde-openrc/airootfs/etc/local.d/etc-pacman.d-gnupg.start @@ -0,0 +1,11 @@ +#!/bin/bash +# +# SPDX-License-Identifier: GPL-3.0-or-later + +# Temporary /etc/pacman.d/gnupg directory +fstype="$(findmnt /etc/pacman.d/gnupg -o FSTYPE -Un)" + +test -d /etc/pacman.d/gnupg || mkdir /etc/pacman.d/gnupg +if ! [[ "$fstype" == tmpfs ]]; then + mount -o mode=0755 -t tmpfs tmpfs /etc/pacman.d/gnupg +fi diff --git a/configs/lxde-openrc/airootfs/etc/local.d/pacman-init.start b/configs/lxde-openrc/airootfs/etc/local.d/pacman-init.start index b57d737..41c6166 100755 --- a/configs/lxde-openrc/airootfs/etc/local.d/pacman-init.start +++ b/configs/lxde-openrc/airootfs/etc/local.d/pacman-init.start @@ -2,7 +2,8 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -if ! [ -d /etc/pacman.d/gnupg ]; then +# Initializes Pacman keyring +if ! find /etc/pacman.d/gnupg -mindepth 1 2>/dev/null | read -r; then pacman-key --init pacman-key --populate archlinux archlinux32 parabola fi diff --git a/configs/lxde-openrc/airootfs/etc/runlevels/default/haveged b/configs/lxde-openrc/airootfs/etc/runlevels/default/haveged new file mode 120000 index 0000000..0ec5343 --- /dev/null +++ b/configs/lxde-openrc/airootfs/etc/runlevels/default/haveged @@ -0,0 +1 @@ +/etc/init.d/haveged
\ No newline at end of file diff --git a/configs/lxde-openrc/airootfs/usr/local/bin/choose-mirror b/configs/lxde-openrc/airootfs/usr/local/bin/choose-mirror new file mode 100755 index 0000000..e8f8254 --- /dev/null +++ b/configs/lxde-openrc/airootfs/usr/local/bin/choose-mirror @@ -0,0 +1,28 @@ +#!/bin/bash +# +# SPDX-License-Identifier: GPL-3.0-or-later + +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 parabolaiso_http_srv) +[[ $mirror ]] || exit 0 + +mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig +cat >/etc/pacman.d/mirrorlist << EOF +# +# Parabola GNU/Linux-libre repository mirrorlist +# Generated by parabolaiso +# + +Server = ${mirror%%/}/\$repo/os/\$arch +EOF diff --git a/configs/releng-openrc/airootfs/etc/NetworkManager/dispatcher.d/reflector b/configs/releng-openrc/airootfs/etc/NetworkManager/dispatcher.d/reflector index a186bbf..17ba099 100755 --- a/configs/releng-openrc/airootfs/etc/NetworkManager/dispatcher.d/reflector +++ b/configs/releng-openrc/airootfs/etc/NetworkManager/dispatcher.d/reflector @@ -2,6 +2,9 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -if [ "$2" = up ]; then - /usr/bin/reflector --protocol https --age 1 --sort rate --save /etc/pacman.d/mirrorlist +if [ "$2" == up ] && ! grep -qoP 'mirror=\K\S+' /proc/cmdline; then + # shellcheck disable=SC2034 + XDG_CACHE_HOME=/var/cache/reflector + umask 177 + /usr/bin/reflector --protocol https --latest 15 --sort rate --save /etc/pacman.d/mirrorlist fi diff --git a/configs/releng-openrc/airootfs/etc/local.d/choose-mirror.start b/configs/releng-openrc/airootfs/etc/local.d/choose-mirror.start new file mode 100755 index 0000000..fea21b8 --- /dev/null +++ b/configs/releng-openrc/airootfs/etc/local.d/choose-mirror.start @@ -0,0 +1,6 @@ +#!/bin/bash +# +# SPDX-License-Identifier: GPL-3.0-or-later + +# Choose mirror from the kernel command line +grep -qoP 'mirror=\K\S+' /proc/cmdline && /usr/local/bin/choose-mirror diff --git a/configs/releng-openrc/airootfs/etc/local.d/etc-pacman.d-gnupg.start b/configs/releng-openrc/airootfs/etc/local.d/etc-pacman.d-gnupg.start new file mode 100755 index 0000000..f705ece --- /dev/null +++ b/configs/releng-openrc/airootfs/etc/local.d/etc-pacman.d-gnupg.start @@ -0,0 +1,11 @@ +#!/bin/bash +# +# SPDX-License-Identifier: GPL-3.0-or-later + +# Temporary /etc/pacman.d/gnupg directory +fstype="$(findmnt /etc/pacman.d/gnupg -o FSTYPE -Un)" + +test -d /etc/pacman.d/gnupg || mkdir /etc/pacman.d/gnupg +if ! [[ "$fstype" == tmpfs ]]; then + mount -o mode=0755 -t tmpfs tmpfs /etc/pacman.d/gnupg +fi diff --git a/configs/releng-openrc/airootfs/etc/local.d/pacman-init.start b/configs/releng-openrc/airootfs/etc/local.d/pacman-init.start index b57d737..41c6166 100755 --- a/configs/releng-openrc/airootfs/etc/local.d/pacman-init.start +++ b/configs/releng-openrc/airootfs/etc/local.d/pacman-init.start @@ -2,7 +2,8 @@ # # SPDX-License-Identifier: GPL-3.0-or-later -if ! [ -d /etc/pacman.d/gnupg ]; then +# Initializes Pacman keyring +if ! find /etc/pacman.d/gnupg -mindepth 1 2>/dev/null | read -r; then pacman-key --init pacman-key --populate archlinux archlinux32 parabola fi diff --git a/configs/releng-openrc/airootfs/etc/runlevels/default/haveged b/configs/releng-openrc/airootfs/etc/runlevels/default/haveged new file mode 120000 index 0000000..0ec5343 --- /dev/null +++ b/configs/releng-openrc/airootfs/etc/runlevels/default/haveged @@ -0,0 +1 @@ +/etc/init.d/haveged
\ No newline at end of file diff --git a/configs/releng-openrc/airootfs/usr/local/bin/choose-mirror b/configs/releng-openrc/airootfs/usr/local/bin/choose-mirror new file mode 100755 index 0000000..e8f8254 --- /dev/null +++ b/configs/releng-openrc/airootfs/usr/local/bin/choose-mirror @@ -0,0 +1,28 @@ +#!/bin/bash +# +# SPDX-License-Identifier: GPL-3.0-or-later + +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 parabolaiso_http_srv) +[[ $mirror ]] || exit 0 + +mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig +cat >/etc/pacman.d/mirrorlist << EOF +# +# Parabola GNU/Linux-libre repository mirrorlist +# Generated by parabolaiso +# + +Server = ${mirror%%/}/\$repo/os/\$arch +EOF diff --git a/configs/talkingparabola/airootfs/root/.zlogin b/configs/talkingparabola/airootfs/root/.zlogin index 7666b6b..282398a 100644 --- a/configs/talkingparabola/airootfs/root/.zlogin +++ b/configs/talkingparabola/airootfs/root/.zlogin @@ -1,4 +1,4 @@ -if [ -n "$(grep -oP 'speakup.synth=\K\S+' /proc/cmdline)" ] +if grep -qoP 'speakup.synth=\K\S+' /proc/cmdline then setopt singlelinezle flock -n /run/talk-to-me.lck talk-to-me |