create consent file for official builds
Once we get /etc/send_metrics in place on official builds, this change will notice and auto-create the consent file for metrics if it doesn't exist.
BUG=cros:1865
TEST=boot chromium os without /etc/send_metrics, see that no consent file is created. create /etc/send_metrics and reboot...the consent file should now be present.
Review URL: http://codereview.chromium.org/1110003
diff --git a/session_manager_setup.sh b/session_manager_setup.sh
index 9c8dbc6..2a39d95 100644
--- a/session_manager_setup.sh
+++ b/session_manager_setup.sh
@@ -67,6 +67,8 @@
CHROME_DIR="/opt/google/chrome"
CHROME="$CHROME_DIR/chrome"
COOKIE_PIPE="/tmp/cookie_pipe"
+SEND_METRICS="/etc/send_metrics"
+CONSENT_FILE="$DATA_DIR/Consent To Send Stats"
# xdg-open is used to open downloaded files.
# It runs sensible-browser, which uses $BROWSER.
@@ -94,6 +96,15 @@
/proc/sys/kernel/core_pattern
fi
+if [ -f "$SEND_METRICS" ]; then
+ if [ ! -f "$CONSENT_FILE" ]; then
+ # Automatically opt-in to Chrome OS stats collecting. This does
+ # not have to be a cryptographically random string, but we do need
+ # a 32 byte, printable string.
+ head -c 8 /dev/random | openssl md5 > "$CONSENT_FILE"
+ fi
+fi
+
while [ -z ${SERVER_READY} ]; do
sleep .1
done