| 1 |
jdthood-guest |
95 |
#!/bin/sh |
| 2 |
jdthood-guest |
3 |
|
| 3 |
|
|
set -e |
| 4 |
|
|
|
| 5 |
|
|
. /usr/share/debconf/confmodule |
| 6 |
|
|
|
| 7 |
|
|
MYNAME=resolvconf.postinst |
| 8 |
|
|
report() { echo "${MYNAME}: $*" ; } |
| 9 |
|
|
report_err() { report "Error: $*" >&2 ; } |
| 10 |
rekt-guest |
58 |
report_info() { report "Info: $*" >&2 ; } |
| 11 |
jdthood-guest |
3 |
|
| 12 |
|
|
# We use dh_installinit with --no-start |
| 13 |
|
|
#DEBHELPER# |
| 14 |
|
|
|
| 15 |
|
|
### Link tail to original if appropriate ### |
| 16 |
|
|
case "$1" in |
| 17 |
jdthood-guest |
95 |
configure|reconfigure) |
| 18 |
jdthood-guest |
3 |
if [ ! -e /etc/resolvconf/resolv.conf.d/tail ] ; then |
| 19 |
|
|
db_get resolvconf/link-tail-to-original |
| 20 |
|
|
if [ "$RET" = "true" ] ; then |
| 21 |
|
|
ln -nsf original /etc/resolvconf/resolv.conf.d/tail |
| 22 |
|
|
else |
| 23 |
|
|
: > /etc/resolvconf/resolv.conf.d/tail |
| 24 |
|
|
fi |
| 25 |
|
|
fi |
| 26 |
jdthood-guest |
171 |
;; |
| 27 |
|
|
esac |
| 28 |
jdthood-guest |
3 |
|
| 29 |
|
|
### Linkify /etc/resolv.conf if appropriate ### |
| 30 |
|
|
case "$1" in |
| 31 |
jdthood-guest |
95 |
configure|reconfigure) |
| 32 |
jdthood-guest |
3 |
db_get resolvconf/linkify-resolvconf |
| 33 |
|
|
if [ "$RET" = "true" ] ; then |
| 34 |
|
|
# Back up |
| 35 |
|
|
if \ |
| 36 |
|
|
[ -f /etc/resolv.conf ] \ |
| 37 |
|
|
&& { \ |
| 38 |
|
|
[ ! -L /etc/resolv.conf ] \ |
| 39 |
|
|
|| [ ! "$(readlink /etc/resolv.conf)" = "/etc/resolvconf/run/resolv.conf" ] ; \ |
| 40 |
|
|
} |
| 41 |
|
|
then |
| 42 |
|
|
if [ ! -e /etc/resolvconf/resolv.conf.d/original ] ; then |
| 43 |
|
|
cp -a /etc/resolv.conf /etc/resolvconf/resolv.conf.d/original |
| 44 |
|
|
else |
| 45 |
|
|
cp -a /etc/resolv.conf /etc/resolv.conf.dpkg-old |
| 46 |
|
|
fi |
| 47 |
|
|
# Before creating the link, make sure that the original file is |
| 48 |
|
|
# at the target of the link. /sbin/resolvconf will overwrite |
| 49 |
|
|
# this when it runs, of course. |
| 50 |
|
|
if [ ! -e /etc/resolvconf/run/resolv.conf ] ; then |
| 51 |
|
|
cp -a /etc/resolv.conf /etc/resolvconf/run/resolv.conf |
| 52 |
|
|
fi |
| 53 |
|
|
fi |
| 54 |
|
|
|
| 55 |
|
|
# Create the link |
| 56 |
|
|
ln -nsf /etc/resolvconf/run/resolv.conf /etc/resolv.conf |
| 57 |
|
|
fi |
| 58 |
jdthood-guest |
171 |
;; |
| 59 |
|
|
esac |
| 60 |
jdthood-guest |
39 |
|
| 61 |
|
|
db_stop |
| 62 |
jdthood-guest |
3 |
|
| 63 |
|
|
### Enable updates ### |
| 64 |
jdthood-guest |
39 |
if [ -x "/etc/init.d/resolvconf" ] ; then |
| 65 |
|
|
if which invoke-rc.d >/dev/null 2>&1 ; then |
| 66 |
|
|
invoke-rc.d resolvconf enable-updates || : |
| 67 |
|
|
else |
| 68 |
|
|
/etc/init.d/resolvconf enable-updates |
| 69 |
|
|
fi |
| 70 |
|
|
fi |