Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
364227e5
Commit
364227e5
authored
Jul 25, 2024
by
Boris Yumankulov
Committed by
Vitaly Lipatov
Nov 09, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm update-kernel: add arguments to manage kernel parametrs (eterbug #17553)
parent
03937864
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
0 deletions
+77
-0
epm-kernel_update
bin/epm-kernel_update
+77
-0
No files found.
bin/epm-kernel_update
View file @
364227e5
...
...
@@ -20,8 +20,49 @@
load_helper epm-check_updated_repo
load_helper epm-sh-warmup
EFI
=
$(
bootctl
-p
2>/dev/null
)
sdboot_loader_id
=
$(
bootctl status 2>/dev/null |
grep
-oP
'(?<=id: ).*'
)
if
[
-f
"
$EFI
/loader/entries/
$sdboot_loader_id
"
]
;
then
entry_file
=
"
$EFI
/loader/entries/
$sdboot_loader_id
"
options
=
"options"
bootloader
=
"systemd"
elif
[
-f
"/etc/sysconfig/grub2"
]
;
then
entry_file
=
"/etc/sysconfig/grub2"
options
=
"GRUB_CMDLINE_LINUX_DEFAULT="
bootloader
=
"grub"
elif
[
-f
"/etc/default/grub"
]
;
then
entry_file
=
"/etc/default/grub"
options
=
"GRUB_CMDLINE_LINUX_DEFAULT="
bootloader
=
"grub"
elif
[
-f
"
$EFI
/refind_linux.conf"
]
;
then
entry_file
=
"
$EFI
/refind_linux.conf"
options
=
"Boot with standard options"
bootloader
=
"refind"
fi
epm_kernel_update
()
{
case
$1
in
'--list-kernel-options'
)
assure_root
kernel_options_list
return
;;
'--add-kernel-options'
)
assure_root
shift
kernel_options_add
"
$@
"
return
;;
'--remove-kernel-options'
)
assure_root
shift
kernel_options_remove
"
$@
"
return
;;
esac
warmup_bases
update_repo_if_needed
...
...
@@ -53,3 +94,39 @@ epm_kernel_update()
;;
esac
}
kernel_options_list
()
{
if
[
"
$bootloader
"
=
"refind"
]
;
then
grep
"^
\"
$options
\"
"
"
$entry_file
"
|
sed
's/^\"'
"
$options
"
'" //'
|
sed
's/\s*$//'
|
tr
' '
'\n'
else
grep
"^
$options
"
"
$entry_file
"
|
sed
's/^"'
$options
'" //'
|
sed
's/\s*$//'
|
tr
' '
'\n'
fi
}
kernel_options_add
()
{
for
search_string
in
"
$@
"
;
do
if
grep
-qF
"
$search_string
"
"
$entry_file
"
;
then
echo
"The string '
$search_string
' is already present in
$entry_file
"
else
echo
"The string '
$search_string
' is not present in
$entry_file
"
echo
"Updating
$entry_file
"
if
[
$bootloader
=
"systemd"
]
;
then
sed
-i
"/^
$options
/ s~
\$
~
$search_string
~"
"
$entry_file
"
else
sed
-i
"s|^
\(
$options
'.*
\)
'
\$
|
\1
$search_string
'|"
"
$entry_file
"
fi
echo
"Added '
$search_string
' to the kernel boot parameters in
$entry_file
"
fi
done
}
kernel_options_remove
()
{
for
remove_string
in
"
$@
"
;
do
if
grep
-qF
"
$remove_string
"
"
$entry_file
"
;
then
sed
-i
"s~
$remove_string
~~"
"
$entry_file
"
echo
"Removed '
$remove_string
' from the kernel parameters in
$entry_file
"
else
echo
"The string '
$remove_string
' is not present in
$entry_file
"
fi
done
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment