diff -Nru resolvconf-1.45ubuntu1/bin/resolvconf resolvconf-1.45ubuntu1ppa4/bin/resolvconf --- resolvconf-1.45ubuntu1/bin/resolvconf 2009-12-31 08:01:51.000000000 +0100 +++ resolvconf-1.45ubuntu1ppa4/bin/resolvconf 2010-03-29 22:53:26.000000000 +0200 @@ -5,30 +5,47 @@ # # History # Jun 2003 - April 2005: Written by Thomas Hood +# Dec 2009: Sander van Grieken # -# resolvconf (-u|-d IFACE|-a IFACE) +# resolvconf (-i|-u|-d IFACE|-a IFACE|--enable-updates|--disable-updates|-r) set -e -echo_usage() { echo "Usage: resolvconf (-u|-d IFACE|-a IFACE)" ; } - +[ -e /etc/default/resolvconf ] && . /etc/default/resolvconf +RUN_DIR=${RESOLVCONF_RUNDIR:=/lib/init/rw/resolvconf} + PATH=/sbin:/bin MYNAME="${0##*/}" -# Note that /etc/resolvconf/run may be a symlink -RUN_DIR=/etc/resolvconf/run IFACE_DIR="${RUN_DIR}/interface" ENABLE_UPDATES_FLAGFILE="${RUN_DIR}/enable-updates" +echo_usage() { echo "Usage: resolvconf (-i|-u|-d IFACE|-a IFACE|--enable-updates|--disable-updates|-r)" ; } report_err() { echo "${MYNAME}: Error: $*" >&2 ; } [ -L /etc/resolv.conf ] || { report_err "/etc/resolv.conf must be a symlink"; exit 1; } +enable-updates() { + touch "$ENABLE_UPDATES_FLAGFILE" + [ -e "$ENABLE_UPDATES_FLAGFILE" ] || { report_err "could not enable updates" ; exit 1 ; } +} + +disable-updates() { + rm -f "$ENABLE_UPDATES_FLAGFILE" + [ ! -e "$ENABLE_UPDATES_FLAGFILE" ] || { report_err "could not disable updates" ; exit 1 ; } +} + +do-update() { + # make sure we're in the right PWD + cd "$IFACE_DIR" + exec run-parts ${1:+--arg=$1} ${IFACE:+--arg="$IFACE"} /etc/resolvconf/update.d +} + # Check arguments CMD="$1" case "$CMD" in - -u) + -i|-u|-r|--enable-updates|--disable-updates) if [ "$2" ] ; then - report_err "The -u option does not take an argument" + report_err "The $CMD option does not take an argument" echo_usage >&2 exit 1 fi @@ -56,6 +73,35 @@ ;; esac +case "$CMD" in + -r) + # return RUN_DIR + echo $RUN_DIR + exit 0 + ;; + -i) + # create resolvconf $RUNDIR + [ ! -d "$RUN_DIR" ] && mkdir -p "$RUN_DIR" + [ ! -d "$RUN_DIR" ] && { report_err "unable to create $RUN_DIR" ; exit 1 ; } + [ -d "$RUN_DIR/interface" ] && rm -rf "$RUN_DIR/interface" + mkdir -p "$RUN_DIR/interface" + rm -f "$RUN_DIR/resolv.conf" + enable-updates + do-update -i + exit 0 + ;; + --enable-updates) + enable-updates + exit 0 + ;; + --disable-updates) + disable-updates + exit 0 + ;; +esac + + + [ -d "$IFACE_DIR" ] || { report_err "$IFACE_DIR is not a directory" ; exit 1 ; } cd "$IFACE_DIR" @@ -94,5 +140,4 @@ [ -e "$ENABLE_UPDATES_FLAGFILE" ] || exit 0 -exec run-parts "--arg=$CMD" ${IFACE:+--arg="$IFACE"} /etc/resolvconf/update.d - +do-update diff -Nru resolvconf-1.45ubuntu1/debian/changelog resolvconf-1.45ubuntu1ppa4/debian/changelog --- resolvconf-1.45ubuntu1/debian/changelog 2009-12-31 08:07:09.000000000 +0100 +++ resolvconf-1.45ubuntu1ppa4/debian/changelog 2010-03-29 22:46:45.000000000 +0200 @@ -1,3 +1,10 @@ +resolvconf (1.45ubuntu1ppa4) lucid; urgency=low + + * Port to upstart (LP: #448095) + * Thanks to Sander van Grieken. + + -- Simon Huerlimann (CyT) Mon, 29 Mar 2010 22:05:14 +0200 + resolvconf (1.45ubuntu1) lucid; urgency=low * Merge from debian unstable, remaining changes (LP: #495998): diff -Nru resolvconf-1.45ubuntu1/debian/init resolvconf-1.45ubuntu1ppa4/debian/init --- resolvconf-1.45ubuntu1/debian/init 2009-08-13 19:58:50.000000000 +0200 +++ resolvconf-1.45ubuntu1ppa4/debian/init 1970-01-01 01:00:00.000000000 +0100 @@ -1,127 +0,0 @@ -#!/bin/sh -# -### 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 -# -# We really need "X-Stop-Before: networking ifupdown" too because -# terminal ifdowns shouldn't update resolv.conf; -# however no "X-Stop-Before" dependency has been defined. -# -# This script is part of the resolvconf package -# See /usr/share/doc/resolvconf/copyright - -# Don't use set -e; check return status instead - -[ -x /sbin/resolvconf ] || exit 0 - -MYNAME="${0##*/}" -PATH=/sbin:/bin -RUN_DIR=/etc/resolvconf/run -IFACE_DIR="${RUN_DIR}/interface" -RESOLVCONF_FILE="${RUN_DIR}/resolv.conf" -ENABLE_UPDATES_FLAGFILE="${RUN_DIR}/enable-updates" - -. /lib/lsb/init-functions - -# $1 EXITSTATUS -# [$2 MESSAGE] -log_action_end_msg_and_exit() -{ - log_action_end_msg "$1" ${2:+"$2"} - exit $1 -} - -update() -{ - [ -e "$ENABLE_UPDATES_FLAGFILE" ] || return 0 - cd "$IFACE_DIR" - # "update" scripts must assume that interface files are in the PWD - run-parts ${1:+--arg="$1"} ${2:+--arg="$2"} /etc/resolvconf/update.d -} - -enable_updates() -{ - : >| "$ENABLE_UPDATES_FLAGFILE" -} - -disable_updates() -{ - rm -f "$ENABLE_UPDATES_FLAGFILE" -} - -case "$1" in -start) - # The "start" method should _only_ be used at boot time. - # If you want to update the resolv.conf file then use "reload". - # On package upgrade, don't run this. - log_action_begin_msg "Setting up resolvconf" - umask 022 - if [ ! -d "$RUN_DIR" ] ; then - [ -L "$RUN_DIR" ] || log_action_end_msg_and_exit 1 "$RUN_DIR is neither a directory nor a symbolic link" - # Target of symlink is not a dir - { RUN_CANONICALDIR="$(readlink -f "$RUN_DIR")" && [ "$RUN_CANONICALDIR" ] ; } || log_action_end_msg_and_exit 1 "canonical path of the run directory could not be determined" - # Create directory at the target - mkdir "$RUN_CANONICALDIR" || log_action_end_msg_and_exit 1 "error creating directory $RUN_CANONICALDIR" - fi - # The run directory exists - - if [ -d "${RUN_DIR}/interface" ] ; then - rm -f ${RUN_DIR}/interface/* - else - mkdir "${RUN_DIR}/interface" || log_action_end_msg_and_exit 1 "error creating directory ${RUN_DIR}/interface" - fi - # The interface directory exists - - enable_updates || log_action_end_msg_and_exit 1 "could not enable updates" - update -i - log_action_end_msg_and_exit "$?" - ;; -stop) - # The "stop" method should only be used at shutdown time. - log_action_begin_msg "Stopping resolvconf" - disable_updates - log_action_end_msg_and_exit "$?" - ;; -restart) - log_action_begin_msg "Restarting resolvconf" - [ -d "${RUN_DIR}/interface" ] || log_action_end_msg_and_exit 1 "${RUN_DIR}/interface is not a directory" - enable_updates || log_action_end_msg_and_exit 1 "could not enable updates" - update - log_action_end_msg_and_exit "$?" - ;; -reload|force-reload) - # Do it silently - [ -d "${RUN_DIR}/interface" ] || { log_failure_msg "${RUN_DIR}/interface is not a directory" ; exit 1 ; } - update - exit $? - ;; -enable-updates) - enable_updates - exit $? - ;; -disable-updates) - disable_updates - exit $? - ;; -status) - if [ -e "$ENABLE_UPDATES_FLAGFILE" ]; then - log_success_msg "resolvconf updates are enabled" - else - log_failure_msg "resolvconf updates are disabled" - fi - ;; -*) - echo "Usage: /etc/init.d/resolvconf {start|stop|reload|restart|force-reload|enable-updates|disable-updates|status}" >&2 - exit 3 - ;; -esac - diff -Nru resolvconf-1.45ubuntu1/debian/postinst resolvconf-1.45ubuntu1ppa4/debian/postinst --- resolvconf-1.45ubuntu1/debian/postinst 2009-12-31 08:01:51.000000000 +0100 +++ resolvconf-1.45ubuntu1ppa4/debian/postinst 2010-03-29 23:10:43.000000000 +0200 @@ -153,10 +153,5 @@ db_stop ### Enable updates ### -if [ -x "/etc/init.d/resolvconf" ] ; then - if which invoke-rc.d >/dev/null 2>&1 ; then - invoke-rc.d resolvconf enable-updates || : - else - /etc/init.d/resolvconf enable-updates - fi -fi + +resolvconf --enable-updates || : diff -Nru resolvconf-1.45ubuntu1/debian/prerm resolvconf-1.45ubuntu1ppa4/debian/prerm --- resolvconf-1.45ubuntu1/debian/prerm 2006-08-10 18:57:37.000000000 +0200 +++ resolvconf-1.45ubuntu1ppa4/debian/prerm 2010-03-29 23:10:48.000000000 +0200 @@ -3,13 +3,8 @@ case "$1" in remove) - if [ -x "/etc/init.d/resolvconf" ] ; then - if which invoke-rc.d >/dev/null 2>&1 ; then - invoke-rc.d resolvconf disable-updates || : - else - /etc/init.d/resolvconf disable-updates - fi - fi + ### Disable updates ### + resolvconf --disable-updates || : ;; # *) # deconfigure, upgrade, failed-upgrade diff -Nru resolvconf-1.45ubuntu1/debian/resolvconf.upstart resolvconf-1.45ubuntu1ppa4/debian/resolvconf.upstart --- resolvconf-1.45ubuntu1/debian/resolvconf.upstart 1970-01-01 01:00:00.000000000 +0100 +++ resolvconf-1.45ubuntu1ppa4/debian/resolvconf.upstart 2010-03-29 22:03:53.000000000 +0200 @@ -0,0 +1,19 @@ +# upstart script for resolvconf + +start on ( virtual-filesystems and starting udev ) + +stop on runlevel [06] + +pre-start script + RUNDIR=$(resolvconf -r) + # initialise $RUNDIR, if not exist + if [ ! -d "$RUNDIR" ] || [ ! -d "$RUNDIR/interface" ]; then + resolvconf -i + else + resolvconf --enable-updates + fi +end script + +post-stop script + resolvconf --disable-updates +end script diff -Nru resolvconf-1.45ubuntu1/debian/rules resolvconf-1.45ubuntu1ppa4/debian/rules --- resolvconf-1.45ubuntu1/debian/rules 2009-12-31 08:01:51.000000000 +0100 +++ resolvconf-1.45ubuntu1ppa4/debian/rules 2010-03-29 22:03:05.000000000 +0200 @@ -27,7 +27,7 @@ dh_installdocs README dh_installman dh_installchangelogs - dh_installinit --no-start -- start 07 S . + dh_installinit --no-start dh_installppp --name=000resolvconf install --mode=0755 debian/resolvconf.000resolvconf.ifupdown.if-up $(DESTDIR)/etc/network/if-up.d/000resolvconf install --mode=0755 debian/resolvconf.resolvconf.ifupdown.if-down $(DESTDIR)/etc/network/if-down.d/resolvconf diff -Nru resolvconf-1.45ubuntu1/etc/resolvconf/update.d/libc resolvconf-1.45ubuntu1ppa4/etc/resolvconf/update.d/libc --- resolvconf-1.45ubuntu1/etc/resolvconf/update.d/libc 2009-08-13 19:58:50.000000000 +0200 +++ resolvconf-1.45ubuntu1ppa4/etc/resolvconf/update.d/libc 2010-03-29 22:52:19.000000000 +0200 @@ -32,7 +32,8 @@ BASEFILE="${RESOLVCONFDIR}/base" HEADFILE="${RESOLVCONFDIR}/head" TAILFILE="${RESOLVCONFDIR}/tail" -DYNAMICRSLVCNFFILE="${ETCRESOLVCONF}/run/resolv.conf" + +DYNAMICRSLVCNFFILE="$(resolvconf -r)/resolv.conf" TMPFILE="${DYNAMICRSLVCNFFILE}_new.$$" report_warning() { echo "$0: Warning: $*" >&2 ; }