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 6E3C01386F2 for ; Mon, 10 Aug 2015 23:51:42 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C83881430C; Mon, 10 Aug 2015 23:51:40 +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 6B9831430C for ; Mon, 10 Aug 2015 23:51:40 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 4E8BF340B34 for ; Mon, 10 Aug 2015 23:51:39 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 6524511B for ; Mon, 10 Aug 2015 23:51:37 +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: <1439218275.c256a7aa80c683eca6194c80b57294e4d51c9a16.williamh@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: init.d/ X-VCS-Repository: proj/openrc X-VCS-Files: init.d/savecache.in X-VCS-Directories: init.d/ X-VCS-Committer: williamh X-VCS-Committer-Name: William Hubbs X-VCS-Revision: c256a7aa80c683eca6194c80b57294e4d51c9a16 X-VCS-Branch: master Date: Mon, 10 Aug 2015 23:51:37 +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: 2360f41e-e866-4177-9194-69728562439e X-Archives-Hash: 51a92d4fafeeb71db17df26ddda65e59 commit: c256a7aa80c683eca6194c80b57294e4d51c9a16 Author: Doug Freed mtu edu> AuthorDate: Mon Aug 10 14:11:27 2015 +0000 Commit: William Hubbs gentoo org> CommitDate: Mon Aug 10 14:51:15 2015 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=c256a7aa savecache: clean up implementation X-Gentoo-Bug: 557222 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=557222 init.d/savecache.in | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/init.d/savecache.in b/init.d/savecache.in index e185e5a..5ec1028 100644 --- a/init.d/savecache.in +++ b/init.d/savecache.in @@ -7,43 +7,53 @@ description="Saves the caches OpenRC uses to non volatile storage" start() { if [ -e "$RC_SVCDIR"/clock-skewed ]; then - ewarn "WARNING: clock skew detected!" + ewarn "Clock skew detected!" if ! yesno "${RC_GOINGDOWN}"; then eerror "Not saving deptree cache" return 1 fi fi - if ! checkpath -W "$RC_LIBEXECDIR"; then - ewarn "WARNING: ${RC_LIBEXECDIR} is not writable!" - if ! yesno "${RC_GOINGDOWN}"; then - ewarn "Unable to save deptree cache" + if [ ! -d "$RC_LIBEXECDIR"/cache ]; then + if ! checkpath -W "$RC_LIBEXECDIR"; then + eerror "${RC_LIBEXECDIR} is not writable!" + eerror "Unable to save dependency cache" + if yesno "${RC_GOINGDOWN}"; then + return 0 + fi return 1 fi - return 0 - fi - ebegin "Saving dependency cache" - local rc= - if [ ! -d "$RC_LIBEXECDIR"/cache ]; then rm -rf "$RC_LIBEXECDIR"/cache if ! mkdir -p "$RC_LIBEXECDIR"/cache; then - rc=$? + eerror "Unable to create $RC_LIBEXECDIR/cache" + eerror "Unable to save dependency cache" if yesno "${RC_GOINGDOWN}"; then - rc=0 + return 0 fi - eend $rc "Unable to create $RC_LIBEXECDIR/cache" - return $rc + return 1 + fi + fi + if ! checkpath -W "$RC_LIBEXECDIR"/cache; then + eerror "${RC_LIBEXECDIR}/cache is not writable!" + eerror "Unable to save dependency cache" + if yesno "${RC_GOINGDOWN}"; then + return 0 fi + return 1 fi - local save= + ebegin "Saving dependency cache" + local rc=0 save= for x in deptree depconfig shutdowntime softlevel nettree rc.log; do [ -e "$RC_SVCDIR/$x" ] && save="$save $RC_SVCDIR/$x" done if [ -n "$save" ]; then - cp -p $save "$RC_LIBEXECDIR"/cache 2>/dev/null + cp -p $save "$RC_LIBEXECDIR"/cache + rc=$? fi - rc=$? if yesno "${RC_GOINGDOWN}"; then - rc=0 + if [ $rc -ne 0 ]; then + eerror "Unable to save dependency cache" + fi + eend 0 fi - eend $rc + eend $rc "Unable to save dependency cache" }