blob: 24f2a8739a43558013cd102bbc296abb43b8530a [file] [log] [blame]
Darin Petkov9a0a96d2010-03-19 16:24:45 -07001#!/bin/bash
Darin Petkov9a0a96d2010-03-19 16:24:45 -07002# 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 Spencer798d75f2011-02-01 22:04:49 -08008# --- 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.
12find_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
25find_common_sh
26. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1)
27# --- END COMMON.SH BOILERPLATE ---
Darin Petkov9a0a96d2010-03-19 16:24:45 -070028
Sean O'Connor505822a2010-03-20 23:23:48 -070029# Script must be run inside the chroot if not in 'always serve' mode.
Greg Spencer798d75f2011-02-01 22:04:49 -080030if [[ "$1" != "--archive_dir" ]]; then
31 restart_in_chroot_if_needed "$@"
Don Garrett640a0582010-05-04 16:54:28 -070032fi
Darin Petkov9a0a96d2010-03-19 16:24:45 -070033
Zdenek Behan99f7a532011-03-01 22:57:33 +010034# This is the location of the script now.
35exec $(dirname ${0})/../../chroot/usr/bin/start_devserver "$@"