Skip to content

Commit

Permalink
Upgrading installing and settings sections in README.
Browse files Browse the repository at this point in the history
  • Loading branch information
nuxlli committed Aug 21, 2014
1 parent e1deb5e commit 725f2e8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 17 deletions.
55 changes: 42 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# libnss-resolver

A Linux extension that adds support the `/etc/resolver/*`,a means to support different "nameserver"
A Linux extension that adds support the `/etc/resolver/*`, a means to support different "nameserver"
to specific suffixes, in a similar fashion to that which is supported on Mac OS X.

This is still a work in progress!
Expand All @@ -9,7 +9,7 @@ This is still a work in progress!

### From package

Coming soon...
Download and install the appropriate package for your Linux distribution [here](https://github.com/azukiapp/libnss-resolver/releases).

### From the source

Expand All @@ -20,15 +20,19 @@ And after that:
```bash
$ git clone https://github.com/azukiapp-samples/libnss-resolver
$ cd libnss-resolver

# build
$ azk shell build -t -c "scons"
# [so] options: ubuntu12, ubuntu14, fedora20
$ azk shell [so]

# Run tests
# run tests
$ azk start dns # Run a mock dns server to test
$ azk shell build -t -c "./build/test"
$ azk shell [so] -t -c "scons run-test"
# or debug
$ azk shell [so] -t -c "scons run-test -Q define=DEBUG"

# Install local
$ azk shell --mount /usr/lib:/azk/lib -c "scons install"
# install local
$ azk shell [so] --mount /usr/lib:/azk/lib -c "scons install"
```

Now you can add the resolver-nss in resolution pipe:
Expand All @@ -40,12 +44,36 @@ $ sudo sed -i -re 's/^(hosts: .*$)/\1 resolver/' /etc/nsswitch.conf
or edit `/etc/nsswitch.conf`:

```bash
# Normally
# normally
hosts: files dns resolver
# But, if you have avahi (Zeroconf) installed ↓
# but, if you have avahi (Zeroconf) installed ↓
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 resolver
```

## Configuring

After install you can create a `sufix` zones in `/etc/resolver/`, like this:

```bash
$ echo "nameserver 127.0.0.1:5353" | sudo tee -a /etc/resolver/test.dev
```

A good way to test is to install dnsmasq:

```bash
$ sudo yum install dnsmasq
$ dnsmaqs -p 5353 --no-daemon --address=/test.dev/127.0.0.1
```

Now you can try this:

```bash
$ ping sufix
$ ping test.dev
# or any "subdomain"
$ ping any.test.dev
```

## Test and build

This project uses clang to compile, scons as mounting and valgrind tool to analyze code and running.
Expand All @@ -54,17 +82,18 @@ But all these tools are available behind the [azk][azk], just the commands below

```bash
$ azk start dns
$ azk shell build
# [so] options: ubuntu12, ubuntu14, fedora20
$ azk shell [so] -t -c "scons local-install"
```

After that, the following scons targets are available:

```bash
# To build and run testes
# to build and run testes
$ scons run-test -Q [define=DEBUG] [valgrind="valgrind options"]
# To install in azk instance
# to install in azk instance
$ scons local-install
# And test with:
# and test with:
$ ping resolver.dev
```

Expand Down
8 changes: 4 additions & 4 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ for k,v in install_dirs.items():
globals()['so_' + k] = build

# Test
env['ENV']['TEST_DNS_PORT'] = os.environ['DNS_DNS_PORT']
env['ENV']['TEST_DNS_HOST'] = os.environ['DNS_DNS_HOST']
env['ENV']['TEST_DNS_IP'] = os.environ['DNS_IP']
env['ENV']['TEST_DOMAIN'] = os.environ['DNS_DOMAIN']
env['ENV']['TEST_DNS_PORT'] = os.environ.get('DNS_DNS_PORT', None)
env['ENV']['TEST_DNS_HOST'] = os.environ.get('DNS_DNS_HOST', None)
env['ENV']['TEST_DNS_IP'] = os.environ.get('DNS_IP', None)
env['ENV']['TEST_DOMAIN'] = os.environ.get('DNS_DOMAIN', None)
env['ENV']['TEST_FIXTURES'] = os.getcwd() + '/test/fixtures/'
env['ENV']['VALGRIND_OPTS'] = ARGUMENTS.get('valgrind', '')
env['ENV']['LD_LIBRARY_PATH'] = '/usr/local/lib'
Expand Down

0 comments on commit 725f2e8

Please sign in to comment.