2008-11-03 21:01:01 +05:30
|
|
|
#!@PREFIX@/sbin/runscript
|
2009-05-01 19:41:40 +05:30
|
|
|
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
|
2008-11-03 21:01:01 +05:30
|
|
|
# All rights reserved. Released under the 2-clause BSD license.
|
|
|
|
|
|
|
|
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!"
|
|
|
|
if ! yesno "savecache_skewed"; then
|
|
|
|
eerror "Not saving deptree cache"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
2008-11-03 21:01:01 +05:30
|
|
|
ebegin "Saving dependency cache"
|
2009-04-27 13:21:18 +05:30
|
|
|
if [ ! -d "$RC_LIBDIR"/cache ]; then
|
|
|
|
rm -rf "$RC_LIBDIR"/cache
|
|
|
|
if ! mkdir "$RC_LIBDIR"/cache; then
|
2008-11-03 21:01:01 +05:30
|
|
|
eend $?
|
|
|
|
return $?
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
local save=
|
|
|
|
for x in deptree depconfig 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
|
|
|
|
cp -p $save "$RC_LIBDIR"/cache 2>/dev/null
|
2008-11-03 21:01:01 +05:30
|
|
|
fi
|
|
|
|
eend $?
|
|
|
|
}
|