Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 857813 Details for
Bug 901209
Add 'update' action to kernel module
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
0001-Add-update-action-to-kernel-module.patch
0001-Add-update-action-to-kernel-module.patch (text/plain), 3.73 KB, created by
Florian Schmaus
on 2023-03-15 09:59:54 UTC
(
hide
)
Description:
0001-Add-update-action-to-kernel-module.patch
Filename:
MIME Type:
Creator:
Florian Schmaus
Created:
2023-03-15 09:59:54 UTC
Size:
3.73 KB
patch
obsolete
>From e57301671fcf41ff7a8c05fbfcd8af48a4eeeba0 Mon Sep 17 00:00:00 2001 >From: Florian Schmaus <flow@gentoo.org> >Date: Tue, 14 Mar 2023 11:02:59 +0100 >Subject: [PATCH] Add 'update' action to kernel module >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >The 'update' action attempts to update the /usr/src/linux symlink to >point to the sources of the running kernel. > >Thanks to ulm for helpful suggestions when working on this >functionality. > >Signed-off-by: Florian Schmaus <flow@gentoo.org> >Thanks-to: Ulrich Müller <ulm@gentoo.org> >--- > man/kernel.eselect.5 | 10 ++++++ > modules/kernel.eselect | 75 ++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 85 insertions(+) > >diff --git a/man/kernel.eselect.5 b/man/kernel.eselect.5 >index b3c5aa5de606..66014912d14f 100644 >--- a/man/kernel.eselect.5 >+++ b/man/kernel.eselect.5 >@@ -14,6 +14,8 @@ kernel.eselect \- The kernel symlink management module for Gentoo's eselect > .I target > .br > .B eselect kernel show >+.br >+.B eselect kernel update [ifunset] > .SH DESCRIPTION > .B eselect > is Gentoo's configuration and management tool. It features modules >@@ -45,6 +47,14 @@ output). > .B eselect kernel show > .br > Show the currently selected kernel. >+.SH ACTION: UPDATE >+.B eselect kernel update [ifunset] >+.br >+Updates the /usr/src/linux symlink to point to the sources of the >+running kernel. If >+.IR ifunset >+is given, then the symlink will only be updated if it is not currently >+pointing to a valid kernel source tree. > .SH AUTHOR > Aaron Walker <ka0ttic@gentoo.org> > .SH SEE ALSO >diff --git a/modules/kernel.eselect b/modules/kernel.eselect >index 64b5e773d68d..b27628e7a817 100644 >--- a/modules/kernel.eselect >+++ b/modules/kernel.eselect >@@ -125,3 +125,78 @@ do_set() { > > set_symlink "$1" || die -q "Couldn't set a new symlink" > } >+ >+### update action ### >+ >+describe_update() { >+ echo "Update the kernel symlink to running kernel" >+} >+ >+describe_update_options() { >+ echo "ifunset: Do not override currently set version" >+} >+ >+do_update() { >+ [[ -z $1 || $1 == ifunset ]] || die -q "Usage error" >+ [[ $# -gt 1 ]] && die -q "Too many parameters" >+ test_for_root >+ >+ if [[ -e ${EROOT}/usr/src/linux && ]]; then >+ if [[ ! -L ${EROOT}/usr/src/linux ]]; then >+ # we have something strange >+ die -q "${EROOT}/usr/src/linux exists but is not a symlink" >+ fi >+ >+ if [[ $1 == ifunset ]]; then >+ # The /usr/src/linux symlink exists, points to a path that >+ # exists, and 'ifunset' is provided. Nothing to do. >+ return >+ fi >+ fi >+ >+ local targets=( $(find_targets) ) >+ if [[ ${#targets[@]} -eq 0 ]]; then >+ die -q "No target kernel-source trees found" >+ fi >+ >+ local running_kernel_release >+ running_kernel_release=$(uname -r) >+ if (( $? > 0 )); then >+ die -q "Executing uname failed with $?" >+ fi >+ local running_kernel_symlink_target="linux-${running_kernel_release}" >+ >+ if [[ -e ${EROOT}/usr/src/linux ]]; then >+ local current_target >+ current_target=$(basename "$(canonicalise "${EROOT}/usr/src/linux")") >+ if [[ ${current_target} == "${running_kernel_symlink_target}" ]]; then >+ # The /usr/src/linux symlink already points to the running >+ # kernel's sources. Nothing to do. >+ return >+ fi >+ fi >+ >+ local target >+ local target_list=() >+ for target in "${targets[@]}"; do >+ if [[ ${target} == "${running_kernel_symlink_target}" ]]; then >+ set_symlink "${target}" >+ return >+ fi >+ target_list+=("\n- ${target}") >+ done >+ >+ write_error_msg "No kernel sources for running kernel ${running_kernel_release} found." >+ if ! is_output_mode brief; then >+ do_list >&2 >+ fi >+ die -q "Could not update the kernel symlink" >+} >+ >+### helper functions ### >+ >+test_for_root() { >+ if [[ ! -w ${EROOT}/usr/src ]]; then >+ die -q "${EROOT}/usr/src not writeable by current user. Are you root?" >+ fi >+} >-- >2.39.2 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 901209
:
857651
|
857673
|
857685
|
857715
|
857717
|
857807
|
857809
|
857811
|
857813
|
857815