1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
#!/bin/bash
set -e
. /usr/share/debconf/confmodule
readonly CONFTEMPLATEPATH="/usr/share/libdebuginfod-common"
configure_debuginfod_debian()
{
local RET="false"
db_get libdebuginfod/usedebiandebuginfod || RET="false"
for ext in sh csh; do
[ -f "${CONFTEMPLATEPATH}/debuginfod.${ext}" ] || continue
if [ "$RET" = "true" ]; then
UCF_FORCE_CONFMISS=1 ucf --three-way --debconf-ok \
"${CONFTEMPLATEPATH}/debuginfod.${ext}" \
"/etc/profile.d/debuginfod.${ext}"
ucfr libdebuginfod-common "/etc/profile.d/debuginfod.${ext}"
chmod 0644 "/etc/profile.d/debuginfod.${ext}"
else
rm -f "/etc/profile.d/debuginfod.${ext}"
fi
done
}
configure_debuginfod_ubuntu()
{
local -r OLDVER="$1"
# Handle previous versions where the debuginfod configuration was
# optional.
if dpkg --compare-versions "${OLDVER}" le-nl "0.187-3"; then
for ext in sh csh; do
ucf --purge "/etc/profile.d/debuginfod.${ext}"
ucfr --purge libdebuginfod-common "/etc/profile.d/debuginfod.${ext}"
rm -f "/etc/profile.d/debuginfod.${ext}"
done
fi
for ext in sh csh; do
[ -e "/etc/profile.d/debuginfod.${ext}" ] && continue
ln -s "${CONFTEMPLATEPATH}/debuginfod.${ext}" \
"/etc/profile.d/debuginfod.${ext}"
done
}
configure_debuginfod()
{
local -r OLDVER="$1"
if grep -qFx "ID=debian" /etc/os-release; then
configure_debuginfod_debian "${OLDVER}"
elif grep -qFx "ID=ubuntu" /etc/os-release; then
configure_debuginfod_ubuntu "${OLDVER}"
fi
}
case "$1" in
configure)
configure_debuginfod "$2"
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
|