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

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

Issue 424011: build: Update fontconfig to fall back on Droid. (Closed)
Patch Set: update usernames Created 11 years, 1 month 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/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 # Customizes the root file system of a chromium-based os. 7 # Customizes the root file system of a chromium-based os.
8 # NOTE: This script should be called by build_image.sh. Do not run this 8 # 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. 9 # on your own unless you know what you are doing.
10 10
11 set -e 11 set -e
12 12
13 SETUP_DIR=$(dirname $0)
14
13 # Read options from the config file created by build_image.sh. 15 # Read options from the config file created by build_image.sh.
14 echo "Reading options..." 16 echo "Reading options..."
15 cat "$(dirname $0)/customize_opts.sh" 17 cat "${SETUP_DIR}/customize_opts.sh"
16 . "$(dirname $0)/customize_opts.sh" 18 . "${SETUP_DIR}/customize_opts.sh"
17 19
18 FULLNAME="ChromeOS User" 20 if [ ${CHROMEOS_OFFICIAL:-0} = 1 ]; then
21 FULLNAME="Google Chrome OS User"
22 else
23 FULLNAME="Chromium OS User"
24 fi
19 USERNAME="chronos" 25 USERNAME="chronos"
20 ADMIN_GROUP="admin" 26 ADMIN_GROUP="admin"
21 DEFGROUPS="adm,dialout,cdrom,floppy,audio,dip,video" 27 DEFGROUPS="adm,dialout,cdrom,floppy,audio,dip,video"
22 ADMIN_USERNAME="chronosdev" 28 ADMIN_USERNAME="chronosdev"
23 29
24 CRYPTED_PASSWD_FILE="/trunk/src/scripts/shared_user_passwd.txt" 30 CRYPTED_PASSWD_FILE="/trunk/src/scripts/shared_user_passwd.txt"
25 if [ -f $CRYPTED_PASSWD_FILE ] 31 if [ -f $CRYPTED_PASSWD_FILE ]; then
26 then
27 echo "Using password from $CRYPTED_PASSWD_FILE" 32 echo "Using password from $CRYPTED_PASSWD_FILE"
28 CRYPTED_PASSWD=$(cat $CRYPTED_PASSWD_FILE) 33 CRYPTED_PASSWD=$(cat $CRYPTED_PASSWD_FILE)
29 else 34 else
30 # Use a random password. unix_md5_crypt will generate a random salt. 35 # Use a random password. unix_md5_crypt will generate a random salt.
31 echo "Using random password." 36 echo "Using random password."
32 PASSWORD="$(base64 /dev/urandom | head -1)" 37 PASSWORD="$(base64 /dev/urandom | head -1)"
33 CRYPTED_PASSWD="$(echo "$PASSWORD" | openssl passwd -1 -stdin)" 38 CRYPTED_PASSWD="$(echo "$PASSWORD" | openssl passwd -1 -stdin)"
34 PASSWORD="gone now" 39 PASSWORD="gone now"
35 fi 40 fi
36 41
37 # Set CHROMEOS_VERSION_DESCRIPTION here (uses vars set in chromeos_version.sh) 42 # Set CHROMEOS_VERSION_DESCRIPTION here (uses vars set in chromeos_version.sh)
38 # Was removed from chromeos_version.sh which can also be run outside of chroot 43 # Was removed from chromeos_version.sh which can also be run outside of chroot
39 # where CHROMEOS_REVISION is set 44 # where CHROMEOS_REVISION is set
40 if [ ${CHROMEOS_OFFICIAL:-0} = 1 ] 45 if [ ${CHROMEOS_OFFICIAL:-0} = 1 ]; then
41 then
42 export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Official Bui ld ${CHROMEOS_REVISION:?})" 46 export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Official Bui ld ${CHROMEOS_REVISION:?})"
43 else 47 else
44 export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Developer Bu ild - $(date)-$USER)" 48 export CHROMEOS_VERSION_DESCRIPTION="${CHROMEOS_VERSION_STRING} (Developer Bu ild - $(date)-$USER)"
45 fi 49 fi
46 50
47 # Set google-specific version numbers: 51 # Set google-specific version numbers:
48 # CHROMEOS_RELEASE_CODENAME is the codename of the release. 52 # CHROMEOS_RELEASE_CODENAME is the codename of the release.
49 # CHROMEOS_RELEASE_DESCRIPTION is the version displayed by Chrome; see 53 # CHROMEOS_RELEASE_DESCRIPTION is the version displayed by Chrome; see
50 # chrome/browser/chromeos/chromeos_version_loader.cc. 54 # chrome/browser/chromeos/chromeos_version_loader.cc.
51 # CHROMEOS_RELEASE_NAME is a human readable name for the build. 55 # CHROMEOS_RELEASE_NAME is a human readable name for the build.
52 # CHROMEOS_RELEASE_TRACK and CHROMEOS_RELEASE_VERSION are used by the software 56 # CHROMEOS_RELEASE_TRACK and CHROMEOS_RELEASE_VERSION are used by the software
53 # update service. 57 # update service.
54 # TODO(skrul): Remove GOOGLE_RELEASE once Chromium is updated to look at 58 # TODO(skrul): Remove GOOGLE_RELEASE once Chromium is updated to look at
55 # CHROMEOS_RELEASE_VERSION for UserAgent data. 59 # CHROMEOS_RELEASE_VERSION for UserAgent data.
56 cat <<EOF >> /etc/lsb-release 60 cat <<EOF >> /etc/lsb-release
57 CHROMEOS_RELEASE_CODENAME=$CHROMEOS_VERSION_CODENAME 61 CHROMEOS_RELEASE_CODENAME=$CHROMEOS_VERSION_CODENAME
58 CHROMEOS_RELEASE_DESCRIPTION=$CHROMEOS_VERSION_DESCRIPTION 62 CHROMEOS_RELEASE_DESCRIPTION=$CHROMEOS_VERSION_DESCRIPTION
59 CHROMEOS_RELEASE_NAME=$CHROMEOS_VERSION_NAME 63 CHROMEOS_RELEASE_NAME=$CHROMEOS_VERSION_NAME
60 CHROMEOS_RELEASE_TRACK=$CHROMEOS_VERSION_TRACK 64 CHROMEOS_RELEASE_TRACK=$CHROMEOS_VERSION_TRACK
61 CHROMEOS_RELEASE_VERSION=$CHROMEOS_VERSION_STRING 65 CHROMEOS_RELEASE_VERSION=$CHROMEOS_VERSION_STRING
62 GOOGLE_RELEASE=$CHROMEOS_VERSION_STRING 66 GOOGLE_RELEASE=$CHROMEOS_VERSION_STRING
63 CHROMEOS_AUSERVER=$CHROMEOS_VERSION_AUSERVER 67 CHROMEOS_AUSERVER=$CHROMEOS_VERSION_AUSERVER
64 CHROMEOS_DEVSERVER=$CHROMEOS_VERSION_DEVSERVER 68 CHROMEOS_DEVSERVER=$CHROMEOS_VERSION_DEVSERVER
65 EOF 69 EOF
66 70
67 # Set the default X11 cursor theme to inherit our cursors.
68 mkdir -p /usr/share/icons/default
69 cat <<EOF > /usr/share/icons/default/index.theme
70 [Icon Theme]
71 Inherits=chromeos-cursors
72 EOF
73
74 # Turn user metrics logging on for official builds only. 71 # Turn user metrics logging on for official builds only.
75 if [ ${CHROMEOS_OFFICIAL:-0} -eq 1 ]; then 72 if [ ${CHROMEOS_OFFICIAL:-0} -eq 1 ]; then
76 touch /etc/send_metrics 73 touch /etc/send_metrics
77 fi 74 fi
78 75
79 # Create the admin group and a chronos user that can act as admin. 76 # Create the admin group and a chronos user that can act as admin.
80 groupadd ${ADMIN_GROUP} 77 groupadd ${ADMIN_GROUP}
81 echo "%admin ALL=(ALL) ALL" >> /etc/sudoers 78 echo "%admin ALL=(ALL) ALL" >> /etc/sudoers
82 useradd -G "${ADMIN_GROUP},${DEFGROUPS}" -g ${ADMIN_GROUP} -s /bin/bash -m \ 79 useradd -G "${ADMIN_GROUP},${DEFGROUPS}" -g ${ADMIN_GROUP} -s /bin/bash -m \
83 -c "${FULLNAME}" -p ${CRYPTED_PASSWD} ${USERNAME} 80 -c "${FULLNAME}" -p ${CRYPTED_PASSWD} ${USERNAME}
84 81
85 # Set timezone symlink 82 # Set timezone symlink
86 rm -f /etc/localtime 83 rm -f /etc/localtime
87 ln -s /mnt/stateful_partition/etc/localtime /etc/localtime 84 ln -s /mnt/stateful_partition/etc/localtime /etc/localtime
88 85
89 # make a mountpoint for stateful partition 86 # make a mountpoint for stateful partition
90 sudo mkdir -p "$ROOTFS_DIR"/mnt/stateful_partition 87 sudo mkdir -p "$ROOTFS_DIR"/mnt/stateful_partition
91 sudo chmod 0755 "$ROOTFS_DIR"/mnt 88 sudo chmod 0755 "$ROOTFS_DIR"/mnt
92 sudo chmod 0755 "$ROOTFS_DIR"/mnt/stateful_partition 89 sudo chmod 0755 "$ROOTFS_DIR"/mnt/stateful_partition
93 90
94 # If we don't create generic udev rules, then udev will try to save the 91 # Copy everything from the rootfs_static_data directory to the corresponding
95 # history of various devices (i.e. always associate a given device and MAC 92 # place on the filesystem. Note that this step has to occur after we've
96 # address with the same wlan number). As we use a keyfob across different 93 # installed all of the packages but before we remove the setup dir.
97 # machines the ethN and wlanN keep changing. 94 chmod -R a+rX "${SETUP_DIR}/rootfs_static_data/."
98 cat <<EOF >> /etc/udev/rules.d/70-persistent-net.rules 95 cp -r "${SETUP_DIR}/rootfs_static_data/common/." /
99 SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" 96 # TODO: Copy additional target-platform-specific subdirectories.
100 SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{type}=="1", KERNEL=="wlan*" , NAME="wlan0"
101 EOF
102 97
103 # Fix issue where alsa-base (dependency of alsa-utils) is messing up our sound 98 # Fix issue where alsa-base (dependency of alsa-utils) is messing up our sound
104 # drivers. The stock modprobe settings worked fine. 99 # drivers. The stock modprobe settings worked fine.
105 # TODO: Revisit when we have decided on how sound will work on chromeos. 100 # TODO: Revisit when we have decided on how sound will work on chromeos.
106 rm /etc/modprobe.d/alsa-base.conf 101 rm /etc/modprobe.d/alsa-base.conf
107 102
108 # -- Remove unneeded fonts and set default gtk font -- 103 # Remove unneeded fonts.
109 UNNEEDED_FONTS_TYPES=$(ls -d /usr/share/fonts/* | grep -v truetype) 104 UNNEEDED_FONTS_TYPES=$(ls -d /usr/share/fonts/* | grep -v truetype)
110 UNNEEDED_TRUETYPE_FONTS=$(ls -d /usr/share/fonts/truetype/* | grep -v ttf-droid) 105 UNNEEDED_TRUETYPE_FONTS=$(ls -d /usr/share/fonts/truetype/* | grep -v ttf-droid)
111 for i in $UNNEEDED_FONTS_TYPES $UNNEEDED_TRUETYPE_FONTS 106 for i in $UNNEEDED_FONTS_TYPES $UNNEEDED_TRUETYPE_FONTS; do
112 do
113 rm -rf "$i" 107 rm -rf "$i"
114 done 108 done
115 # set default gtk font:
116 cat <<EOF > /etc/gtk-2.0/gtkrc
117 gtk-font-name="DroidSans 8"
118 EOF
119
120 # -- Some boot performance customizations --
121
122 # Setup our xorg.conf. This allows us to avoid HAL overhead.
123 # TODO: Per-device xorg.conf rather than in this script.
124 cat <<EOF > /etc/X11/xorg.conf
125 Section "ServerFlags"
126 Option "AutoAddDevices" "false"
127 Option "DontZap" "false"
128 EndSection
129
130 Section "InputDevice"
131 Identifier "Keyboard1"
132 Driver "kbd"
133 Option "AutoRepeat" "250 30"
134 Option "XkbRules" "xorg"
135 Option "XkbModel" "pc104"
136 Option "CoreKeyboard"
137 EndSection
138
139 Section "InputDevice"
140 Identifier "Mouse1"
141 Driver "synaptics"
142 Option "SendCoreEvents" "true"
143 Option "Protocol" "auto-dev"
144 Option "SHMConfig" "on"
145 Option "CorePointer"
146 Option "MinSpeed" "0.2"
147 Option "MaxSpeed" "0.5"
148 Option "AccelFactor" "0.002"
149 Option "HorizScrollDelta" "100"
150 Option "VertScrollDelta" "100"
151 Option "HorizEdgeScroll" "0"
152 Option "VertEdgeScroll" "1"
153 Option "TapButton1" "1"
154 Option "TapButton2" "2"
155 Option "MaxTapTime" "180"
156 Option "FingerLow" "24"
157 Option "FingerHigh" "50"
158 EndSection
159
160 # Everything after this point was added to include support for USB as a
161 # secondary mouse device.
162 Section "InputDevice"
163 Identifier "USBMouse"
164 Driver "mouse"
165 Option "Device" "/dev/input/mice" # multiplexed HID mouse input device
166 Option "Protocol" "IMPS/2"
167 Option "ZAxisMapping" "4 5" # support a wheel as buttons 4 and 5
168 Option "Emulate3Buttons" "true" # just in case it is a 2 button
169 EndSection
170
171 # Defines a non-default server layout which pulls in the USB Mouse as a
172 # secondary input device.
173 Section "ServerLayout"
174 Identifier "DefaultLayout"
175 # Screen "DefaultScreen"
176 InputDevice "Mouse1" "CorePointer"
177 InputDevice "USBMouse" "AlwaysCore"
178 InputDevice "Keyboard1" "CoreKeyboard"
179 EndSection
180 EOF
181 109
182 # The udev daemon takes a long time to start up and settle so we defer it until 110 # The udev daemon takes a long time to start up and settle so we defer it until
183 # after X11 has been started. In order to be able to mount the root file system 111 # after X11 has been started. In order to be able to mount the root file system
184 # and start X we pre-propulate some devices. These are copied into /dev by the 112 # and start X we pre-propulate some devices. These are copied into /dev by the
185 # chromeos_startup script. 113 # chromeos_startup script.
186 UDEV_DEVICES=/lib/udev/devices 114 UDEV_DEVICES=/lib/udev/devices
187 mkdir "$UDEV_DEVICES"/dri 115 mkdir "$UDEV_DEVICES"/dri
188 mkdir "$UDEV_DEVICES"/input 116 mkdir "$UDEV_DEVICES"/input
189 mknod --mode=0600 "$UDEV_DEVICES"/initctl p 117 mknod --mode=0600 "$UDEV_DEVICES"/initctl p
190 mknod --mode=0660 "$UDEV_DEVICES"/tty0 c 4 0 118 mknod --mode=0660 "$UDEV_DEVICES"/tty0 c 4 0
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 cat <<EOF > /etc/network/interfaces 190 cat <<EOF > /etc/network/interfaces
263 auto lo 191 auto lo
264 iface lo inet loopback 192 iface lo inet loopback
265 EOF 193 EOF
266 194
267 cat <<EOF > /etc/resolv.conf 195 cat <<EOF > /etc/resolv.conf
268 # Use the connman dns proxy. 196 # Use the connman dns proxy.
269 nameserver 127.0.0.1 197 nameserver 127.0.0.1
270 EOF 198 EOF
271 chmod a-wx /etc/resolv.conf 199 chmod a-wx /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