Statistics
| Branch: | Revision:

root / example / hooks / linux / overlays @ 8d77389f

History | View | Annotate | Download (1.2 kB)

1 84472880 Lance Albertson
#!/bin/bash
2 84472880 Lance Albertson
3 84472880 Lance Albertson
# Copyright (C) 2010 Oregon State University
4 84472880 Lance Albertson
#
5 84472880 Lance Albertson
# This program is free software; you can redistribute it and/or modify
6 84472880 Lance Albertson
# it under the terms of the GNU General Public License as published by
7 84472880 Lance Albertson
# the Free Software Foundation; either version 2 of the License, or
8 84472880 Lance Albertson
# (at your option) any later version.
9 84472880 Lance Albertson
#
10 84472880 Lance Albertson
# This program is distributed in the hope that it will be useful, but
11 84472880 Lance Albertson
# WITHOUT ANY WARRANTY; without even the implied warranty of
12 84472880 Lance Albertson
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 84472880 Lance Albertson
# General Public License for more details.
14 84472880 Lance Albertson
#
15 84472880 Lance Albertson
# You should have received a copy of the GNU General Public License
16 84472880 Lance Albertson
# along with this program; if not, write to the Free Software
17 84472880 Lance Albertson
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 84472880 Lance Albertson
# 02110-1301, USA.
19 84472880 Lance Albertson
#
20 84472880 Lance Albertson
# Copy files from an overlay directory into an instance. This assumes the same
21 84472880 Lance Albertson
# filesystem structure as the system.
22 84472880 Lance Albertson
23 84472880 Lance Albertson
set -e
24 84472880 Lance Albertson
25 84472880 Lance Albertson
. common.sh
26 84472880 Lance Albertson
27 84472880 Lance Albertson
debug set -x
28 84472880 Lance Albertson
29 84472880 Lance Albertson
if [ -z "${TARGET}" -o ! -d "${TARGET}" ] ; then
30 84472880 Lance Albertson
    log_error "Missing target directory"
31 84472880 Lance Albertson
    exit 1
32 84472880 Lance Albertson
fi
33 84472880 Lance Albertson
34 84472880 Lance Albertson
if [ -n "${OVERLAY}" ] ; then
35 84472880 Lance Albertson
    local overlay="${OVERLAYS_DIR}/${OVERLAY}"
36 84472880 Lance Albertson
    if [ ! -d "${overlay}" ] ; then
37 84472880 Lance Albertson
        log_error "${overlay} not found"
38 84472880 Lance Albertson
    fi
39 84472880 Lance Albertson
    # copy overlay files into target instance
40 84472880 Lance Albertson
    cp -a ${overlay} ${TARGET}
41 84472880 Lance Albertson
fi
42 84472880 Lance Albertson
43 84472880 Lance Albertson
exit 0