blob: bb4f8048ed4be76371a4867e13faa70d6c45b6cb [file] [log] [blame]
E. Scott Daniels95359302019-07-30 12:37:48 -04001#!/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
33echo "$0 starting" >&2
34argv0=${0##*/}
35
36target=${1:-/export}
37exportd=/tmp/exported # build script dumps here
38
39if ! cd $target
40then
41 echo "$argv0: abort: cannot find or switch to: $target" >&2
42 exit 1
43fi
44
45if [[ ! -w ./ ]]
46then
47 echo "$argv0: abort: cannot write to target directory: $target"
48 exit 1
49fi
50
51if [[ ! -d $exportd ]]
52then
53 echo "$argv0: abort: unable to find the exported directory: $exportd" >&2
54 exit 1
55fi
56
57errors=0
58echo "$argv0: copy: $exportd/* --> $target" >&2
59if ! cp -v $exportd/* $target/
60then
61 errors=1
62fi
63
64echo "$argv0: finshed, $errors errors"
65exit $errors