From: Redjard <gentoo-dev@redjard.org>
To: gentoo-dev@lists.gentoo.org
Subject: Re: [gentoo-dev] Add Hooks to Eselect
Date: Mon, 21 Aug 2023 11:05:28 +0200 [thread overview]
Message-ID: <081c5bdd-7d38-6315-94eb-9c52226c96e4@redjard.org> (raw)
In-Reply-To: <04f4b7346cfb64e09c609a1c7913366d6441cf9b.camel@gentoo.org>
On 2023-08-19 06:58:10, Michał Górny wrote:
> You have to provide the rationale here. You can't expect people to sign
> up for some shady third-party service to read it.
My bad, not much of value is locked in the proprietary service but I
should have stated as such.
To roughly summarize, I was asking for a method to hook into eselect, to
modify the behavior of eselect kernel set.
I was pointed in the direction of a user patch by konsolebox, and
consequently wrote the patch.
I provided an example for using the patched hooks, which I will repeat
below.
>>> /etc/eselect/hooks/kernel/set/pre:
if [ "$EUID" -ne 0 ]; then die "run as root please"; fi
local -n target=params
if [ -z "$target" ]; then
target=`ls -1v /usr/src/ | grep '^linux-.*-gentoo$' | tail -n1`
else
if [ `echo "$target" | grep -P "^\d+(\.\d+){2}$"` ]; then
target=linux-"$1"-gentoo
elif [ `echo "${target%/}" | grep -P
"^linux-\d+(\.\d+){2}-gentoo$"` ]; then
target="${target%/}"
fi
fi
if [ "$target" == `basename "$(readlink /usr/src/linux)"` ]; then
die "kernel $target already selected"
fi
cp /usr/src/linux/.config /tmp/redjard_linux_kernel_eselect_config
echo "selecting kernel $target"
>>> /etc/eselect/hooks/kernel/set/post:
# (re)generate /etc/portage/sets/active_kernels which selects the
active, the installed, and the selected kernel
/opt/startup/lock-active-kernel-versions
# stop if .config is already present,
if [[ -e /usr/src/linux/.config ]];then
die "Warning: .config already exists. Stopping post hook
execution, you're on your own"
fi
echo "migrating .config"
mv -n /tmp/redjard_linux_kernel_eselect_config /usr/src/linux/.config
oldfile=`sha512sum /usr/src/linux/.config`
#echo "use make oldconfig to migrate the kernel configuration"
echo "running make oldconfig to migrate .config"
(cd /usr/src/linux && make oldconfig)
if [[ "$oldfile" != `sha512sum /usr/src/linux/.config` ]]; then
/opt/kernel/backup_config
fi
echo "use kernel-configure to edit the kernel configuration"
echo "use kernel-make or kernel-install to build and install the
configured kernel"
next prev parent reply other threads:[~2023-08-21 9:05 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <840371d1-21b3-f71b-03e0-0ef5b5ca2059@julianahl.de>
2023-08-18 19:38 ` [gentoo-dev] Add Hooks to Eselect Redjard
2023-08-19 4:58 ` Michał Górny
2023-08-21 9:05 ` Redjard [this message]
2023-08-21 10:00 ` Ulrich Mueller
2023-08-21 11:20 ` Redjard
2023-08-21 12:08 ` Ulrich Mueller
2023-08-21 18:07 ` konsolebox
2023-08-21 18:50 ` Ulrich Mueller
2023-08-22 0:26 ` Redjard
2023-08-22 2:36 ` konsolebox
2023-08-21 0:15 ` [gentoo-dev] " Duncan
2023-08-21 17:50 ` konsolebox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=081c5bdd-7d38-6315-94eb-9c52226c96e4@redjard.org \
--to=gentoo-dev@redjard.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox