]> code.ossystems Code Review - openembedded-core.git/commitdiff
populate-volatile.sh: add "clearcache" cmdline option
authorKevin Tian <kevin.tian@intel.com>
Mon, 21 Jun 2010 09:28:57 +0000 (17:28 +0800)
committerKevin Tian <kevin.tian@intel.com>
Fri, 2 Jul 2010 09:27:10 +0000 (17:27 +0800)
Sometimes /etc/volatiles.cache is corrupted when Qemu gets crashed. Current logic
is to always execute cache file as long as it exists. When it's currupted, this
causes core volatile files/directories not created and then prevent many important
services from starting. Automatic check on cache goodness is one option. However
it's not easy since the currupted file could be various states. In one form,
it's full of zeros. In another form, some commands are truncated.

Here allow a cmdline option to force removing volatiles.cache file, since it's
easy for user to check whether the cache file is mal-formed. Usually you'll observe
typical directories like "/var/log/" or "/var/run" not found error.

Signed-off-by Kevin Tian <kevin.tian@intel.com>

meta/packages/initscripts/initscripts-1.0/populate-volatile.sh
meta/packages/initscripts/initscripts_1.0.bb

index 8742dbfc6b67e7cd38276f7d8869d9fbec8218fc..1813fd12402573bfa628520588c34fdc919e4990 100755 (executable)
@@ -168,7 +168,20 @@ apply_cfgfile() {
 
   }
 
-if test -e /etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "xupdate"
+clearcache=0
+exec 9</proc/cmdline
+while read line <&9
+do
+       case "$line" in
+               *clearcache*)  clearcache=1
+                              ;;
+               *)             continue
+                              ;;
+       esac
+done
+exec 9>&-
+
+if test -e /etc/volatile.cache -a "$VOLATILE_ENABLE_CACHE" = "yes" -a "x$1" != "xupdate" -a "x$clearcache" = "x0"
 then
        sh /etc/volatile.cache
 else   
index 20503e1c6abd2e48a7d62ec5216c168b0e9b26f7..0d79b53a8c714b3187277c2e7bbb9008bd7d7ad5 100644 (file)
@@ -4,7 +4,7 @@ PRIORITY = "required"
 DEPENDS = "makedevs"
 RDEPENDS = "makedevs"
 LICENSE = "GPLv2"
-PR = "r121"
+PR = "r122"
 
 SRC_URI = "file://functions \
            file://halt \