2013-02-13 03:39:50 +05:30
|
|
|
#!@SBINDIR@/runscript
|
2009-05-01 19:41:40 +05:30
|
|
|
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
2011-06-30 05:16:31 +05:30
|
|
|
# Released under the 2-clause BSD license.
|
2008-11-03 21:01:01 +05:30
|
|
|
|
|
|
|
description="Saves the caches OpenRC uses to non volatile storage"
|
|
|
|
|
|
|
|
start()
|
|
|
|
{
|
2009-04-27 13:21:18 +05:30
|
|
|
if [ -e "$RC_SVCDIR"/clock-skewed ]; then
|
2009-01-13 05:23:13 +05:30
|
|
|
ewarn "WARNING: clock skew detected!"
|
2011-03-06 23:20:06 +05:30
|
|
|
if ! yesno "${RC_GOINGDOWN}"; then
|
2009-01-13 05:23:13 +05:30
|
|
|
eerror "Not saving deptree cache"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
2012-09-08 05:48:51 +05:30
|
|
|
if ! checkpath -W "$RC_LIBEXECDIR"; then
|
|
|
|
ewarn "WARNING: ${RC_LIBEXECDIR} is not writable!"
|
|
|
|
if ! yesno "${RC_GOINGDOWN}"; then
|
|
|
|
ewarn "Unable to save deptree cache"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
fi
|
2008-11-03 21:01:01 +05:30
|
|
|
ebegin "Saving dependency cache"
|
2011-03-06 23:20:06 +05:30
|
|
|
local rc=
|
2009-05-24 01:08:12 +05:30
|
|
|
if [ ! -d "$RC_LIBEXECDIR"/cache ]; then
|
|
|
|
rm -rf "$RC_LIBEXECDIR"/cache
|
|
|
|
if ! mkdir "$RC_LIBEXECDIR"/cache; then
|
2011-03-06 23:20:06 +05:30
|
|
|
rc=$?
|
|
|
|
if yesno "${RC_GOINGDOWN}"; then
|
|
|
|
rc=0
|
|
|
|
fi
|
|
|
|
eend $rc
|
|
|
|
return $rc
|
2008-11-03 21:01:01 +05:30
|
|
|
fi
|
|
|
|
fi
|
|
|
|
local save=
|
2009-10-13 12:33:45 +05:30
|
|
|
for x in deptree depconfig shutdowntime softlevel nettree rc.log; do
|
2009-04-27 13:21:18 +05:30
|
|
|
[ -e "$RC_SVCDIR/$x" ] && save="$save $RC_SVCDIR/$x"
|
2008-11-03 21:01:01 +05:30
|
|
|
done
|
2009-04-27 13:21:18 +05:30
|
|
|
if [ -n "$save" ]; then
|
2009-05-24 01:08:12 +05:30
|
|
|
cp -p $save "$RC_LIBEXECDIR"/cache 2>/dev/null
|
2008-11-03 21:01:01 +05:30
|
|
|
fi
|
2011-03-06 23:20:06 +05:30
|
|
|
rc=$?
|
|
|
|
if yesno "${RC_GOINGDOWN}"; then
|
|
|
|
rc=0
|
|
|
|
fi
|
|
|
|
eend $rc
|
2008-11-03 21:01:01 +05:30
|
|
|
}
|