diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2009-09-15 12:14:18 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2009-09-15 12:14:18 +0000 |
commit | 334ba4029aa89519fda0915bc31e1446f8c84b2e (patch) | |
tree | 1fb152460d0e79fffc1b7b231320fae80e43076d /main | |
parent | 5c518b6bec8bb98330b7674823627c3d1b3adb0b (diff) | |
download | aports-334ba4029aa89519fda0915bc31e1446f8c84b2e.tar.bz2 aports-334ba4029aa89519fda0915bc31e1446f8c84b2e.tar.xz |
main/alpine-conf: setup-alpine edits /etc/hosts
fixes #163
Diffstat (limited to 'main')
-rw-r--r-- | main/alpine-conf/0001-setup-alpine-add-the-hostname-to-etc-hosts.patch | 50 | ||||
-rw-r--r-- | main/alpine-conf/APKBUILD | 8 |
2 files changed, 56 insertions, 2 deletions
diff --git a/main/alpine-conf/0001-setup-alpine-add-the-hostname-to-etc-hosts.patch b/main/alpine-conf/0001-setup-alpine-add-the-hostname-to-etc-hosts.patch new file mode 100644 index 000000000..2b01b0ead --- /dev/null +++ b/main/alpine-conf/0001-setup-alpine-add-the-hostname-to-etc-hosts.patch @@ -0,0 +1,50 @@ +From d1f2db71733268da8097db02326e7f5332671f86 Mon Sep 17 00:00:00 2001 +From: Natanael Copa <ncopa@alpinelinux.org> +Date: Tue, 15 Sep 2009 08:57:32 +0000 +Subject: [PATCH] setup-alpine: add the hostname to /etc/hosts + +--- + setup-alpine.in | 23 +++++++++++++++++++++++ + 1 files changed, 23 insertions(+), 0 deletions(-) + +diff --git a/setup-alpine.in b/setup-alpine.in +index 3472f53..712a950 100644 +--- a/setup-alpine.in ++++ b/setup-alpine.in +@@ -6,6 +6,16 @@ VERSION=@VERSION@ + PREFIX= + . $PREFIX/lib/libalpine.sh + ++# Extract fully qualified domain name from current hostname. If none is ++# currently set, use 'my.domain'. ++get_fqdn() { ++ local _dn ++ _dn=$(hostname -f 2>/dev/null) ++ _dn=${_dn#$(hostname -s 2>/dev/null)} ++ _dn=${_dn#.} ++ echo "${_dn:=my.domain}" ++} ++ + while getopts "ah" opt ; do + case $opt in + a) ARCHIVE=yes;; +@@ -42,3 +52,16 @@ rc-update -q add networking boot + rc boot + rc default + ++# update /etc/hosts - after we have got dhcp address ++# Get default fully qualified domain name from *first* domain ++# given on *last* search or domain statement. ++_dn=$(sed -n \ ++-e '/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}' \ ++-e '/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}' \ ++-e '${g;p;}' /etc/resolv.conf 2>/dev/null) ++ ++_hn=$(hostname) ++_hn=${_hn%%.*} ++ ++sed -i -e "s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn)} ${_hn} localhost.localdomain localhost/" /etc/hosts ++ +-- +1.6.4.2 + diff --git a/main/alpine-conf/APKBUILD b/main/alpine-conf/APKBUILD index d7dfc4e26..aa6575496 100644 --- a/main/alpine-conf/APKBUILD +++ b/main/alpine-conf/APKBUILD @@ -1,16 +1,19 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=alpine-conf pkgver=2.0_rc3 -pkgrel=0 +pkgrel=1 pkgdesc="Alpine configuration management scripts" url=http://git.alpinelinux.org/cgit/$pkgname depends="openrc" source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2 + 0001-setup-alpine-add-the-hostname-to-etc-hosts.patch " license="GPL-2" build() { cd "$srcdir/$pkgname-$pkgver" + patch -p1 -i ../0001-setup-alpine-add-the-hostname-to-etc-hosts.patch \ + || return 1 make || return 1 make install PREFIX= DESTDIR="$pkgdir" @@ -18,4 +21,5 @@ build() { ln -s lbu "$pkgdir"/sbin/lbu_$i done } -md5sums="54810ee972f0d9c9a992f706af8feb43 alpine-conf-2.0_rc3.tar.bz2" +md5sums="54810ee972f0d9c9a992f706af8feb43 alpine-conf-2.0_rc3.tar.bz2 +c91b9ca722dfbb479e0739d905211f94 0001-setup-alpine-add-the-hostname-to-etc-hosts.patch" |