From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-917738-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id CBA90139085
	for <garchives@archives.gentoo.org>; Sun, 18 Dec 2016 17:22:53 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id EC00721C028;
	Sun, 18 Dec 2016 17:22:51 +0000 (UTC)
Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id BF79621C028
	for <gentoo-commits@lists.gentoo.org>; Sun, 18 Dec 2016 17:22:51 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 6D32A341701
	for <gentoo-commits@lists.gentoo.org>; Sun, 18 Dec 2016 17:22:50 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 4C3684A9
	for <gentoo-commits@lists.gentoo.org>; Sun, 18 Dec 2016 17:22:48 +0000 (UTC)
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" <williamh@gentoo.org>
Message-ID: <1482017257.856eafb006655b7dda630a94cbd16f5db9f781be.williamh@OpenRC>
Subject: [gentoo-commits] proj/openrc:master commit in: sh/
X-VCS-Repository: proj/openrc
X-VCS-Files: sh/init.sh.Linux.in
X-VCS-Directories: sh/
X-VCS-Committer: williamh
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: 856eafb006655b7dda630a94cbd16f5db9f781be
X-VCS-Branch: master
Date: Sun, 18 Dec 2016 17:22:48 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: b81ef040-0c50-460b-8019-25548934d45e
X-Archives-Hash: 7a3276717aadd84859539043e7d12a09

commit:     856eafb006655b7dda630a94cbd16f5db9f781be
Author:     Doug Freed <dwfreed <AT> mtu <DOT> edu>
AuthorDate: Sat Dec 17 19:59:45 2016 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Dec 17 23:27:37 2016 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=856eafb0

sh/init.sh.Linux.in: skip /proc test if no md5sum

This will also warn users if md5sum is missing, which serves as a pretty
good indicator that /usr is not mounted.

 sh/init.sh.Linux.in | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index fcae0d2..96555d2 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -11,6 +11,16 @@ if [ -d "@SYSCONFDIR@/rc.conf.d" ]; then
 	done
 fi
 
+# check for md5sum, and probably /usr too
+if command -v md5sum >/dev/null; then
+	got_md5sum=true
+else
+	eerror "md5sum is missing, which suggests /usr is not mounted"
+	eerror "If you have separate /usr, it must be mounted by initramfs"
+	eerror "If not, you should check coreutils is installed correctly"
+	got_md5sum=false
+fi
+
 # By default VServer already has /proc mounted, but OpenVZ does not!
 # However, some of our users have an old proc image in /proc
 # NFC how they managed that, but the end result means we have to test if
@@ -21,9 +31,12 @@ fi
 mountproc=true
 f=/proc/self/environ
 if [ -e $f ]; then
-	if [ "$(VAR=a md5sum $f)" = "$(VAR=b md5sum $f)" ]; then
+	if $got_md5sum && [ "$(VAR=a md5sum $f)" = "$(VAR=b md5sum $f)" ]; then
 		eerror "You have cruft in /proc that should be deleted"
 	else
+		# If they don't have md5sum, this will fail in pretty ways if
+		# /proc isn't really mounted.  Oh well, their system is busted
+		# anyway, and they get to keep the pieces.
 		einfo "/proc is already mounted"
 		mountproc=false
 	fi