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

Side by Side Diff: image_hacks.sh

Issue 6730047: crosutils: remove some unused scripts (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | image_to_virtualbox.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash
2
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
5 # found in the LICENSE file.
6
7 # This script is a wrapper around every part of the build system that corrupts
8 # the pristine image for various purposes.
9
10 # The purpose of this script is to allow a smooth transition from the old
11 # build system, where random corruptions of the pipelined approach to image
12 # creation happen in random places, to the new build system, where we keep all
13 # of them in one place.
14
15 # To avoid code duplication and preservation of the old build system until the
16 # release of chromite, we need to import all the "corrupting" code into here,
17 # but provide "legacy" interfaces to this code so that it can be used in
18 # exactly identical way. This is done in 2 phases:
19 # 1) Wrapping around various other scripts, providing a way to call them from
20 # this script.
21 # 2) Make this script consume the wrapped scripts and provide legacy symlinks,
22 # that do exactly the same thing as the old scripts.
23
24 #------ These are the scripts we're trying to kill --------#
25
26 # --- BEGIN COMMON.SH BOILERPLATE ---
27 # Load common CrOS utilities. Inside the chroot this file is installed in
28 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's
29 # location.
30 find_common_sh() {
31 local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")"))
32 local path
33
34 SCRIPT_ROOT=
35 for path in "${common_paths[@]}"; do
36 if [ -r "${path}/common.sh" ]; then
37 SCRIPT_ROOT=${path}
38 break
39 fi
40 done
41 }
42
43 find_common_sh
44 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1)
45 # --- END COMMON.SH BOILERPLATE ---
46
47 function mod_image_for_test() {
48 "${SCRIPTS_DIR}/mod_image_for_test.sh" "$@" || return $?
49 }
50
51 function mod_image_for_recovery() {
52 "${SCRIPTS_DIR}/mod_image_for_recovery.sh" "$@" || return $?
53 }
54
55 function mod_image_for_dev_recovery() {
56 "${SCRIPTS_DIR}/mod_image_for_dev_recovery.sh" "$@" || return $?
57 }
58
59 function customize_rootfs() {
60 "${SCRIPTS_DIR}/customize_rootfs" "$@" || return $?
61 }
62
63 #-------------------------- Tools -------------------------#
64
65 function board_to_arch() {
66 . "/build/${1}/etc/make.conf.board_setup" || return 1
67 TC_ARCH=$(echo "${CHOST}" | awk -F'-' '{ print $1 }')
68 case "${TC_ARCH}" in
69 (arm*) echo "arm";;
70 (*86) echo "x86";;
71 (*) error "Unable to determine ARCH from toolchain: ${CHOST}"; return 1;;
72 esac
73 }
74
75 #--------------------------- Main -------------------------#
76
77 function corrupt_for_recovery() {
78 :
79 }
80 function corrupt_for_dev_recovery() {
81 :
82 }
83 function corrupt_for_dev_install() {
84 :
85 }
86 function corrupt_for_factory_installer_shim() {
87 :
88 }
89 function corrupt_for_factory_test() {
90 :
91 }
92 function corrupt_for_test() {
93 :
94 }
95
96 function main() {
97 get_default_board
98
99 # Flag definitions:
100 DEFINE_string corruption_type "" \
101 "The type of corruption to invoke upon the slashfs."
102 DEFINE_string board "${DEFAULT_BOARD}" \
103 "The board to build an image for."
104 DEFINE_string slashfs "" \
105 "The path to root file system to corrupt."
106
107 # Parse command line.
108 FLAGS "$@" || return 1
109
110 # Sanity checking.
111 if [ -z "${FLAGS_corruption_type}" ]; then
112 echo "Please specify corruption type"; return 1
113 fi
114 if [ -z "${FLAGS_board}" ]; then
115 echo "You must specify board"; return 1
116 fi
117
118 # Customize_rootfs needs arch, we need to get it somehow.
119 ARCH="$(board_to_arch ${FLAGS_board})" || return 1
120
121 ###################################################
122 # Parametric corruption of the slashfs starts here.
123 ###################################################
124 #customize_rootfs --board="${FLAGS_board}" --target="${ARCH}" \
125 # --root="${FLAGS_slashroot}"
126
127 case ${FLAGS_corruption_type} in
128 (recovery) corrupt_for_recovery ;;
129 (dev_recovery) corrupt_for_dev_recovery ;;
130 (dev_install) corrupt_for_dev_install ;;
131 (factory_installer_shim) corrupt_for_factory_installer_shim ;;
132 (factory_test) corrupt_for_factory_test ;;
133 (test) corrupt_for_test ;;
134 esac
135 return $?
136 }
137
138 case "$(basename $0)" in
139 # (mod_image_for_test.sh) mod_image_for_test "$@" || return $?;;
140 # (mod_image_for_recovery.sh) mod_image_for_recovery "$@" || return $?;;
141 # (mod_image_for_dev_recovery.sh) mod_image_for_dev_recovery "$@" || return $?; ;
142 # (customize_rootfs) customize_rootfs "$@" || return $?;;
143 (image_hacks.sh) main "$@" || return $?;; # normal invocation
144 (*) echo "$0: Unknown invocation!"; exit 1 ;;
145 esac
OLDNEW
« no previous file with comments | « no previous file | image_to_virtualbox.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698