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

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

Issue 522003: Fix issue where debconf was asking about the kernel config. (Closed)
Patch Set: Created 10 years, 12 months 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 | « no previous file | 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/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 install packages into the target root file system. 7 # Script to install packages into the target root file system.
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.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 if [[ -z "$ROOT_FS_DIR" ]]; then 45 if [[ -z "$ROOT_FS_DIR" ]]; then
46 echo "Error: --root is required." 46 echo "Error: --root is required."
47 exit 1 47 exit 1
48 fi 48 fi
49 if [[ ! -d "$ROOT_FS_DIR" ]]; then 49 if [[ ! -d "$ROOT_FS_DIR" ]]; then
50 echo "Error: Root FS does not exist? ($ROOT_FS_DIR)" 50 echo "Error: Root FS does not exist? ($ROOT_FS_DIR)"
51 exit 1 51 exit 1
52 fi 52 fi
53 53
54 # Create the temporary apt source.list used to install packages. 54 # Create the temporary apt source.list used to install packages.
55 APT_SOURCE="${ROOT_FS_DIR}/../sources.list" 55 APT_SOURCE="${FLAGS_output_dir}/sources.list"
56 cat <<EOF > "$APT_SOURCE" 56 cat <<EOF > "$APT_SOURCE"
57 deb file:"$FLAGS_setup_dir" local_packages/ 57 deb file:"$FLAGS_setup_dir" local_packages/
58 deb $FLAGS_server $FLAGS_suite main restricted multiverse universe 58 deb $FLAGS_server $FLAGS_suite main restricted multiverse universe
59 EOF 59 EOF
60 60
61 # Cache directory for APT to use. 61 # Cache directory for APT to use.
62 APT_CACHE_DIR="${FLAGS_output_dir}/tmp/cache/" 62 APT_CACHE_DIR="${FLAGS_output_dir}/tmp/cache/"
63 mkdir -p "${APT_CACHE_DIR}/archives/partial" 63 mkdir -p "${APT_CACHE_DIR}/archives/partial"
64 64
65 # Create the apt configuration file. See "man apt.conf" 65 # Create the apt configuration file. See "man apt.conf"
66 APT_CONFIG="${ROOT_FS_DIR}/../apt.conf" 66 APT_PARTS="${FLAGS_output_dir}/apt.conf.d"
67 mkdir -p "$APT_PARTS" # An empty apt.conf.d to avoid other configs.
68 export APT_CONFIG="${FLAGS_output_dir}/apt.conf"
67 cat <<EOF > "$APT_CONFIG" 69 cat <<EOF > "$APT_CONFIG"
70 APT
71 {
72 Install-Recommends "0";
73 Install-Suggests "0";
74 Get
75 {
76 Assume-Yes "1";
77 };
78 };
68 Dir 79 Dir
69 { 80 {
70 Cache "$APT_CACHE_DIR"; # TODO: Empty string to disable? 81 Cache "$APT_CACHE_DIR";
71 Cache { 82 Cache {
72 archives "${APT_CACHE_DIR}/archives"; # TODO: Why do we need this? 83 archives "${APT_CACHE_DIR}/archives";
73 }; 84 };
74 Etc 85 Etc
75 { 86 {
76 sourcelist "$APT_SOURCE" 87 sourcelist "$APT_SOURCE";
88 parts "$APT_PARTS";
77 }; 89 };
78 State "${ROOT_FS_DIR}/var/lib/apt/"; 90 State "${ROOT_FS_DIR}/var/lib/apt/";
79 State 91 State
80 { 92 {
81 status "${ROOT_FS_DIR}/var/lib/dpkg/status"; 93 status "${ROOT_FS_DIR}/var/lib/dpkg/status";
82 }; 94 };
83 }; 95 };
84 DPkg 96 DPkg
85 { 97 {
86 options {"--root=${ROOT_FS_DIR}";}; 98 options {"--root=${ROOT_FS_DIR}";};
87 }; 99 };
88 EOF 100 EOF
89 101
90 # TODO: Full audit of the apt conf dump to make sure things are ok. 102 # TODO: Full audit of the apt conf dump to make sure things are ok.
91 apt-config -c="$APT_CONFIG" dump > "${ROOT_FS_DIR}/../apt.conf.dump" 103 apt-config dump > "${FLAGS_output_dir}/apt.conf.dump"
92 104
93 # Install prod packages 105 # Install prod packages
94 COMPONENTS=`cat $FLAGS_package_list | grep -v ' *#' | grep -v '^ *$' | sed '/$/{ N;s/\n/ /;}'` 106 COMPONENTS=`cat $FLAGS_package_list | grep -v ' *#' | grep -v '^ *$' | sed '/$/{ N;s/\n/ /;}'`
95 sudo apt-get -c="$APT_CONFIG" update 107 sudo APT_CONFIG="$APT_CONFIG" apt-get update
96 sudo apt-get -c="$APT_CONFIG" --yes --force-yes --no-install-recommends \ 108 sudo APT_CONFIG="$APT_CONFIG" apt-get --force-yes \
97 install $COMPONENTS 109 install $COMPONENTS
98 110
99 # Create kernel installation configuration to suppress warnings, 111 # Create kernel installation configuration to suppress warnings,
100 # install the kernel in /boot, and manage symlinks. 112 # install the kernel in /boot, and manage symlinks.
101 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/kernel-img.conf" 113 cat <<EOF | sudo dd of="${ROOT_FS_DIR}/etc/kernel-img.conf"
102 link_in_boot = yes 114 link_in_boot = yes
103 do_symlinks = yes 115 do_symlinks = yes
104 minimal_swap = yes 116 minimal_swap = yes
105 clobber_modules = yes 117 clobber_modules = yes
106 warn_reboot = no 118 warn_reboot = no
107 do_bootloader = no 119 do_bootloader = no
108 do_initrd = yes 120 do_initrd = yes
109 warn_initrd = no 121 warn_initrd = no
110 EOF 122 EOF
111 123
112 # Install the kernel. 124 # Install the kernel.
113 sudo apt-get -c="$APT_CONFIG" --yes --force-yes --no-install-recommends \ 125 sudo APT_CONFIG="$APT_CONFIG" apt-get --force-yes \
114 install "linux-image-${FLAGS_kernel_version}" 126 install "linux-image-${FLAGS_kernel_version}"
115 127
116 # Setup bootchart. 128 # Setup bootchart.
117 # TODO: Move this and other developer oriented "components" into an optional 129 # TODO: Move this and other developer oriented "components" into an optional
118 # package-list-prod-dev.txt (ideally with a better name). 130 # package-list-prod-dev.txt (ideally with a better name).
119 sudo apt-get -c="$APT_CONFIG" --yes --force-yes --no-install-recommends \ 131 sudo APT_CONFIG="$APT_CONFIG" apt-get --force-yes \
120 install bootchart 132 install bootchart
121 133
122 # Clean up the apt cache. 134 # Clean up the apt cache.
123 # TODO: The cache was populated by debootstrap, not these installs. Remove 135 # TODO: The cache was populated by debootstrap, not these installs. Remove
124 # this line when we can get debootstrap to stop doing this. 136 # this line when we can get debootstrap to stop doing this.
125 sudo rm -f "${ROOT_FS_DIR}"/var/cache/apt/archives/*.deb 137 sudo rm -f "${ROOT_FS_DIR}"/var/cache/apt/archives/*.deb
126 138
127 # List all packages installed so far, since these are what the local 139 # List all packages installed so far, since these are what the local
128 # repository needs to contain. 140 # repository needs to contain.
129 # TODO: Replace with list_installed_packages.sh when it is fixed up. 141 # TODO: Replace with list_installed_packages.sh when it is fixed up.
130 dpkg --root="${ROOT_FS_DIR}" -l > \ 142 dpkg --root="${ROOT_FS_DIR}" -l > \
131 "${FLAGS_output_dir}/package_list_installed.txt" 143 "${FLAGS_output_dir}/package_list_installed.txt"
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698