
This update creates a common copy_files function that handles missing or glob copy handling modes. Test Plan: PASS: Verify copy handling when - no files match pattern - one file pattern match - several files match pattern Closes-Bug: 2068495 Change-Id: I0068e087f8867f4bafcedd7a89289da5136a29d5
32 lines
606 B
Bash
32 lines
606 B
Bash
#! /bin/bash
|
|
#
|
|
# Copyright (c) 2023 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
|
|
# Loads Up Utilities and Commands Variables
|
|
|
|
source /usr/local/sbin/collect_parms
|
|
source /usr/local/sbin/collect_utils
|
|
|
|
SYSADMIN_DIR="${extradir}/sysadmin"
|
|
mkdir -p ${SYSADMIN_DIR}
|
|
|
|
# Function to copy files based on pattern
|
|
copy_files()
|
|
{
|
|
local pattern=$1
|
|
for file in /home/sysadmin/${pattern} ; do
|
|
[ -e "${file}" ] && cp "${file}" "${SYSADMIN_DIR}/"
|
|
done
|
|
}
|
|
|
|
# get the log and yaml files from the sysadmin home dir
|
|
copy_files "*.log"
|
|
copy_files "*.yml"
|
|
copy_files "*.yaml"
|
|
|
|
exit 0
|