Darin Petkov | 9a0a96d | 2010-03-19 16:24:45 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Darin Petkov | 9a0a96d | 2010-03-19 16:24:45 -0700 | [diff] [blame] | 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 |
| 4 | # found in the LICENSE file. |
| 5 | |
| 6 | # Start the Dev Server after making sure we are running under a chroot. |
| 7 | |
Greg Spencer | 798d75f | 2011-02-01 22:04:49 -0800 | [diff] [blame] | 8 | # --- BEGIN COMMON.SH BOILERPLATE --- |
| 9 | # Load common CrOS utilities. Inside the chroot this file is installed in |
| 10 | # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 11 | # location. |
| 12 | find_common_sh() { |
| 13 | local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")")) |
| 14 | local path |
| 15 | |
| 16 | SCRIPT_ROOT= |
| 17 | for path in "${common_paths[@]}"; do |
| 18 | if [ -r "${path}/common.sh" ]; then |
| 19 | SCRIPT_ROOT=${path} |
| 20 | break |
| 21 | fi |
| 22 | done |
| 23 | } |
| 24 | |
| 25 | find_common_sh |
| 26 | . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 27 | # --- END COMMON.SH BOILERPLATE --- |
Darin Petkov | 9a0a96d | 2010-03-19 16:24:45 -0700 | [diff] [blame] | 28 | |
Sean O'Connor | 505822a | 2010-03-20 23:23:48 -0700 | [diff] [blame] | 29 | # Script must be run inside the chroot if not in 'always serve' mode. |
Greg Spencer | 798d75f | 2011-02-01 22:04:49 -0800 | [diff] [blame] | 30 | if [[ "$1" != "--archive_dir" ]]; then |
| 31 | restart_in_chroot_if_needed "$@" |
Don Garrett | 640a058 | 2010-05-04 16:54:28 -0700 | [diff] [blame] | 32 | fi |
Darin Petkov | 9a0a96d | 2010-03-19 16:24:45 -0700 | [diff] [blame] | 33 | |
Zdenek Behan | 99f7a53 | 2011-03-01 22:57:33 +0100 | [diff] [blame] | 34 | # This is the location of the script now. |
| 35 | exec $(dirname ${0})/../../chroot/usr/bin/start_devserver "$@" |