]> git.proxmox.com Git - pve-kernel-meta.git/blob - efiboot/pve-auto-removal
efiboot: adapt includepaths to new package
[pve-kernel-meta.git] / efiboot / pve-auto-removal
1 #! /bin/sh
2 set -e
3
4 . /usr/share/pve-kernel-helper/scripts/functions
5
6 eval "$(apt-config shell APT_CONF_D Dir::Etc::parts/d)"
7 test -n "${APT_CONF_D}" || APT_CONF_D="/etc/apt/apt.conf.d"
8
9 config_file="${APT_CONF_D}/76pveconf"
10
11 generate_apt_config() {
12
13 kernels="$(kernel_keep_versions "$@")"
14
15 cat <<- EOF
16 // DO NOT EDIT! File autogenerated by $0
17 APT::NeverAutoRemove
18 {
19 EOF
20 for kernel in $kernels; do
21 escaped_kver="$(echo "$kernel" | sed -e 's#\([\.\+]\)#\\\1#g')"
22 echo " \"^pve-kernel-${escaped_kver}$\";"
23 done
24 echo '};'
25 if [ "${APT_AUTO_REMOVAL_KERNELS_DEBUG:-false}" = 'true' ]; then
26 cat <<-EOF
27 /* Debug information:
28 # dpkg list:
29 $(dpkg -l | grep 'pve-kernel')
30 # list of installed kernel packages:
31 $kernels
32 */
33 EOF
34 fi
35 }
36
37 generate_apt_config "$@" > "${config_file}.dpkg-new"
38 mv -f "${config_file}.dpkg-new" "$config_file"
39 chmod 444 "$config_file"