#!/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. exit 0