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

Side by Side Diff: client/site_tests/factory_Wipe/src/switch_partitions.sh

Issue 3329005: Update wipe to work with verified rootfs (Closed) Base URL: http://git.chromium.org/git/autotest.git
Patch Set: Created 10 years, 3 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 | 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 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 2 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # This script can be called to switch from kernel slot A / sda3 6 # This script can be called to switch from kernel slot A / sda3
7 # to kernel slot B / sda5 and vice versa. 7 # to kernel slot B / sda5 and vice versa.
8 8
9 ROOT_DEV=$(rootdev) 9 ROOT_DEV=$(rootdev -s)
10 OTHER_ROOT_DEV=$(echo $ROOT_DEV | tr '35' '53') 10 OTHER_ROOT_DEV=$(echo $ROOT_DEV | tr '35' '53')
11 11
12 if [ "${ROOT_DEV}" = "${OTHER_ROOT_DEV}" ] 12 if [ "${ROOT_DEV}" = "${OTHER_ROOT_DEV}" ]
13 then 13 then
14 echo "Not a normal rootfs partition (3 or 5): ${ROOT_DEV}" 14 echo "Not a normal rootfs partition (3 or 5): ${ROOT_DEV}"
15 exit 1 15 exit 1
16 fi 16 fi
17 17
18 # Successfully being able to mount the other partition 18 # Successfully being able to mount the other partition
19 # and run postinst guarantees that there is a real partition there. 19 # and run postinst guarantees that there is a real partition there.
20 echo "Running postinst on $OTHER_ROOT_DEV" 20 echo "Running postinst on $OTHER_ROOT_DEV"
21 MOUNTPOINT=/tmp/newpart 21 MOUNTPOINT=$(mktemp -d)
22 mkdir -p "$MOUNTPOINT" 22 mkdir -p "$MOUNTPOINT"
23 mount "$OTHER_ROOT_DEV" "$MOUNTPOINT" 23 mount -o ro "$OTHER_ROOT_DEV" "$MOUNTPOINT"
24 "$MOUNTPOINT"/postinst "$OTHER_ROOT_DEV" 24 "$MOUNTPOINT"/postinst "$OTHER_ROOT_DEV"
25 POSTINST_RETURN_CODE=$? 25 POSTINST_RETURN_CODE=$?
26 umount "$MOUNTPOINT" 26 umount "$MOUNTPOINT"
27 rmdir "$MOUNTPOINT" 27 rmdir "$MOUNTPOINT"
28 28
29 exit $POSTINST_RETURN_CODE 29 exit $POSTINST_RETURN_CODE
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