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 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. |
(...skipping 18 matching lines...) Expand all Loading... |
29 # Splash screen! | 29 # Splash screen! |
30 if [ -x /usr/bin/ply-image ] | 30 if [ -x /usr/bin/ply-image ] |
31 then | 31 then |
32 /usr/bin/ply-image /usr/share/chromeos-assets/images/login_splash.png & | 32 /usr/bin/ply-image /usr/share/chromeos-assets/images/login_splash.png & |
33 fi | 33 fi |
34 | 34 |
35 mount -n -t tmpfs tmp /tmp | 35 mount -n -t tmpfs tmp /tmp |
36 mount -n -t tmpfs -onosuid,nodev shmfs /dev/shm | 36 mount -n -t tmpfs -onosuid,nodev shmfs /dev/shm |
37 mount -n -t devpts -onoexec,nosuid,gid=5,mode=0620 devpts /dev/pts | 37 mount -n -t devpts -onoexec,nosuid,gid=5,mode=0620 devpts /dev/pts |
38 | 38 |
39 # Mount our stateful partition | 39 # Mount our stateful partition. It's always partition 1. |
40 ROOT_DEV=$(sed 's/.*root=\([^ ]*\).*/\1/g' /proc/cmdline) | 40 ROOT_DEV=$(rootdev) |
41 if [ "${ROOT_DEV#*=}" = "$ROOT_DEV" ] | 41 STATE_DEV=${ROOT_DEV%%[0-9]*}1 |
42 then | |
43 # We get here if $ROOT doesn't have an = in it. | |
44 | |
45 # Old installations have system partitions on partitions 1 and 2. They | |
46 # have the stateful partition on partition 4. New installations have | |
47 # partitions 3 and 4 as system partitions and partition 1 as the stateful | |
48 # partition. | |
49 STATE_DEV=$(echo "$ROOT_DEV" | tr 1234 4411) | |
50 else | |
51 # $ROOT has an = in it, so we assume it's LABEL= or UUID=. Follow that | |
52 # convention when specifying the stateful partition. | |
53 STATE_DEV="/dev/disk/by-label/C-STATE" | |
54 fi | |
55 mount -n -t ext3 "$STATE_DEV" /mnt/stateful_partition | 42 mount -n -t ext3 "$STATE_DEV" /mnt/stateful_partition |
56 | 43 |
57 # Make sure stateful partition has some basic directories | 44 # Make sure stateful partition has some basic directories |
58 mkdir -p -m 0755 /mnt/stateful_partition/var/cache | 45 mkdir -p -m 0755 /mnt/stateful_partition/var/cache |
59 mkdir -p -m 0755 /mnt/stateful_partition/var/log | 46 mkdir -p -m 0755 /mnt/stateful_partition/var/log |
60 mkdir -p -m 0755 /mnt/stateful_partition/home | 47 mkdir -p -m 0755 /mnt/stateful_partition/home |
61 mkdir -p -m 0755 /mnt/stateful_partition/etc | 48 mkdir -p -m 0755 /mnt/stateful_partition/etc |
62 chmod 0755 /mnt/stateful_partition/var | 49 chmod 0755 /mnt/stateful_partition/var |
63 | 50 |
64 # Default to Pacific timezone if we don't have one set | 51 # Default to Pacific timezone if we don't have one set |
(...skipping 27 matching lines...) Expand all Loading... |
92 (test -f "$SALT" || head -c 16 /dev/urandom > "$SALT") & | 79 (test -f "$SALT" || head -c 16 /dev/urandom > "$SALT") & |
93 | 80 |
94 # Write out uptime and disk stats pre/post startup | 81 # Write out uptime and disk stats pre/post startup |
95 cat /proc/uptime > /tmp/uptime-post-startup | 82 cat /proc/uptime > /tmp/uptime-post-startup |
96 ! cat /sys/block/sda/stat > /tmp/disk-post-startup | 83 ! cat /sys/block/sda/stat > /tmp/disk-post-startup |
97 echo "$PRE_UPTIME_STAT" > /tmp/uptime-pre-startup | 84 echo "$PRE_UPTIME_STAT" > /tmp/uptime-pre-startup |
98 echo "$PRE_DISK_STAT" > /tmp/disk-pre-startup | 85 echo "$PRE_DISK_STAT" > /tmp/disk-pre-startup |
99 | 86 |
100 # Always return success to avoid killing init | 87 # Always return success to avoid killing init |
101 exit 0 | 88 exit 0 |
OLD | NEW |