From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 32C7A1384B4 for ; Tue, 8 Dec 2015 18:44:05 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5B36B21C021; Tue, 8 Dec 2015 18:44:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id DD2DE21C021 for ; Tue, 8 Dec 2015 18:44:01 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 44E9734086E for ; Tue, 8 Dec 2015 18:44:00 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C93C9CAF for ; Tue, 8 Dec 2015 18:43:57 +0000 (UTC) From: "William Hubbs" 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" Message-ID: <1449598173.9f6e05671d6d48faa7b83aec05a637bcdfcb3f82.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: src/librc/, src/rc/ X-VCS-Repository: proj/openrc X-VCS-Files: src/librc/librc-depend.c src/rc/_usage.c src/rc/rc-misc.c src/rc/rc.c X-VCS-Directories: src/librc/ src/rc/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: 9f6e05671d6d48faa7b83aec05a637bcdfcb3f82 X-VCS-Branch: master Date: Tue, 8 Dec 2015 18:43:57 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 001852a0-1a94-4bb4-90c0-558f8b2b6ed3 X-Archives-Hash: cd79d37d3f366020d9d139ab95f72377 commit: 9f6e05671d6d48faa7b83aec05a637bcdfcb3f82 Author: William Hubbs gmail com> AuthorDate: Mon Dec 7 23:56:02 2015 +0000 Commit: William Hubbs gentoo org> CommitDate: Tue Dec 8 18:09:33 2015 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=9f6e0567 Convert rc_sys() calls to detect_container() and detect_vm() src/librc/librc-depend.c | 5 ++++- src/rc/_usage.c | 5 ++++- src/rc/rc-misc.c | 6 ++++-- src/rc/rc.c | 20 ++++++++++++++++---- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/librc/librc-depend.c b/src/librc/librc-depend.c index c9c06ad..14cf297 100644 --- a/src/librc/librc-depend.c +++ b/src/librc/librc-depend.c @@ -753,7 +753,7 @@ rc_deptree_update(void) char *depend, *depends, *service, *type, *nosys, *onosys; size_t i, k, l; bool retval = true; - const char *sys = rc_sys(); + const char *sys = NULL; struct utsname uts; /* Some init scripts need RC_LIBEXECDIR to source stuff @@ -860,6 +860,9 @@ rc_deptree_update(void) /* Phase 2 - if we're a special system, remove services that don't * work for them. This doesn't stop them from being run directly. */ + sys = detect_container(); + if (!sys) + sys = detect_vm(); if (sys) { len = strlen(sys); nosys = xmalloc(len + 2); diff --git a/src/rc/_usage.c b/src/rc/_usage.c index 2ab0fa6..a6bad4d 100644 --- a/src/rc/_usage.c +++ b/src/rc/_usage.c @@ -56,7 +56,10 @@ show_version(void) const char *systype = NULL; printf("%s (OpenRC", applet); - if ((systype = rc_sys())) + systype = detect_container(); + if (!systype) + systype = detect_vm(); + if (systype) printf(" [%s]", systype); printf(") %s", VERSION); #ifdef BRANDING diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c index 1e2af0a..263c0ed 100644 --- a/src/rc/rc-misc.c +++ b/src/rc/rc-misc.c @@ -139,7 +139,7 @@ env_config(void) char *np; char *npp; char *tok; - const char *sys = rc_sys(); + const char *sys = NULL; char buffer[PATH_MAX]; /* Ensure our PATH is prefixed with the system locations first @@ -190,7 +190,9 @@ env_config(void) } else setenv("RC_DEFAULTLEVEL", RC_LEVEL_DEFAULT, 1); - if (sys) + sys = detect_container(); + if (!sys) + sys = detect_vm(); setenv("RC_SYS", sys, 1); #ifdef PREFIX diff --git a/src/rc/rc.c b/src/rc/rc.c index 8f69333..ddc3c78 100644 --- a/src/rc/rc.c +++ b/src/rc/rc.c @@ -274,7 +274,11 @@ open_shell(void) struct passwd *pw; #ifdef __linux__ - const char *sys = rc_sys(); + const char *sys = NULL; + + sys = detect_container(); + if (!sys) + sys = detect_vm(); /* VSERVER and OPENVZ systems cannot really drop to shells */ if (sys && @@ -480,7 +484,10 @@ do_sysinit() uts.machine); #endif - if ((sys = rc_sys())) + sys = detect_container(); + if (!sys) + sys = detect_vm(); + if (sys) printf(" [%s]", sys); printf("%s\n\n", ecolor(ECOLOR_NORMAL)); @@ -495,7 +502,10 @@ do_sysinit() /* init may have mounted /proc so we can now detect or real * sys */ - if ((sys = rc_sys())) + sys = detect_container(); + if (!sys) + sys = detect_vm(); + if (sys) setenv("RC_SYS", sys, 1); } @@ -846,7 +856,9 @@ main(int argc, char **argv) eerrorx("%s: %s", applet, strerror(errno)); /* NOTREACHED */ case 'S': - systype = rc_sys(); + systype = detect_container(); + if (!systype) + systype = detect_vm(); if (systype) printf("%s\n", systype); exit(EXIT_SUCCESS);