mirror of
https://git.proxmox.com/git/pve-kernel-meta
synced 2025-07-25 07:45:35 +00:00

We will be using the mechanics also for ZFS systems booting with BIOS legacy boot, and the tool is used also in PMG and PBS. A symlink is kept in place for compatibility reasons The hook scripts are marked as conffiles (as all files in /etc) and are handled by dpkg-maintscript-helper(1) via dh_installdeb(1) Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
40 lines
889 B
Bash
Executable File
40 lines
889 B
Bash
Executable File
#! /bin/sh
|
|
set -e
|
|
|
|
. /usr/share/pve-kernel-helper/scripts/functions
|
|
|
|
eval "$(apt-config shell APT_CONF_D Dir::Etc::parts/d)"
|
|
test -n "${APT_CONF_D}" || APT_CONF_D="/etc/apt/apt.conf.d"
|
|
|
|
config_file="${APT_CONF_D}/76pveconf"
|
|
|
|
generate_apt_config() {
|
|
|
|
kernels="$(kernel_keep_versions "$@")"
|
|
|
|
cat <<- EOF
|
|
// DO NOT EDIT! File autogenerated by $0
|
|
APT::NeverAutoRemove
|
|
{
|
|
EOF
|
|
for kernel in $kernels; do
|
|
escaped_kver="$(echo "$kernel" | sed -e 's#\([\.\+]\)#\\\1#g')"
|
|
echo " \"^pve-kernel-${escaped_kver}$\";"
|
|
done
|
|
echo '};'
|
|
if [ "${APT_AUTO_REMOVAL_KERNELS_DEBUG:-false}" = 'true' ]; then
|
|
cat <<-EOF
|
|
/* Debug information:
|
|
# dpkg list:
|
|
$(dpkg -l | grep -F 'pve-kernel' || true)
|
|
# list of installed kernel packages:
|
|
$kernels
|
|
*/
|
|
EOF
|
|
fi
|
|
}
|
|
|
|
generate_apt_config "$@" > "${config_file}.dpkg-new"
|
|
mv -f "${config_file}.dpkg-new" "$config_file"
|
|
chmod 444 "$config_file"
|