1#! /system/bin/sh 2 3# This is primarily meant to be used by logpersist. This script is run as an init service, which 4# first reads the 'last' logcat to persistent storage with `-L` then run logcat again without 5# `-L` to read the current logcat buffers to persistent storage. 6 7# init sets the umask to 077 for forked processes. logpersist needs to create files that are group 8# readable. So relax the umask to only disallow group wx and world rwx. 9umask 037 10 11has_last="false" 12for arg in "$@"; do 13 if [ "$arg" == "-L" -o "$arg" == "--last" ]; then 14 has_last="true" 15 fi 16done 17 18if [ "$has_last" == "true" ]; then 19 logcat "$@" 20fi 21 22args_without_last=() 23for arg in "$@"; do 24 if [ "$arg" != "-L" -a "$arg" != "--last" ]; then 25 ARGS+=("$arg") 26 fi 27done 28 29exec logcat "${ARGS[@]}" 30