Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: src/scripts/customize_rootfs.sh

Issue 500014: Modify customize_rootfs.sh to run outside of the target rootfs and to use (Closed)
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/scripts/build_image.sh ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/sh 1 #!/bin/bash
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 # Customizes the root file system of a chromium-based os. 7 # Script to customize the root file system after packages have been installed.
8 #
8 # NOTE: This script should be called by build_image.sh. Do not run this 9 # NOTE: This script should be called by build_image.sh. Do not run this
9 # on your own unless you know what you are doing. 10 # on your own unless you know what you are doing.
10 11
12 # Load common constants. This should be the first executable line.
13 # The path to common.sh should be relative to your script's location.
14 . "$(dirname "$0")/common.sh"
15
16 # Script must be run inside the chroot
17 assert_inside_chroot
18
19 # Flags
20 DEFINE_string target "x86" \
21 "The target architecture to build for. One of { x86, arm }."
22 DEFINE_string root "" \
23 "The root file system to customize."
24
25 # Parse command line
26 FLAGS "$@" || exit 1
27 eval set -- "${FLAGS_ARGV}"
28
29 # Die on any errors.
11 set -e 30 set -e
12 31
13 SETUP_DIR=$(dirname $0) 32 ROOT_FS_DIR="$FLAGS_root"
33 if [[ -z "$ROOT_FS_DIR" ]]; then
34 echo "Error: --root is required."
35 exit 1
36 fi
37 if [[ ! -d "$ROOT_FS_DIR" ]]; then
38 echo "Error: Root FS does not exist? ($ROOT_FS_DIR)"
39 exit 1
40 fi
14 41
15 # Read options from the config file created by build_image.sh. 42 # Determine default user full username.
16 echo "Reading options..."
17 cat "${SETUP_DIR}/customize_opts.sh"
18 . "${SETUP_DIR}/customize_opts.sh"
19
20 if [ ${CHROMEOS_OFFICIAL:-0} = 1 ]; then 43 if [ ${CHROMEOS_OFFICIAL:-0} = 1 ]; then
21 FULLNAME="Google Chrome OS User" 44 FULLNAME="Google Chrome OS User"
22 else 45 else
23 FULLNAME="Chromium OS User" 46 FULLNAME="Chromium OS User"
24 fi 47 fi
25 USERNAME="chronos"
26 ADMIN_GROUP="admin"
27 DEFGROUPS="adm,dialout,cdrom,floppy,audio,dip,video"
28 ADMIN_USERNAME="chronosdev"
29 48
30 CRYPTED_PASSWD_FILE="/trunk/src/scripts/shared_user_passwd.txt" 49 # Determine what password to use for the default user.
50 CRYPTED_PASSWD_FILE="${SCRIPTS_DIR}/shared_user_passwd.txt"
31 if [ -f $CRYPTED_PASSWD_FILE ]; then 51 if [ -f $CRYPTED_PASSWD_FILE ]; then
32 echo "Using password from $CRYPTED_PASSWD_FILE" 52 echo "Using password from $CRYPTED_PASSWD_FILE"
33 CRYPTED_PASSWD=$(cat $CRYPTED_PASSWD_FILE) 53 CRYPTED_PASSWD=$(cat $CRYPTED_PASSWD_FILE)
34 else 54 else
35 # Use a random password. unix_md5_crypt will generate a random salt. 55 # Use a random password. unix_md5_crypt will generate a random salt.
36 echo "Using random password." 56 echo "Using random password."
37 PASSWORD="$(base64 /dev/urandom | head -1)" 57 PASSWORD="$(base64 /dev/urandom | head -1)"
38 CRYPTED_PASSWD="$(echo "$PASSWORD" | openssl passwd -1 -stdin)" 58 CRYPTED_PASSWD="$(echo "$PASSWORD" | openssl passwd -1 -stdin)"
39 PASSWORD="gone now" 59 PASSWORD="gone now"
40 fi 60 fi
41 61
62 # Set up a default user and add to sudo and the required groups.
63 USERNAME="chronos"
64 SHELL="/bin/sh"
65 if [[ -x "${ROOT_FS_DIR}/bin/bash" ]] ; then
66 SHELL="/bin/bash"
67 fi
68 echo "${USERNAME}:x:1000:1000:${FULLNAME}:/home/${USERNAME}/:${SHELL}" | \
69 sudo dd of="${ROOT_FS_DIR}/etc/passwd" conv=notrunc oflag=append
70 echo "${USERNAME}:${CRYPTED_PASSWD}:14500:0:99999::::" | \
71 sudo dd of="${ROOT_FS_DIR}/etc/shadow" conv=notrunc oflag=append
72 echo "${USERNAME}:x:1000:" | \
73 sudo dd of="${ROOT_FS_DIR}/etc/group" conv=notrunc oflag=append
74 # TODO: Add USERNAME to adm,dialout,cdrom,floppy,audio,dip,video groups?
75 sudo mkdir -p "${ROOT_FS_DIR}/home/${USERNAME}"
76 sudo chown 1000.1000 "${ROOT_FS_DIR}/home/${USERNAME}"
77 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/sudoers" conv=notrunc oflag=append
78 %adm ALL=(ALL) ALL
79 $USERNAME ALL=(ALL) ALL
80 EOF
81 sudo chmod 0440 "${ROOT_FS_DIR}/etc/sudoers"
82
42 # Set CHROMEOS_VERSION_DESCRIPTION here (uses vars set in chromeos_version.sh) 83 # Set CHROMEOS_VERSION_DESCRIPTION here (uses vars set in chromeos_version.sh)
43 # Was removed from chromeos_version.sh which can also be run outside of chroot 84 # Was removed from chromeos_version.sh which can also be run outside of chroot
44 # where CHROMEOS_REVISION is set 85 # where CHROMEOS_REVISION is set
45 # We have to set (in build_image.sh) and use REAL_USER due to many nested 86 # We have to set (in build_image.sh) and use REAL_USER due to many nested
46 # chroots which lose $USER state. 87 # chroots which lose $USER state.
88 . "${SCRIPTS_DIR}/chromeos_version.sh"
47 if [ ${CHROMEOS_OFFICIAL:-0} = 1 ]; then 89 if [ ${CHROMEOS_OFFICIAL:-0} = 1 ]; then
48 export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Official Buil d ${CHROMEOS_REVISION:?})" 90 export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Official Buil d ${CHROMEOS_REVISION:?})"
49 elif [ "$REAL_USER" = "chrome-bot" ] 91 elif [ "$REAL_USER" = "chrome-bot" ]
50 then 92 then
51 export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Continuous Bu ild ${CHROMEOS_REVISION:?} - Builder: ${BUILDBOT_BUILD:-"N/A"})" 93 export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Continuous Bu ild ${CHROMEOS_REVISION:?} - Builder: ${BUILDBOT_BUILD:-"N/A"})"
52 else 94 else
53 # Use the $USER passthru via $CHROMEOS_RELEASE_CODENAME 95 # Use the $USER passthru via $CHROMEOS_RELEASE_CODENAME
54 export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Developer Bui ld ${CHROMEOS_REVISION:?} - $(date) - $CHROMEOS_RELEASE_CODENAME)" 96 export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Developer Bui ld ${CHROMEOS_REVISION:?} - $(date) - $CHROMEOS_RELEASE_CODENAME)"
55 fi 97 fi
56 98
57 # Set google-specific version numbers: 99 # Set google-specific version numbers:
58 # CHROMEOS_RELEASE_CODENAME is the codename of the release. 100 # CHROMEOS_RELEASE_CODENAME is the codename of the release.
59 # CHROMEOS_RELEASE_DESCRIPTION is the version displayed by Chrome; see 101 # CHROMEOS_RELEASE_DESCRIPTION is the version displayed by Chrome; see
60 # chrome/browser/chromeos/chromeos_version_loader.cc. 102 # chrome/browser/chromeos/chromeos_version_loader.cc.
61 # CHROMEOS_RELEASE_NAME is a human readable name for the build. 103 # CHROMEOS_RELEASE_NAME is a human readable name for the build.
62 # CHROMEOS_RELEASE_TRACK and CHROMEOS_RELEASE_VERSION are used by the software 104 # CHROMEOS_RELEASE_TRACK and CHROMEOS_RELEASE_VERSION are used by the software
63 # update service. 105 # update service.
64 # TODO(skrul): Remove GOOGLE_RELEASE once Chromium is updated to look at 106 # TODO(skrul): Remove GOOGLE_RELEASE once Chromium is updated to look at
65 # CHROMEOS_RELEASE_VERSION for UserAgent data. 107 # CHROMEOS_RELEASE_VERSION for UserAgent data.
66 cat <<EOF >> /etc/lsb-release 108 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/lsb-release"
67 CHROMEOS_RELEASE_CODENAME=$CHROMEOS_VERSION_CODENAME 109 CHROMEOS_RELEASE_CODENAME=$CHROMEOS_VERSION_CODENAME
68 CHROMEOS_RELEASE_DESCRIPTION=$CHROMEOS_VERSION_DESCRIPTION 110 CHROMEOS_RELEASE_DESCRIPTION=$CHROMEOS_VERSION_DESCRIPTION
69 CHROMEOS_RELEASE_NAME=$CHROMEOS_VERSION_NAME 111 CHROMEOS_RELEASE_NAME=$CHROMEOS_VERSION_NAME
70 CHROMEOS_RELEASE_TRACK=$CHROMEOS_VERSION_TRACK 112 CHROMEOS_RELEASE_TRACK=$CHROMEOS_VERSION_TRACK
71 CHROMEOS_RELEASE_VERSION=$CHROMEOS_VERSION_STRING 113 CHROMEOS_RELEASE_VERSION=$CHROMEOS_VERSION_STRING
72 GOOGLE_RELEASE=$CHROMEOS_VERSION_STRING 114 GOOGLE_RELEASE=$CHROMEOS_VERSION_STRING
73 CHROMEOS_AUSERVER=$CHROMEOS_VERSION_AUSERVER 115 CHROMEOS_AUSERVER=$CHROMEOS_VERSION_AUSERVER
74 CHROMEOS_DEVSERVER=$CHROMEOS_VERSION_DEVSERVER 116 CHROMEOS_DEVSERVER=$CHROMEOS_VERSION_DEVSERVER
75 EOF 117 EOF
76 118
77 # Turn user metrics logging on for official builds only. 119 # Turn user metrics logging on for official builds only.
78 if [ ${CHROMEOS_OFFICIAL:-0} -eq 1 ]; then 120 if [ ${CHROMEOS_OFFICIAL:-0} -eq 1 ]; then
79 touch /etc/send_metrics 121 sudo touch "${ROOT_FS_DIR}/etc/send_metrics"
80 fi 122 fi
81 123
82 # Create the admin group and a chronos user that can act as admin.
83 groupadd ${ADMIN_GROUP}
84 echo "%admin ALL=(ALL) ALL" >> /etc/sudoers
85 useradd -G "${ADMIN_GROUP},${DEFGROUPS}" -g ${ADMIN_GROUP} -s /bin/bash -m \
86 -c "${FULLNAME}" -p ${CRYPTED_PASSWD} ${USERNAME}
87
88 # Set timezone symlink 124 # Set timezone symlink
89 rm -f /etc/localtime 125 sudo rm -f "${ROOT_FS_DIR}/etc/localtime"
90 ln -s /mnt/stateful_partition/etc/localtime /etc/localtime 126 sudo ln -s /mnt/stateful_partition/etc/localtime "${ROOT_FS_DIR}/etc/localtime"
91 127
92 # make a mountpoint for stateful partition 128 # make a mountpoint for stateful partition
93 sudo mkdir -p "$ROOTFS_DIR"/mnt/stateful_partition 129 sudo mkdir -p "$ROOT_FS_DIR"/mnt/stateful_partition
94 sudo chmod 0755 "$ROOTFS_DIR"/mnt 130 sudo chmod 0755 "$ROOT_FS_DIR"/mnt
95 sudo chmod 0755 "$ROOTFS_DIR"/mnt/stateful_partition 131 sudo chmod 0755 "$ROOT_FS_DIR"/mnt/stateful_partition
96 132
97 # Copy everything from the rootfs_static_data directory to the corresponding 133 # Copy everything from the rootfs_static_data directory to the corresponding
98 # place on the filesystem. Note that this step has to occur after we've 134 # place on the filesystem. Note that this step has to occur after we've
99 # installed all of the packages but before we remove the setup dir. 135 # installed all of the packages.
100 chmod -R a+rX "${SETUP_DIR}/rootfs_static_data/." 136 TMP_STATIC=$(mktemp -d)
101 cp -r "${SETUP_DIR}/rootfs_static_data/common/." / 137 sudo cp -r "${SRC_ROOT}/rootfs_static_data/common/." "$TMP_STATIC"
102 # TODO: Copy additional target-platform-specific subdirectories. 138 # TODO: Copy additional target-platform-specific subdirectories.
139 sudo chmod -R a+rX "$TMP_STATIC/."
140 sudo cp -r "$TMP_STATIC/." "$ROOT_FS_DIR"
141 sudo rm -rf "$TMP_STATIC"
103 142
104 # Fix issue where alsa-base (dependency of alsa-utils) is messing up our sound 143 # Fix issue where alsa-base (dependency of alsa-utils) is messing up our sound
105 # drivers. The stock modprobe settings worked fine. 144 # drivers. The stock modprobe settings worked fine.
106 # TODO: Revisit when we have decided on how sound will work on chromeos. 145 # TODO: Revisit when we have decided on how sound will work on chromeos.
107 rm /etc/modprobe.d/alsa-base.conf 146 sudo rm "${ROOT_FS_DIR}/etc/modprobe.d/alsa-base.conf"
108 147
109 # Remove unneeded fonts. 148 # Remove unneeded fonts.
110 rm -rf /usr/share/fonts/X11 149 sudo rm -rf "${ROOT_FS_DIR}/usr/share/fonts/X11"
111 150
112 # The udev daemon takes a long time to start up and settle so we defer it until 151 # The udev daemon takes a long time to start up and settle so we defer it until
113 # after X11 has been started. In order to be able to mount the root file system 152 # after X11 has been started. In order to be able to mount the root file system
114 # and start X we pre-populate some devices. These are copied into /dev by the 153 # and start X we pre-populate some devices. These are copied into /dev by the
115 # chromeos_startup script. 154 # chromeos_startup script.
116 UDEV_DEVICES=/lib/udev/devices 155 # TODO: There is no good reason to put this in /lib/udev/devices. Move it.
117 mkdir "$UDEV_DEVICES"/dri 156 # TODO: Hopefully some of this can be taken care of by devtmpfs.
118 mkdir "$UDEV_DEVICES"/input 157 UDEV_DEVICES="${ROOT_FS_DIR}/lib/udev/devices"
119 mknod --mode=0600 "$UDEV_DEVICES"/initctl p 158 sudo mkdir -p "$UDEV_DEVICES"/dri
120 mknod --mode=0660 "$UDEV_DEVICES"/tty0 c 4 0 159 sudo mkdir -p "$UDEV_DEVICES"/input
121 mknod --mode=0660 "$UDEV_DEVICES"/tty1 c 4 1 160 sudo mkdir -p "$UDEV_DEVICES"/pts
122 mknod --mode=0660 "$UDEV_DEVICES"/tty2 c 4 2 161 sudo mkdir -p "$UDEV_DEVICES"/shm
123 mknod --mode=0666 "$UDEV_DEVICES"/tty c 5 0 162 sudo ln -sf /proc/self/fd/0 "$UDEV_DEVICES"/stdin
124 mknod --mode=0666 "$UDEV_DEVICES"/ptmx c 5 2 163 sudo ln -sf /proc/self/fd/0 "$UDEV_DEVICES"/stdout
125 mknod --mode=0640 "$UDEV_DEVICES"/mem c 1 1 164 sudo ln -sf /proc/self/fd/0 "$UDEV_DEVICES"/stderr
126 mknod --mode=0666 "$UDEV_DEVICES"/zero c 1 5 165 sudo mknod --mode=0600 "$UDEV_DEVICES"/initctl p
127 mknod --mode=0666 "$UDEV_DEVICES"/random c 1 8 166 sudo mknod --mode=0660 "$UDEV_DEVICES"/tty0 c 4 0
128 mknod --mode=0666 "$UDEV_DEVICES"/urandom c 1 9 167 sudo mknod --mode=0660 "$UDEV_DEVICES"/tty1 c 4 1
129 mknod --mode=0660 "$UDEV_DEVICES"/sda b 8 0 168 sudo mknod --mode=0660 "$UDEV_DEVICES"/tty2 c 4 2
130 mknod --mode=0660 "$UDEV_DEVICES"/sda1 b 8 1 169 sudo mknod --mode=0666 "$UDEV_DEVICES"/tty c 5 0
131 mknod --mode=0660 "$UDEV_DEVICES"/sda2 b 8 2 170 sudo mknod --mode=0660 "$UDEV_DEVICES"/ttyMSM2 c 252 2
132 mknod --mode=0660 "$UDEV_DEVICES"/sda3 b 8 3 171 if [ ! -c "$UDEV_DEVICES"/console ]; then
133 mknod --mode=0660 "$UDEV_DEVICES"/sda4 b 8 4 172 sudo mknod --mode=0600 "$UDEV_DEVICES"/console c 5 1
134 mknod --mode=0660 "$UDEV_DEVICES"/sdb b 8 16 173 fi
135 mknod --mode=0660 "$UDEV_DEVICES"/sdb1 b 8 17 174 sudo mknod --mode=0666 "$UDEV_DEVICES"/ptmx c 5 2
136 mknod --mode=0660 "$UDEV_DEVICES"/sdb2 b 8 18 175 sudo mknod --mode=0640 "$UDEV_DEVICES"/mem c 1 1
137 mknod --mode=0660 "$UDEV_DEVICES"/sdb3 b 8 19 176 if [ ! -c "$UDEV_DEVICES"/null ]; then
138 mknod --mode=0660 "$UDEV_DEVICES"/sdb4 b 8 20 177 sudo mknod --mode=0666 "$UDEV_DEVICES"/null c 1 3
139 mknod --mode=0660 "$UDEV_DEVICES"/fb0 c 29 0 178 fi
140 mknod --mode=0660 "$UDEV_DEVICES"/dri/card0 c 226 0 179 sudo mknod --mode=0666 "$UDEV_DEVICES"/zero c 1 5
141 mknod --mode=0640 "$UDEV_DEVICES"/input/mouse0 c 13 32 180 sudo mknod --mode=0666 "$UDEV_DEVICES"/random c 1 8
142 mknod --mode=0640 "$UDEV_DEVICES"/input/mice c 13 63 181 sudo mknod --mode=0666 "$UDEV_DEVICES"/urandom c 1 9
143 mknod --mode=0640 "$UDEV_DEVICES"/input/event0 c 13 64 182 sudo mknod --mode=0660 "$UDEV_DEVICES"/sda b 8 0
144 mknod --mode=0640 "$UDEV_DEVICES"/input/event1 c 13 65 183 sudo mknod --mode=0660 "$UDEV_DEVICES"/sda1 b 8 1
145 mknod --mode=0640 "$UDEV_DEVICES"/input/event2 c 13 66 184 sudo mknod --mode=0660 "$UDEV_DEVICES"/sda2 b 8 2
146 mknod --mode=0640 "$UDEV_DEVICES"/input/event3 c 13 67 185 sudo mknod --mode=0660 "$UDEV_DEVICES"/sda3 b 8 3
147 mknod --mode=0640 "$UDEV_DEVICES"/input/event4 c 13 68 186 sudo mknod --mode=0660 "$UDEV_DEVICES"/sda4 b 8 4
148 mknod --mode=0640 "$UDEV_DEVICES"/input/event5 c 13 69 187 sudo mknod --mode=0660 "$UDEV_DEVICES"/sdb b 8 16
149 mknod --mode=0640 "$UDEV_DEVICES"/input/event6 c 13 70 188 sudo mknod --mode=0660 "$UDEV_DEVICES"/sdb1 b 8 17
150 mknod --mode=0640 "$UDEV_DEVICES"/input/event7 c 13 71 189 sudo mknod --mode=0660 "$UDEV_DEVICES"/sdb2 b 8 18
151 mknod --mode=0640 "$UDEV_DEVICES"/input/event8 c 13 72 190 sudo mknod --mode=0660 "$UDEV_DEVICES"/sdb3 b 8 19
152 chown root.tty "$UDEV_DEVICES"/tty* 191 sudo mknod --mode=0660 "$UDEV_DEVICES"/sdb4 b 8 20
153 chown root.kmem "$UDEV_DEVICES"/mem 192 sudo mknod --mode=0660 "$UDEV_DEVICES"/fb0 c 29 0
154 chown root.disk "$UDEV_DEVICES"/sda* 193 sudo mknod --mode=0660 "$UDEV_DEVICES"/dri/card0 c 226 0
155 chown root.video "$UDEV_DEVICES"/fb0 194 sudo mknod --mode=0640 "$UDEV_DEVICES"/input/mouse0 c 13 32
156 chown root.video "$UDEV_DEVICES"/dri/card0 195 sudo mknod --mode=0640 "$UDEV_DEVICES"/input/mice c 13 63
157 chmod 0666 "$UDEV_DEVICES"/null # Fix misconfiguration of /dev/null 196 sudo mknod --mode=0640 "$UDEV_DEVICES"/input/event0 c 13 64
197 sudo mknod --mode=0640 "$UDEV_DEVICES"/input/event1 c 13 65
198 sudo mknod --mode=0640 "$UDEV_DEVICES"/input/event2 c 13 66
199 sudo mknod --mode=0640 "$UDEV_DEVICES"/input/event3 c 13 67
200 sudo mknod --mode=0640 "$UDEV_DEVICES"/input/event4 c 13 68
201 sudo mknod --mode=0640 "$UDEV_DEVICES"/input/event5 c 13 69
202 sudo mknod --mode=0640 "$UDEV_DEVICES"/input/event6 c 13 70
203 sudo mknod --mode=0640 "$UDEV_DEVICES"/input/event7 c 13 71
204 sudo mknod --mode=0640 "$UDEV_DEVICES"/input/event8 c 13 72
205 sudo chown root.tty "$UDEV_DEVICES"/tty*
206 sudo chown root.kmem "$UDEV_DEVICES"/mem
207 sudo chown root.disk "$UDEV_DEVICES"/sda*
208 sudo chown root.video "$UDEV_DEVICES"/fb0
209 sudo chown root.video "$UDEV_DEVICES"/dri/card0
210 sudo chmod 0666 "$UDEV_DEVICES"/null # Fix misconfiguration of /dev/null
158 211
159 # Since we may mount read-only, our mtab should symlink to /proc 212 # Since we may mount read-only, our mtab should symlink to /proc
160 ln -sf /proc/mounts /etc/mtab 213 sudo ln -sf /proc/mounts "${ROOT_FS_DIR}/etc/mtab"
161 214
162 # For the most part, we use our own set of Upstart jobs that were installed 215 # For the most part, we use our own set of Upstart jobs that were installed
163 # in /etc/init.chromeos so as not to mingle with jobs installed by various 216 # in /etc/init.chromeos so as not to mingle with jobs installed by various
164 # packages. We fix that up now. 217 # packages. We fix that up now.
165 cp /etc/init/tty2.conf /etc/init.chromeos 218 sudo cp "${ROOT_FS_DIR}/etc/init/tty2.conf" "${ROOT_FS_DIR}/etc/init.chromeos"
166 rm -rf /etc/init 219 sudo rm -rf "${ROOT_FS_DIR}/etc/init"
167 mv /etc/init.chromeos /etc/init 220 sudo mv "${ROOT_FS_DIR}/etc/init.chromeos" "${ROOT_FS_DIR}/etc/init"
168 221
169 # By default, xkb writes computed configuration data to 222 # By default, xkb writes computed configuration data to
170 # /var/lib/xkb. It can re-use this data to reduce startup 223 # /var/lib/xkb. It can re-use this data to reduce startup
171 # time. In addition, if it fails to write we've observed 224 # time. In addition, if it fails to write we've observed
172 # keyboard issues. We add a symlink to allow these writes. 225 # keyboard issues. We add a symlink to allow these writes.
173 rm -rf /var/lib/xkb 226 sudo rm -rf "${ROOT_FS_DIR}/var/lib/xkb"
174 ln -s /var/cache /var/lib/xkb 227 sudo ln -s /var/cache "${ROOT_FS_DIR}/var/lib/xkb"
175 228
176 # This is needed so that devicekit-disks has a place to 229 # This is needed so that devicekit-disks has a place to
177 # put its sql lite database. Since we do not need to 230 # put its sql lite database. Since we do not need to
178 # retain this information across boots, we are just 231 # retain this information across boots, we are just
179 # putting it in /var/tmp 232 # putting it in /var/tmp
180 rm -rf /var/lib/DeviceKit-disks 233 sudo rm -rf "${ROOT_FS_DIR}/var/lib/DeviceKit-disks"
181 ln -s /var/tmp /var/lib/DeviceKit-disks 234 sudo ln -s /var/tmp "${ROOT_FS_DIR}/var/lib/DeviceKit-disks"
182 235
183 # Remove pam-mount's default entry in common-auth and common-session 236 # Remove pam-mount's default entry in common-auth and common-session
184 sed -i 's/^\(.*pam_mount.so.*\)/#\1/g' /etc/pam.d/common-* 237 sudo sed -i 's/^\(.*pam_mount.so.*\)/#\1/g' "${ROOT_FS_DIR}"/etc/pam.d/common-*
185
186 # List all packages still installed post-pruning
187 sudo sh -c "/trunk/src/scripts/list_installed_packages.sh \
188 > /etc/package_list_pruned.txt"
189 238
190 # Clear the network settings. This must be done last, since it prevents 239 # Clear the network settings. This must be done last, since it prevents
191 # any subsequent steps from accessing the network. 240 # any subsequent steps from accessing the network.
192 cat <<EOF > /etc/network/interfaces 241 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/network/interfaces"
193 auto lo 242 auto lo
194 iface lo inet loopback 243 iface lo inet loopback
195 EOF 244 EOF
196 245
197 cat <<EOF > /etc/resolv.conf 246 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/resolv.conf"
198 # Use the connman dns proxy. 247 # Use the connman dns proxy.
199 nameserver 127.0.0.1 248 nameserver 127.0.0.1
200 EOF 249 EOF
201 chmod a-wx /etc/resolv.conf 250 sudo chmod a-wx "${ROOT_FS_DIR}/etc/resolv.conf"
OLDNEW
« no previous file with comments | « src/scripts/build_image.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698