SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
This is cool!
I suggest a patch to the lookkernel() function in the /usr/libexec/slackpkg/functions.d/post-functions.sh in slackpkg that will prompt a generic kernel user to update their initrd before the prompt to run lilo when the kernel is upgraded.
Code:
--- lookkernel 2017-10-14 01:58:41.754972512 +1100
+++ lookkernel.new 2017-10-14 02:02:00.990952059 +1100
@@ -1,6 +1,21 @@
lookkernel() {
NEWKERNELMD5=$(md5sum /boot/vmlinuz 2>/dev/null)
if [ "$KERNELMD5" != "$NEWKERNELMD5" ]; then
+ if $(readlink /boot/vmlinuz | grep -q generic); then
+ echo -e "\n
+Your kernel image was updated to a generic kernel. You need a new initrd."
+ NEWKERNELVERSION=$(readlink /boot/vmlinuz | sed 's/.*-\([1-9]\)/\1/')
+ if [ -d /lib/modules/$NEWKERNELVERSION ] && [ -f /boot/initrd-tree/command_line ]; then
+ MKINITRD_CMD=$(sed 's/-k *[^ ]\+/-k '$NEWKERNELVERSION'/' /boot/initrd-tree/command_line)
+ echo -e "\n
+$MKINITRD_CMD
+Do you want slackpkg to run the above command? (Y/n)"
+ answer
+ if [ "$ANSWER" != "n" ] && [ "$ANSWER" != "N" ]; then
+ $MKINITRD_CMD
+ fi
+ fi
+ fi
if [ -x /sbin/lilo ]; then
echo -e "\n
Your kernel image was updated. We highly recommend you run: lilo
Also, while slackpkg is getting some love, perhaps another patch to /usr/libexec/slackpkg/functions.d/post-functions.sh in slackpkg that will allow the use of vimdiff when handling .new files.
Code:
--- runvimdiff 2017-10-14 02:40:20.459715999 +1100
+++ runvimdiff.new 2017-10-14 02:34:44.424750496 +1100
@@ -1,3 +1,15 @@
+runvimdiff() {
+ BASENAME=$(basename $i .new)
+ FILEPATH=$(dirname $i)
+ FULLNAME="${FILEPATH}/${BASENAME}"
+
+ if [ -e ${FULLNAME} ]; then
+ vimdiff ${FULLNAME} ${FULLNAME}.new
+ else
+ echo "file $FULLNAME doesn't exist"
+ fi
+}
+
looknew() {
# with ONLY_NEW_DOTNEW set, slackpkg will search only for
@@ -53,7 +65,7 @@
GOEX=0
while [ $GOEX -eq 0 ]; do
echo
- showmenu $i "(K)eep" "(O)verwrite" "(R)emove" "(D)iff" "(M)erge"
+ showmenu $i "(K)eep" "(O)verwrite" "(R)emove" "(D)iff" "(M)erge" "(V)imdiff [dp put, do obtain, ^W^W switch]"
read ANSWER
case $ANSWER in
O|o)
@@ -70,6 +82,9 @@
M|m)
mergenew $1
;;
+ V|v)
+ runvimdiff $1
+ ;;
K|k|*)
GOEX=1
;;
Okay, so I'm on the fence about the bootloader patch, but maybe.
However, I like the vimdiff one - if you will regenerate it against the present slackpkg source file and email it to me, I'll definitely look into applying that for the next release.
Okay, so I'm on the fence about the bootloader patch, but maybe.
If anybody wants this, they can simply create an executable file /usr/libexec/slackpkg/functions.d/runmkinitrd.sh containing
Code:
lookkernel() {
NEWKERNELMD5=$(md5sum /boot/vmlinuz 2>/dev/null)
if [ "$KERNELMD5" != "$NEWKERNELMD5" ]; then
if $(readlink /boot/vmlinuz | grep -q generic); then
echo -e "\n
Your kernel image was updated to a generic kernel. You need a new initrd."
NEWKERNELVERSION=$(readlink /boot/vmlinuz | sed 's/.*-\([1-9]\)/\1/')
if [ -d /lib/modules/$NEWKERNELVERSION ] && [ -f /boot/initrd-tree/command_line ]; then
MKINITRD_CMD=$(sed 's/-k *[^ ]\+/-k '$NEWKERNELVERSION'/' /boot/initrd-tree/command_line)
if [ grep -q -- -F /boot/initrd-tree/command_line ] \
&& [ ! grep -q -- -k /boot/initrd-tree/command_line ]; then
MKINITRD_CMD=$(sed 's/-F/-F -k '$NEWKERNELVERSION'/' /boot/initrd-tree/command_line)
fi
echo -e "\n
$MKINITRD_CMD
Do you want slackpkg to run the above command? (Y/n)"
answer
if [ "$ANSWER" != "n" ] && [ "$ANSWER" != "N" ]; then
$MKINITRD_CMD
fi
fi
fi
if [ -x /sbin/lilo ]; then
echo -e "\n
Your kernel image was updated. We highly recommend you run: lilo
Do you want slackpkg to run lilo now? (Y/n)"
answer
if [ "$ANSWER" != "n" ] && [ "$ANSWER" != "N" ]; then
/sbin/lilo
fi
else
echo -e "\n
Your kernel image was updated and lilo is not found on your system.
You may need to adjust your boot manager (like GRUB) to boot appropriate
kernel."
fi
fi
}
and the original lookkernel() function will be replaced when /usr/sbin/slackpkg is run due to
Code:
#========================================================================
#
# READ EXTRA FUNCTIONS
#
# If you want a new function or need a rewrite of an existing
# feature, you can put your new function in a shell script under
# /usr/libexec/slackpkg/functions.d/
#
# Remember - the new function scripts need to be executable
#
for i in /usr/libexec/slackpkg/functions.d/*.sh; do
if [ -x $i ]; then
. $i
fi
done
The only trick is to ensure that the file is named so that it lexicographically sorts after the file containing the original code.
Quote:
However, I like the vimdiff one - if you will regenerate it against the present slackpkg source file and email it to me, I'll definitely look into applying that for the next release.
Okay, so I'm on the fence about the bootloader patch, but maybe.
Forgot to mention. Your reservation on the booloader patch is well founded. I have realised that the patch can fail if the user last made the initrd using 'mkinitrd -F'. The command_line file does not retain the kernel version in this case. If /etc/mkinitrd.conf sets an incorrect KERNEL_VERSION, that does not match the incoming kernel version, then running 'mkinitrd -F' will result in problems.
[EDIT]I have slept on this and have added code to the lookkernel() function in post#3034 to perform an additional check and add the -k option to override the settings in /etc/mkinitrd.conf[/EDIT]
(The package build-system follows GNU Coding Standards and uses --runstatedir
instead of --localstatedir. The default is /run. Please, review your distribution
build scripts (spec files etc.) to be sure that this change does not introduce
any regression to your distribution)
Package bash-completion contain /usr/share/bash-completion/completions/mount, this file is also present in the utils-linux package,
if you update util-linux (2.31) it probably contain /usr/share/bash-completion/completions/rfkill, this file will be probably present in the new util-linux-2.31, and also in the bash-completion package.
also /usr/share/bash-completion/completions/umount is present in this two packages
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.