| OLD | NEW |
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 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 HAS_INITRAMFS=0 | 7 HAS_INITRAMFS=0 |
| 8 if [ -d /dev/.initramfs ] | 8 if [ -d /dev/.initramfs ] |
| 9 then | 9 then |
| 10 # The initrd will have mounted /sys, /proc, and /dev for us. | 10 # The initrd will have mounted /sys, /proc, and /dev for us. |
| 11 HAS_INITRAMFS=1 | 11 HAS_INITRAMFS=1 |
| 12 else | 12 else |
| 13 mount -n -t sysfs -onodev,noexec,nosuid sysfs /sys | 13 mount -n -t sysfs -onodev,noexec,nosuid sysfs /sys |
| 14 mount -n -t proc -onodev,noexec,nosuid proc /proc | 14 mount -n -t proc -onodev,noexec,nosuid proc /proc |
| 15 mount -n -t tmpfs -omode=0755 udev /dev | 15 mount -n -t tmpfs -omode=0755 udev /dev |
| 16 fi | 16 fi |
| 17 | 17 |
| 18 PRE_UPTIME_STAT=$(cat /proc/uptime) | 18 PRE_UPTIME_STAT=$(cat /proc/uptime) |
| 19 PRE_DISK_STAT=$(cat /sys/block/sda/stat) | 19 PRE_DISK_STAT=$(cat /sys/block/sda/stat) |
| 20 | 20 |
| 21 # Moblin trick: Disable blinking cursor. Without this a splash screen | |
| 22 # will show a distinct cursor shape even when the cursor is set to none. | |
| 23 echo 0 > /sys/devices/virtual/graphics/fbcon/cursor_blink | |
| 24 | |
| 25 # Since we defer udev until later in the boot process, we pre-populate /dev | 21 # Since we defer udev until later in the boot process, we pre-populate /dev |
| 26 # with the set of devices needed for X and other early services to run. | 22 # with the set of devices needed for X and other early services to run. |
| 27 cp -a -f /lib/chromiumos/devices/* /dev | 23 cp -a -f /lib/chromiumos/devices/* /dev |
| 28 | 24 |
| 29 # Splash screen! | 25 # Splash screen! Unless we are in noninteractive mode. |
| 30 if [ -x /usr/bin/ply-image ] | 26 # TODO(sosa@chromium.org) - Use kernel flag |
| 31 then | 27 if [ -x /usr/bin/ply-image ]; then |
| 32 /usr/bin/ply-image /usr/share/chromeos-assets/images/login_splash.png & | 28 if [ ! -f /root/.factory_test ] && [ ! -f /root/.factory_installer ]; then |
| 29 # Moblin trick: Disable blinking cursor. Without this a splash screen |
| 30 # will show a distinct cursor shape even when the cursor is set to none. |
| 31 echo 0 > /sys/devices/virtual/graphics/fbcon/cursor_blink |
| 32 |
| 33 /usr/bin/ply-image /usr/share/chromeos-assets/images/login_splash.png & |
| 34 fi |
| 33 fi | 35 fi |
| 34 | 36 |
| 35 mount -n -t tmpfs tmp /tmp | 37 mount -n -t tmpfs tmp /tmp |
| 36 mount -n -t tmpfs -onosuid,nodev shmfs /dev/shm | 38 mount -n -t tmpfs -onosuid,nodev shmfs /dev/shm |
| 37 mount -n -t devpts -onoexec,nosuid,gid=5,mode=0620 devpts /dev/pts | 39 mount -n -t devpts -onoexec,nosuid,gid=5,mode=0620 devpts /dev/pts |
| 38 | 40 |
| 39 # Mount our stateful partition. It's always partition 1. | 41 # Mount our stateful partition. It's always partition 1. |
| 40 ROOT_DEV=$(rootdev) | 42 ROOT_DEV=$(rootdev) |
| 41 STATE_DEV=${ROOT_DEV%[0-9]*}1 | 43 STATE_DEV=${ROOT_DEV%[0-9]*}1 |
| 42 mount -n -t ext3 "$STATE_DEV" /mnt/stateful_partition | 44 |
| 45 # For factory install shim, we never want to write to the SDCard. |
| 46 if [ -f /root/.factory_installer ]; then |
| 47 mount -n -t tmpfs tmp /mnt/stateful_partition |
| 48 else |
| 49 mount -n -t ext3 "$STATE_DEV" /mnt/stateful_partition |
| 50 fi |
| 43 | 51 |
| 44 # Check if the stateful partition has requested self-destruction | 52 # Check if the stateful partition has requested self-destruction |
| 45 # This is used for the factory install process | 53 # This is used for the factory install process |
| 46 RESET_FILE="/mnt/stateful_partition/factory_install_reset" | 54 RESET_FILE="/mnt/stateful_partition/factory_install_reset" |
| 47 if [ -f "$RESET_FILE" ]; then | 55 if [ -f "$RESET_FILE" ]; then |
| 48 if [ $(stat -c%u "$RESET_FILE") -eq 0 ]; then | 56 if [ $(stat -c%u "$RESET_FILE") -eq 0 ]; then |
| 49 echo "Erasing stateful partition..." | 57 echo "Erasing stateful partition..." |
| 50 exec /sbin/clobber-state | 58 exec /sbin/clobber-state |
| 51 fi | 59 fi |
| 52 fi | 60 fi |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 (test -f "$SALT" || head -c 16 /dev/urandom > "$SALT") & | 117 (test -f "$SALT" || head -c 16 /dev/urandom > "$SALT") & |
| 110 | 118 |
| 111 # Write out uptime and disk stats pre/post startup | 119 # Write out uptime and disk stats pre/post startup |
| 112 cat /proc/uptime > /tmp/uptime-post-startup | 120 cat /proc/uptime > /tmp/uptime-post-startup |
| 113 ! cat /sys/block/sda/stat > /tmp/disk-post-startup | 121 ! cat /sys/block/sda/stat > /tmp/disk-post-startup |
| 114 echo "$PRE_UPTIME_STAT" > /tmp/uptime-pre-startup | 122 echo "$PRE_UPTIME_STAT" > /tmp/uptime-pre-startup |
| 115 echo "$PRE_DISK_STAT" > /tmp/disk-pre-startup | 123 echo "$PRE_DISK_STAT" > /tmp/disk-pre-startup |
| 116 | 124 |
| 117 # Always return success to avoid killing init | 125 # Always return success to avoid killing init |
| 118 exit 0 | 126 exit 0 |
| OLD | NEW |