OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Called on startup as part of the init scripts. This calls forks off | 7 # Called on startup as part of the init scripts. This calls forks off |
8 # a task which will wait some time and then check for an update. | 8 # a task which will wait some time and then check for an update. |
9 | 9 |
10 # Exit immediately if it's a dev machine | 10 # Exit immediately if it's a dev machine |
11 DEVKIT_URL=$(grep ^CHROMEOS_DEVSERVER /etc/lsb-release | cut -d = -f 2-) | 11 DEVKIT_URL=$(grep ^CHROMEOS_DEVSERVER /etc/lsb-release | cut -d = -f 2-) |
12 if [ -n "$DEVKIT_URL" ]; then | 12 if [ -n "$DEVKIT_URL" ]; then |
13 exit 0 | 13 exit 0 |
14 fi | 14 fi |
15 | 15 |
| 16 # Exit immediately if it's a factory install machine |
| 17 FACTORY_INSTALL=$(grep ^FACTORY_INSTALL= /etc/lsb-release | cut -d = -f 2-) |
| 18 if [ -n "$FACTORY_INSTALL" ]; then |
| 19 exit 0 |
| 20 fi |
| 21 |
16 if [ -z "$1" ]; then | 22 if [ -z "$1" ]; then |
17 SLEEP_TIME=1800 # seconds; 30 min | 23 SLEEP_TIME=1800 # seconds; 30 min |
18 else | 24 else |
19 SLEEP_TIME="$1" | 25 SLEEP_TIME="$1" |
20 fi | 26 fi |
21 | 27 |
22 # Boot after 2 min, then try every 30 min | 28 # Boot after 2 min, then try every 30 min |
23 sleep 120 # seconds | 29 sleep 120 # seconds |
24 # Once at startup, if log file is too big, move it aside | 30 # Once at startup, if log file is too big, move it aside |
25 LOG_FILE=/var/log/softwareupdate.log | 31 LOG_FILE=/var/log/softwareupdate.log |
26 if [ $(stat -c%s "$LOG_FILE") -gt "5242880" ]; then # 5MB | 32 if [ $(stat -c%s "$LOG_FILE") -gt "5242880" ]; then # 5MB |
27 mv "$LOG_FILE" "$LOG_FILE".0 | 33 mv "$LOG_FILE" "$LOG_FILE".0 |
28 fi | 34 fi |
29 while [ true ]; do | 35 while [ true ]; do |
30 /opt/google/memento_updater/memento_updater.sh | 36 /opt/google/memento_updater/memento_updater.sh |
31 sleep "$SLEEP_TIME" | 37 sleep "$SLEEP_TIME" |
32 done | 38 done |
OLD | NEW |