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

Side by Side Diff: src/platform/factory_installer/factory_install.sh

Issue 1556022: Factory Installer. (Closed)
Patch Set: fixes for review Created 10 years, 8 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
OLDNEW
(Empty)
1 #!/bin/sh -e
2
3 # Copyright (c) 2010 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 . "$(dirname "$0")/chromeos-common.sh"
8 . "/opt/google/memento_updater/memento_updater_logging.sh"
9
10 if [ $(id -u) -ne 0 ]; then
11 echo "You must run this as root."
12 exit 1
13 fi
14
15 # If we get in a respawn loop, sleeping for 1 minute before starting is nice.
16 sleep 60
17
18 # TODO(adlr): pick an install device in a matter that works on x86 and ARM.
19 # This works on x86 only, afaik.
20 DST=/dev/sda
21 DST_FACTORY_PART=3
22 DST_RELEASE_PART=5
23
24 log "Factory Install: Setting partition table"
25
26 /usr/sbin/chromeos-install --dst "${DST}" --skip_rootfs --run_as_root --yes \
27 2>&1 | cat >> "$MEMENTO_AU_LOG"
28
29 cleanup_loop() {
30 sleep 1 # TODO(adlr): figure out why this sleep seems to be required
31 losetup -d "$LOOP_DEV" 2>&1 | cat >> "$MEMENTO_AU_LOG"
32 }
33
34 # Call as: setup_loop loop_dev device partition#
35 setup_loop() {
36 OFFSET=$(partsize "$2" "$3")
37 losetup -o "$OFFSET" "$1" "$2" 2>&1 | cat >> "$MEMENTO_AU_LOG"
38 }
39
40 # Install the two partitions
41 for i in FACTORY RELEASE; do
42 PART=$(eval "echo \$DST_${i}_PART")
43 if [ "$i" = "FACTORY" ]; then
44 CHANNEL_ARG='--force_track=factory-channel'
45 else
46 CHANNEL_ARG=""
47 fi
48
49 LOOP_DEV=$(losetup -f)
50 setup_loop "$LOOP_DEV" "$DST" "$PART" || exit 1
51 trap cleanup_loop INT TERM EXIT
52
53 log "Factory Install: Installing $i partition to $PART"
54
55 RESULT="$(/opt/google/memento_updater/memento_updater.sh --dst_partition \
56 "${DST}${PART}" --allow_removable_boot $CHANNEL_ARG)"
57
58 if [ "$RESULT" != "UPDATED" ]; then
59 log "Factory Install: AU failed"
60 exit 1
61 fi
62 cleanup_loop
63 trap - INT TERM EXIT
64 done
65
66 log "All done installing."
67
68 shutdown -r now
69 sleep 1d # sleep indefinitely to avoid respawning rather than shutting down
OLDNEW
« no previous file with comments | « src/platform/factory_installer/factory_install.conf ('k') | src/platform/memento_softwareupdate/memento_updater.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698