Page 3 of 4
Re: rebuild_dkms_packages.sh script fails
Posted: Mon Nov 09, 2020 2:52 pm
by dolphin_oracle
tony37 wrote: Mon Nov 09, 2020 2:49 pm
"dpkg-query --status" also gives output for packages with remaining configuration files:
do kernels have left over conf files (that's a real question)?
Re: rebuild_dkms_packages.sh script fails
Posted: Mon Nov 09, 2020 2:53 pm
by tony37
Of course, I have linux-image-4.19.0-11-amd64 there
(easy command to search for such packages: aptitude search '~c')
Re: rebuild_dkms_packages.sh script fails
Posted: Mon Nov 09, 2020 3:08 pm
by dolphin_oracle
ok, then we will go full on fool-proof
Code: Select all
#!/bin/bash
#force rebuild of dkms packages (virtualbox, nvidia, fglrx, broadcom, ndiswrapper)
#part of mx-packageinstaller
kernel="$1"
# if parameter passed, then check to see if package is installed, exit if not
if [ -n "$kernel" ]; then
[[ ! $(LANG=C dpkg-query --status $1 |grep "install ok installed" ) ]] || exit 0
fi
#if no kernel parameter given, assume current kernel
if [ -z "$kernel" ]; then
kernel="$(uname -r)"
fi
kernel=${kernel#"linux-image-"}
kernel=${kernel%-unsigned}
echo "update dkms modules for kernel: " $kernel |tee /var/log/rebuild-dkms.log
echo "see log at /var/log/rebuild-dkms.log"
/usr/lib/dkms/dkms_autoinstaller start $kernel |tee -a /var/log/rebuild-dkms.log
exit 0
Re: rebuild_dkms_packages.sh script fails
Posted: Mon Nov 09, 2020 3:22 pm
by tony37
Maybe still a mistake, I think it exits if the package is installed and not the reverse
If you leave out the ! it works better:
Code: Select all
[[ $(LANG=C dpkg-query --status $1 |grep "install ok installed" ) ]] || exit 0
But with a package not installed and also with no config files remaining, I get this message:
Code: Select all
dpkg-query: package 'linux-image-4.19.0-10-amd64' is not installed and no information is available
Use dpkg --info (= dpkg-deb --info) to examine archive files.
edit: The right solution is of course combining the two conditions:
Code: Select all
#!/bin/bash
#force rebuild of dkms packages (virtualbox, nvidia, fglrx, broadcom, ndiswrapper)
#part of mx-packageinstaller
kernel="$1"
# if parameter passed, then check to see if package is installed, exit if not
if [ -n "$kernel" ]; then
[[ $(dpkg-query --status $1 2>/dev/null ) ]] || exit 0
[[ $(LANG=C dpkg-query --status $1 |grep "install ok installed" ) ]] || exit 0
fi
#if no kernel parameter given, assume current kernel
if [ -z "$kernel" ]; then
kernel="$(uname -r)"
fi
kernel=${kernel#"linux-image-"}
kernel=${kernel%-unsigned}
echo "update dkms modules for kernel: " $kernel |tee /var/log/rebuild-dkms.log
echo "see log at /var/log/rebuild-dkms.log"
/usr/lib/dkms/dkms_autoinstaller start $kernel |tee -a /var/log/rebuild-dkms.log
exit 0
Re: rebuild_dkms_packages.sh script fails
Posted: Mon Nov 09, 2020 3:41 pm
by tony37
in case you can still use this, an easy way to find the dependency of the installed linux-image-amd64 package:
Code: Select all
dpkg-query -W -f='${Depends}\n' linux-image-amd64
Re: rebuild_dkms_packages.sh script fails
Posted: Mon Nov 09, 2020 4:45 pm
by dolphin_oracle
tony37 wrote: Mon Nov 09, 2020 3:41 pm
in case you can still use this, an easy way to find the dependency of the installed linux-image-amd64 package:
Code: Select all
dpkg-query -W -f='${Depends}\n' linux-image-amd64
I used similar in the kernel pm files.
Re: rebuild_dkms_packages.sh script fails
Posted: Mon Nov 09, 2020 4:47 pm
by dolphin_oracle
I don't want it it exit if the package is installed. I want it to exit if the package is NOT installed, so that nothing happens if the build fails.
I'll make sure to test it when I'm back at my linux box.
Re: rebuild_dkms_packages.sh script fails
Posted: Mon Nov 09, 2020 5:05 pm
by tony37
this works to check if the package is installed or not:
Code: Select all
if [ -n "$kernel" ]; then
[[ $(grep -A1 $1 /var/lib/dpkg/status | grep 'install ok installed' ) ]] || exit 0
fi
Re: rebuild_dkms_packages.sh script fails
Posted: Mon Nov 09, 2020 6:35 pm
by dolphin_oracle
used your test, and got rid of hte !
Code: Select all
#!/bin/bash
#force rebuild of dkms packages (virtualbox, nvidia, fglrx, broadcom, ndiswrapper)
#part of mx-packageinstaller
kernel="$1"
# if parameter passed, then check to see if package is installed, exit if not
if [ -n "$kernel" ]; then
[[ -n $(grep -A1 $kernel /var/lib/dpkg/status | grep 'install ok installed' ) ]] || exit 0
fi
#if no kernel parameter given, assume current kernel
if [ -z "$kernel" ]; then
kernel="$(uname -r)"
fi
kernel=${kernel#"linux-image-"}
kernel=${kernel%-unsigned}
echo "update dkms modules for kernel: " $kernel |tee /var/log/rebuild-dkms.log
echo "see log at /var/log/rebuild-dkms.log"
#/usr/lib/dkms/dkms_autoinstaller start $kernel |tee -a /var/log/rebuild-dkms.log
exit 0
Re: rebuild_dkms_packages.sh script fails
Posted: Tue Nov 10, 2020 3:43 am
by tony37
I'm sorry to say, but you have
Code: Select all
file=$(apt-cache show linux-image-amd64=4.19 |grep -m1 Depends)
in kernel_debian_64.pm (and similar in kernel_debian_32.pm) and it should have been
Code: Select all
file=$(apt-cache show linux-image-amd64=4.19* |grep -m1 Depends)
:lipsrsealed:
edit: the deb file also has a folder /share/mx-packageinstaller-pkglist (without /usr)...