From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-951572-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 80A8A139694
	for <garchives@archives.gentoo.org>; Mon, 22 May 2017 17:54:14 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 93AFFE0C39;
	Mon, 22 May 2017 17:54:13 +0000 (UTC)
Received: from smtp.gentoo.org (dev.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 7277DE0C39
	for <gentoo-commits@lists.gentoo.org>; Mon, 22 May 2017 17:54:13 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 6CEAB34171F
	for <gentoo-commits@lists.gentoo.org>; Mon, 22 May 2017 17:54:12 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 04C497454
	for <gentoo-commits@lists.gentoo.org>; Mon, 22 May 2017 17:54:11 +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: <1495473315.0cfd0dd9ef580ed9dc563ccc164d70efe8f299db.williamh@OpenRC>
Subject: [gentoo-commits] proj/openrc:master commit in: man/, src/rc/
X-VCS-Repository: proj/openrc
X-VCS-Files: man/openrc-shutdown.8 src/rc/openrc-shutdown.c
X-VCS-Directories: src/rc/ man/
X-VCS-Committer: williamh
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: 0cfd0dd9ef580ed9dc563ccc164d70efe8f299db
X-VCS-Branch: master
Date: Mon, 22 May 2017 17:54:11 +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: c1d59047-888b-4c7a-b07a-da371aaae965
X-Archives-Hash: b05d0c643287bceeb5e65f58821f13ab

commit:     0cfd0dd9ef580ed9dc563ccc164d70efe8f299db
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon May 22 17:15:15 2017 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon May 22 17:15:15 2017 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=0cfd0dd9

openrc-shutdown: move to single user mode by default

To be more compatible with sysvinit, move to single user mode if no
options are specified on the command line.

 man/openrc-shutdown.8    | 5 ++++-
 src/rc/openrc-shutdown.c | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/man/openrc-shutdown.8 b/man/openrc-shutdown.8
index eae16ae8..d0e95e24 100644
--- a/man/openrc-shutdown.8
+++ b/man/openrc-shutdown.8
@@ -8,7 +8,7 @@
 .\" This file may not be copied, modified, propagated, or distributed
 .\"    except according to the terms contained in the LICENSE file.
 .\"
-.Dd April 6, 2017
+.Dd May 22, 2017
 .Dt openrc-shutdown 8 SMM
 .Os OpenRC
 .Sh NAME
@@ -40,6 +40,9 @@ upgrade of OpenRC if you are using openrc-init as your init process.
 .It Fl r , -reboot
 Stop all services, kill all processes and reboot the system.
 .El
+.Pp
+If none of these options are given, the default is to move the system
+into single user mode.
 .Sh SEE ALSO
 .Xr openrc-init 8 ,
 .Xr kexec 8 ,

diff --git a/src/rc/openrc-shutdown.c b/src/rc/openrc-shutdown.c
index 8905d354..0ed77445 100644
--- a/src/rc/openrc-shutdown.c
+++ b/src/rc/openrc-shutdown.c
@@ -114,7 +114,7 @@ if (geteuid() != 0)
 		case_RC_COMMON_GETOPT
 		}
 	}
-	if (cmd_count != 1) {
+	if (cmd_count > 1) {
 		eerror("%s: %s\n", applet, exclusive);
 		usage(EXIT_FAILURE);
 	}
@@ -128,5 +128,7 @@ if (geteuid() != 0)
 		send_cmd("reboot");
 	else if (do_reexec)
 		send_cmd("reexec");
+	else
+		send_cmd("single");
 	return 0;
 }