blob: c68f4572dae72228fae44e3e7041dbfcb778d5a5 [file] [log] [blame]
wrider3280e622019-11-05 12:13:28 -05001#!/usr/bin/env bash
2
3# -----------------------------------------------------------------------------
4#
5# Copyright (C) 2019 AT&T Intellectual Property and Nokia
6#
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18#
19# -----------------------------------------------------------------------------
20
21# Mnemonic: publish
22# Abstract: Simple script which copies files that the build script left
23# for export (packages, but could be anything). This expects
24# that all files in /tmp/exportd are to be copied to the
25# export directory /export The export directory is assumed to be
26# mounted from the outside world as /export, though we will use $1
27# as an override so this can be changed if needed.
28#
29# Date: 30 July 2019
30#
31# -----------------------------------------------------------------------------
32
33# This file is copied from ric-plt/lib/rmr ci/publish.sh.
34#
35
36echo "$0 starting" >&2
37argv0=${0##*/}
38
39target=${1:-/export}
40exportd=/tmp/exported # build script dumps here
41
42if ! cd $target
43then
44 echo "$argv0: abort: cannot find or switch to: $target" >&2
45 exit 1
46fi
47
48if [[ ! -w ./ ]]
49then
50 echo "$argv0: abort: cannot write to target directory: $target"
51 exit 1
52fi
53
54if [[ ! -d $exportd ]]
55then
56 echo "$argv0: abort: unable to find the exported directory: $exportd" >&2
57 exit 1
58fi
59
60errors=0
61echo "$argv0: copy: $exportd/* --> $target" >&2
62if ! cp -v $exportd/* $target/
63then
64 errors=1
65fi
66
67echo "$argv0: finshed, $errors errors"
68exit $errors