1
0
linux/debian/templates/image.preinst.in
2024-11-15 10:44:41 +03:00

47 lines
886 B
Bash

#!/bin/sh
set -e
if [ "$1" = abort-upgrade ] ; then exit 0 ; fi
version='@abiname@@localversion@'
image_path="/boot/@image-stem@-${version}"
if [ "$1" = install ]; then
# Create a flag file for postinst
mkdir -p "/lib/modules/${version}"
touch "/lib/modules/${version}/.fresh-install"
fi
if [ -d /etc/kernel/preinst.d ] ; then
DEB_MAINT_PARAMS="$*" \
run-parts --report --exit-on-error \
"--arg=${version}" \
"--arg=${image_path}" \
/etc/kernel/preinst.d
fi
f='/etc/apt/apt.conf.d/krd-linux'
while : ; do
[ -s "$f" ] || break
h=$(sha256sum -b "$f" | awk '{print $1}')
[ "$h" = '70e8b9a9dd5f6e153840ed7046285b927cff37a2859e0fbc512a3eb8c576de24' ] || break
exit 0
done
cat > "$f" <<-'EOF'
APT
{
NeverAutoRemove
{
"^krd-linux-.*$";
};
VersionedKernelPackages
{
"krd-linux-.*";
};
};
EOF
chmod 0644 "$f"
exit 0