X-Original-To: alpine-aports@mail.alpinelinux.org Delivered-To: alpine-aports@mail.alpinelinux.org Received: from mail.alpinelinux.org (dallas-a1.alpinelinux.org [127.0.0.1]) by mail.alpinelinux.org (Postfix) with ESMTP id EF3EADC0258 for ; Sun, 15 Nov 2015 12:40:03 +0000 (UTC) Received: from newmail.tetrasec.net (unknown [74.117.189.116]) by mail.alpinelinux.org (Postfix) with ESMTP id C346DDC00A8 for ; Sun, 15 Nov 2015 12:40:03 +0000 (UTC) Received: from ncopa-laptop (unknown [79.160.13.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: n@tanael.org) by newmail.tetrasec.net (Postfix) with ESMTPSA id ACB5A5A1362; Sun, 15 Nov 2015 12:29:25 +0000 (GMT) Date: Sun, 15 Nov 2015 13:39:48 +0100 From: Natanael Copa To: Stuart Cardall Cc: alpine-aports@lists.alpinelinux.org Subject: Re: [alpine-aports] [PATCH] main/openrc: fix hostname init for btrfs subvolumes Message-ID: <20151115133948.44f43146@ncopa-laptop> In-Reply-To: <1447551789-21436-1-git-send-email-developer@it-offshore.co.uk> References: <1447551789-21436-1-git-send-email-developer@it-offshore.co.uk> X-Mailer: Claws Mail 3.13.0 (GTK+ 2.24.28; x86_64-alpine-linux-musl) X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: ClamAV using ClamSMTP On Sun, 15 Nov 2015 01:43:09 +0000 Stuart Cardall wrote: > Busybox hostname doesn't seem to work on btrfs subvolumes (the hostname is set as "?") > > This shell oneliner sets the hostname as the first non blank line in /etc/hostname. > If /etc/hostname is empty or does not exist the hostname is set to localhost. Does it set hostname if its nonempty? Does it set hostname if its empty and filesystem is something else than btrfs? I wonder why this is specific for btrfs. > --- > main/openrc/hostname.initd | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/main/openrc/hostname.initd b/main/openrc/hostname.initd > index fdc7f0b..49098f4 100644 > --- a/main/openrc/hostname.initd > +++ b/main/openrc/hostname.initd > @@ -7,11 +7,7 @@ depend() { > } > > start() { > - if [ -f /etc/hostname ] ; then > - opts="-F /etc/hostname" > - else > - opts="localhost" > - fi > + opts="$(grep -v '^$' /etc/hostname)" 2>/dev/null || opts="localhost" > ebegin "Setting hostname" > hostname $opts > eend $? Why not: if [ -s /etc/hostname ]; then opts="-F /etc/hostname" else opts="localhost" fi -nc --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---