diff -urN 1/etc/init.d/resolvconf 2/etc/init.d/resolvconf --- 1/etc/init.d/resolvconf 2014-09-30 11:21:00.000000000 +0300 +++ 2/etc/init.d/resolvconf 2014-06-13 16:05:39.000000000 +0300 @@ -1,119 +1,93 @@ -#!/bin/sh -e -# upstart-job +#!/bin/sh # -# Symlink target for initscripts that have been converted to Upstart. - -set -e - -UPSTART_JOB_CONF="/etc/default/upstart-job" -INITSCRIPT="$(basename "$0")" -JOB="${INITSCRIPT%.sh}" - -if [ "$JOB" = "upstart-job" ]; then - if [ -z "$1" ]; then - echo "Usage: upstart-job JOB COMMAND" 1>&2 - exit 1 - fi - - JOB="$1" - INITSCRIPT="$1" - shift -else - if [ -z "$1" ]; then - echo "Usage: $0 COMMAND" 1>&2 - exit 1 - fi -fi - -COMMAND="$1" -shift - -ECHO=echo -ECHO_ERROR=echo -if [ -e "$UPSTART_JOB_CONF" ]; then - . "$UPSTART_JOB_CONF" -fi -if [ -n "$DPKG_MAINTSCRIPT_PACKAGE" ]; then - ECHO=: - ECHO_ERROR=: -fi - -$ECHO "Rather than invoking init scripts through /etc/init.d, use the service(8)" -$ECHO "utility, e.g. service $INITSCRIPT $COMMAND" - -# Only check if jobs are disabled if the currently _running_ version of -# Upstart (which may be older than the latest _installed_ version) -# supports such a query. +### BEGIN INIT INFO +# Provides: resolvconf +# Required-Start: $local_fs +# Required-Stop: $local_fs +# X-Start-Before: networking ifupdown +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Nameserver information manager +# Description: This service manages the list of nameserver addresses +# used by the libc resolver and name service caches +### END INIT INFO +# +# This file is part of the resolvconf package. # -# This check is necessary to handle the scenario when upgrading from a -# release without the 'show-config' command (introduced in -# Upstart for Ubuntu version 0.9.7) since without this check, all -# installed packages with associated Upstart jobs would be considered -# disabled. +# We really need "X-Stop-Before: networking ifupdown" too because +# terminal ifdowns shouldn't update resolv.conf; +# however there is unfortunately no such thing as "X-Stop-Before". # -# Once Upstart can maintain state on re-exec, this change can be -# dropped (since the currently running version of Upstart will always -# match the latest installed version). - -UPSTART_VERSION_RUNNING=$(initctl version|awk '{print $3}'|tr -d ')') - -if dpkg --compare-versions "$UPSTART_VERSION_RUNNING" ge 0.9.7 -then - initctl show-config -e "$JOB"|grep -q '^ start on' || DISABLED=1 -fi - -case $COMMAND in -status) - $ECHO - $ECHO "Since the script you are attempting to invoke has been converted to an" - $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" - $COMMAND "$JOB" - ;; -start|stop) - $ECHO - $ECHO "Since the script you are attempting to invoke has been converted to an" - $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" - if status "$JOB" 2>/dev/null | grep -q ' start/'; then - RUNNING=1 - fi - if [ -z "$RUNNING" ] && [ "$COMMAND" = "stop" ]; then - exit 0 - elif [ -n "$RUNNING" ] && [ "$COMMAND" = "start" ]; then - exit 0 - elif [ -n "$DISABLED" ] && [ "$COMMAND" = "start" ]; then - exit 0 - fi - $COMMAND "$JOB" - ;; -restart) - $ECHO - $ECHO "Since the script you are attempting to invoke has been converted to an" - $ECHO "Upstart job, you may also use the stop(8) and then start(8) utilities," - $ECHO "e.g. stop $JOB ; start $JOB. The restart(8) utility is also available." - if status "$JOB" 2>/dev/null | grep -q ' start/'; then - RUNNING=1 - fi - if [ -n "$RUNNING" ] ; then - stop "$JOB" - fi - # If the job is disabled and is not currently running, the job is - # not restarted. However, if the job is disabled but has been forced into the - # running state, we *do* stop and restart it since this is expected behaviour - # for the admin who forced the start. - if [ -n "$DISABLED" ] && [ -z "$RUNNING" ]; then - exit 0 - fi - start "$JOB" - ;; -reload|force-reload) - $ECHO - $ECHO "Since the script you are attempting to invoke has been converted to an" - $ECHO "Upstart job, you may also use the reload(8) utility, e.g. reload $JOB" - reload "$JOB" - ;; -*) - $ECHO_ERROR - $ECHO_ERROR "The script you are attempting to invoke has been converted to an Upstart" 1>&2 - $ECHO_ERROR "job, but $COMMAND is not supported for Upstart jobs." 1>&2 - exit 1 +# This file is not used in Ubuntu. +# + +# Don't use set -e; check return status instead. + +[ -x /sbin/resolvconf ] || exit 0 + +PATH=/sbin:/bin + +. /lib/lsb/init-functions + +# $1 EXITSTATUS +# [$2 MESSAGE] +log_action_end_msg_and_exit() +{ + log_action_end_msg "$1" ${2:+"$2"} + exit $1 +} + +case "$1" in + start) + # The "start" method should only be used at boot time. + # Don't run this on package upgrade, for example. + log_action_begin_msg "Setting up resolvconf" + # Wipe runtime directories in case they aren't on a tmpfs + resolvconf --wipe-runtime-directories || log_action_end_msg_and_exit 1 "failed to delete the old contents of run-time directories" + # Create runtime directories in case they are on a tmpfs + resolvconf --create-runtime-directories || log_action_end_msg_and_exit 1 "failed to create run-time directories" + # Request a postponed update (needed in case the base file has content). + resolvconf -u || log_action_end_msg_and_exit 1 "failed requesting update" + # Enable updates and perform the postponed update. + resolvconf --enable-updates || log_action_end_msg_and_exit 1 "failed to enable updates" + log_action_end_msg_and_exit 0 + ;; + stop) + # The "stop" method should only be used at shutdown time. + log_action_begin_msg "Stopping resolvconf" + resolvconf --disable-updates || log_action_end_msg_and_exit 1 "failed to disable updates" + log_action_end_msg_and_exit 0 + ;; + restart) + log_action_begin_msg "Restarting resolvconf" + resolvconf --enable-updates || log_action_end_msg_and_exit 1 "failed to enable updates" + log_action_end_msg_and_exit 0 + ;; + reload|force-reload) + resolvconf -u || log_action_end_msg_and_exit 1 "failed to update" + exit 0 + ;; + enable-updates) + resolvconf --enable-updates || log_action_end_msg_and_exit 1 "failed to enable updates" + exit 0 + ;; + disable-updates) + resolvconf --disable-updates || log_action_end_msg_and_exit 1 "failed to disable updates" + exit 0 + ;; + status) + if resolvconf --updates-are-enabled ; then + log_success_msg "resolvconf updates are enabled" + else + log_failure_msg "resolvconf updates are disabled" + fi + exit 0 + ;; + *) + echo "Usage: /etc/init.d/resolvconf {start|stop|restart|reload|force-reload|enable-updates|disable-updates|status}" >&2 + exit 3 + ;; esac + +# Don't reach here +exit 99 diff -urN 1/postinst 2/postinst --- 1/postinst 2013-01-18 18:58:28.000000000 +0200 +++ 2/postinst 2014-06-17 17:09:48.000000000 +0300 @@ -146,7 +146,7 @@ esac # Automatically added by dh_installinit -if [ -x "/etc/init.d/resolvconf" ]; then +if [ -x "/etc/init.d/resolvconf" ] || [ -e "/etc/init/resolvconf.conf" ]; then if [ ! -e "/etc/init/resolvconf.conf" ]; then update-rc.d resolvconf defaults >/dev/null fi diff -urN 1/preinst 2/preinst --- 1/preinst 2013-01-18 18:58:28.000000000 +0200 +++ 2/preinst 2014-06-17 17:09:48.000000000 +0300 @@ -56,9 +56,17 @@ fi fi ;; - # upgrade) - # Don't do anything - # ;; + upgrade) + # On 12.04 LTS the system works without /etc/resolv.conf. Upon upgrading + # such a system to 14.04 LTS network stops working. Therefore, create a + # symlink upon upgrade from resolvconf <= 1.64 in the case that + # /etc/resolv.conf does not exist at all. (LP: #1308378) + if dpkg --compare-versions "$2" lt 1.64 ; then + if [ ! -e /etc/resolv.conf ]; then + ln -nsf ../run/resolvconf/resolv.conf /etc/resolv.conf + fi + fi + ;; # abort-upgrade) # Don't do anything because we don't anything in the postrm on upgrade or on failed-upgrade # ;; @@ -66,15 +74,10 @@ # Automatically added by dh_installinit if [ "$1" = install ] || [ "$1" = upgrade ]; then - if [ -e "/etc/init.d/resolvconf" ] && [ ! -L "/etc/init.d/resolvconf" ]; then - if [ "`md5sum \"/etc/init.d/resolvconf\" | sed -e \"s/ .*//\"`" != \ - "`dpkg-query -W -f='${Conffiles}' resolvconf | sed -n -e \"\\\\' /etc/init.d/resolvconf '{s/ obsolete$//;s/.* //p}\"`" ] - then - echo "Obsolete conffile /etc/init.d/resolvconf has been modified by you, renaming to .dpkg-bak" - mv -f "/etc/init.d/resolvconf" "/etc/init.d/resolvconf.dpkg-bak" - else - rm -f "/etc/init.d/resolvconf" - fi + if [ -e "/etc/init.d/resolvconf" ] && [ -L "/etc/init.d/resolvconf" ] \ + && [ $(readlink -f "/etc/init.d/resolvconf") = /lib/init/upstart-job ] + then + rm -f "/etc/init.d/resolvconf" fi fi # End automatically added section diff -urN 1/prerm 2/prerm --- 1/prerm 2013-01-18 18:58:28.000000000 +0200 +++ 2/prerm 2014-06-17 17:09:48.000000000 +0300 @@ -17,7 +17,8 @@ esac # Automatically added by dh_installinit -if [ -x "/etc/init.d/resolvconf" ] && [ "$1" = remove ]; then +if ([ -x "/etc/init.d/resolvconf" ] || [ -e "/etc/init/resolvconf.conf" ]) && \ + [ "$1" = remove ]; then invoke-rc.d resolvconf stop || exit $? fi # End automatically added section