OLD | NEW |
1 #!/bin/bash | 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 # Script to customize the root file system after packages have been installed. | 7 # Script to customize the root file system after packages have been installed. |
8 # | 8 # |
9 # 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 |
10 # on your own unless you know what you are doing. | 10 # on your own unless you know what you are doing. |
11 | 11 |
12 # Load common constants. This should be the first executable line. | 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. | 13 # The path to common.sh should be relative to your script's location. |
14 . "$(dirname "$0")/common.sh" | 14 . "$(dirname "$0")/common.sh" |
15 | 15 |
16 # Script must be run inside the chroot | 16 # Script must be run inside the chroot |
17 assert_inside_chroot | 17 assert_inside_chroot |
18 | 18 |
19 # Flags | 19 # Flags |
20 DEFINE_string target "x86" \ | 20 DEFINE_string arch "x86" \ |
21 "The target architecture to build for. One of { x86, arm }." | 21 "The target architecture to build for. One of { x86, arm }." |
22 DEFINE_string root "" \ | 22 DEFINE_string root "" \ |
23 "The root file system to customize." | 23 "The root file system to customize." |
24 | 24 |
25 # Parse command line | 25 # Parse command line |
26 FLAGS "$@" || exit 1 | 26 FLAGS "$@" || exit 1 |
27 eval set -- "${FLAGS_ARGV}" | 27 eval set -- "${FLAGS_ARGV}" |
28 | 28 |
29 # Die on any errors. | 29 # Die on any errors. |
30 set -e | 30 set -e |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 # make a mountpoint for stateful partition | 137 # make a mountpoint for stateful partition |
138 sudo mkdir -p "$ROOT_FS_DIR"/mnt/stateful_partition | 138 sudo mkdir -p "$ROOT_FS_DIR"/mnt/stateful_partition |
139 sudo chmod 0755 "$ROOT_FS_DIR"/mnt | 139 sudo chmod 0755 "$ROOT_FS_DIR"/mnt |
140 sudo chmod 0755 "$ROOT_FS_DIR"/mnt/stateful_partition | 140 sudo chmod 0755 "$ROOT_FS_DIR"/mnt/stateful_partition |
141 | 141 |
142 # Copy everything from the rootfs_static_data directory to the corresponding | 142 # Copy everything from the rootfs_static_data directory to the corresponding |
143 # place on the filesystem. Note that this step has to occur after we've | 143 # place on the filesystem. Note that this step has to occur after we've |
144 # installed all of the packages. | 144 # installed all of the packages. |
145 TMP_STATIC=$(mktemp -d) | 145 TMP_STATIC=$(mktemp -d) |
146 sudo cp -r "${SRC_ROOT}/rootfs_static_data/common/." "$TMP_STATIC" | 146 sudo cp -r "${SRC_ROOT}/rootfs_static_data/common/." "$TMP_STATIC" |
147 # TODO: Copy additional target-platform-specific subdirectories. | 147 # TODO: Copy additional arch-platform-specific subdirectories. |
148 sudo chmod -R a+rX "$TMP_STATIC/." | 148 sudo chmod -R a+rX "$TMP_STATIC/." |
149 sudo cp -r "$TMP_STATIC/." "$ROOT_FS_DIR" | 149 sudo cp -r "$TMP_STATIC/." "$ROOT_FS_DIR" |
150 sudo rm -rf "$TMP_STATIC" | 150 sudo rm -rf "$TMP_STATIC" |
151 | 151 |
152 # Fix issue where alsa-base (dependency of alsa-utils) is messing up our sound | 152 # Fix issue where alsa-base (dependency of alsa-utils) is messing up our sound |
153 # drivers. The stock modprobe settings worked fine. | 153 # drivers. The stock modprobe settings worked fine. |
154 # TODO: Revisit when we have decided on how sound will work on chromeos. | 154 # TODO: Revisit when we have decided on how sound will work on chromeos. |
155 ! sudo rm "${ROOT_FS_DIR}/etc/modprobe.d/alsa-base.conf" | 155 ! sudo rm "${ROOT_FS_DIR}/etc/modprobe.d/alsa-base.conf" |
156 | 156 |
157 # Remove unneeded fonts. | 157 # Remove unneeded fonts. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/network/interfaces" | 253 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/network/interfaces" |
254 auto lo | 254 auto lo |
255 iface lo inet loopback | 255 iface lo inet loopback |
256 EOF | 256 EOF |
257 | 257 |
258 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/resolv.conf" | 258 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/resolv.conf" |
259 # Use the connman dns proxy. | 259 # Use the connman dns proxy. |
260 nameserver 127.0.0.1 | 260 nameserver 127.0.0.1 |
261 EOF | 261 EOF |
262 sudo chmod a-wx "${ROOT_FS_DIR}/etc/resolv.conf" | 262 sudo chmod a-wx "${ROOT_FS_DIR}/etc/resolv.conf" |
OLD | NEW |