2008-11-03 15:31:01 +00:00
|
|
|
#!@PREFIX@/sbin/runscript
|
2009-05-01 15:11:40 +01:00
|
|
|
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
2008-11-03 15:31:01 +00:00
|
|
|
# All rights reserved. Released under the 2-clause BSD license.
|
|
|
|
|
|
|
|
description="Saves the caches OpenRC uses to non volatile storage"
|
|
|
|
|
|
|
|
start()
|
|
|
|
{
|
2009-04-27 07:51:18 +00:00
|
|
|
if [ -e "$RC_SVCDIR"/clock-skewed ]; then
|
2009-01-12 23:53:13 +00:00
|
|
|
ewarn "WARNING: clock skew detected!"
|
|
|
|
if ! yesno "savecache_skewed"; then
|
|
|
|
eerror "Not saving deptree cache"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
2008-11-03 15:31:01 +00:00
|
|
|
ebegin "Saving dependency cache"
|
2009-05-23 20:38:12 +01:00
|
|
|
if [ ! -d "$RC_LIBEXECDIR"/cache ]; then
|
|
|
|
rm -rf "$RC_LIBEXECDIR"/cache
|
|
|
|
if ! mkdir "$RC_LIBEXECDIR"/cache; then
|
2008-11-03 15:31:01 +00:00
|
|
|
eend $?
|
|
|
|
return $?
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
local save=
|
2009-10-13 08:03:45 +01:00
|
|
|
for x in deptree depconfig shutdowntime softlevel nettree rc.log; do
|
2009-04-27 07:51:18 +00:00
|
|
|
[ -e "$RC_SVCDIR/$x" ] && save="$save $RC_SVCDIR/$x"
|
2008-11-03 15:31:01 +00:00
|
|
|
done
|
2009-04-27 07:51:18 +00:00
|
|
|
if [ -n "$save" ]; then
|
2009-05-23 20:38:12 +01:00
|
|
|
cp -p $save "$RC_LIBEXECDIR"/cache 2>/dev/null
|
2008-11-03 15:31:01 +00:00
|
|
|
fi
|
|
|
|
eend $?
|
|
|
|
}
|