diff --git a/debian/postrm b/debian/postrm index 0608715..23e6cd9 100755 --- a/debian/postrm +++ b/debian/postrm @@ -20,9 +20,13 @@ case "$1" in remove) if [ -L /etc/resolv.conf ] \ + && RESOLV_CONF_TARGET="$(readlink /etc/resolv.conf)" \ + && [ "$RESOLV_CONF_TARGET" ] \ && { - [ "$(readlink /etc/resolv.conf)" = "/etc/resolvconf/run/resolv.conf" ] \ - || [ "$(readlink /etc/resolv.conf)" = "resolvconf/run/resolv.conf" ] + [ "$RESOLV_CONF_TARGET" = "/etc/resolvconf/run/resolv.conf" ] \ + || [ "$RESOLV_CONF_TARGET" = "resolvconf/run/resolv.conf" ] \ + || [ "$RESOLV_CONF_TARGET" = "/run/resolvconf/resolv.conf" ] \ + || [ "$RESOLV_CONF_TARGET" = "../run/resolvconf/resolv.conf" ] } then # /etc/resolv.conf is a resolvconf symlink @@ -33,19 +37,19 @@ case "$1" in rm -f /etc/resolv.conf # - # Put a file at /etc/resolv.conf with best available content + # Put a file at /etc/resolv.conf with the best available content # - # Best is latest dynamic content + # Best is the latest dynamic content # - if [ -f /etc/resolvconf/run/resolv.conf ] ; then + if [ -f "$RESOLV_CONF_TARGET" ] ; then # (Remove "generated by resolvconf" comment which is no longer true) - grep -sv '^#' /etc/resolvconf/run/resolv.conf > /etc/resolv.conf || : - rm -f /etc/resolvconf/run/resolv.conf + grep -sv '^#' "$RESOLV_CONF_TARGET" > /etc/resolv.conf || : + rm -f "$RESOLV_CONF_TARGET" # If nothing is left over, remove the file entirely [ -s /etc/resolv.conf ] || rm -f /etc/resolv.conf fi # - # Second best is "original" content + # Second best is the "original" content # if [ ! -f /etc/resolv.conf ] \