File: simple

package info (click to toggle)
resolvconf-admin 0.3-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 124 kB
  • sloc: ansic: 337; sh: 41; makefile: 35
file content (29 lines) | stat: -rw-r--r-- 835 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# -*- shell-script -*-
# this is sourced by other scripts.

workdir=${AUTOPKGTEST_TMP:-$(mktemp -d)}

make tests/getifname
netif=$(tests/getifname)

adduser --quiet --system --shell=/bin/bash --disabled-password \
        --gecos 'resolvconf-admin test user,,,,' testdaemon0
adduser --quiet testdaemon0 resolvconf-admins

tid=$(id -u testdaemon0)

cp /etc/resolv.conf "$workdir/resolv.conf"

mkdir -p /run/resolvconf/interface
chown -R root:resolvconf-admins /run/resolvconf
chmod -R 775 /run/resolvconf

for nameserver in 8.8.4.4 1.2.3.4; do
    runuser -u testdaemon0 -- resolvconf-admin add $netif $nameserver
    grep -qFx "nameserver $nameserver" /etc/resolv.conf
    runuser -u testdaemon0 -- resolvconf-admin del $netif
done

diff -u "/etc/resolv.conf" "$workdir/resolv.conf"

deluser --quiet --remove-home --system testdaemon0