mirror of
https://github.com/optim-enterprises-bv/secureblue.git
synced 2025-11-08 14:23:38 +00:00
* feat: add files and systemd module * fix: yaml formatting * fix: yaml formatting * fix: remove comment completely * fix: yaml formatting * docs: add back inline comment * reformat: rename variables * fix: fix systemd escaped string * fix: fix systemd service formatting with printf * fix: attempting to fix systemd module problems * chore: remove debug config and code from systemd module * docs: added WIP docs for systemd, reworked files README * docs: added more detail for systemd module * docs: update READMEs to be more consistent * docs: remove unneeded sentence * docs: remove unneeded sentence * chore: fix issues described in PR review * docs: fix markdown formatting * docs: fix markdown formatting * docs: better markdown
34 lines
955 B
Bash
34 lines
955 B
Bash
#!/usr/bin/env bash
|
|
|
|
# Tell build process to exit if there are any errors.
|
|
set -oue pipefail
|
|
|
|
get_yaml_array FILES '.files[]' "$1"
|
|
|
|
cd "$CONFIG_DIRECTORY/files"
|
|
|
|
if [[ ${#FILES[@]} -gt 0 ]]; then
|
|
echo "Adding files to image"
|
|
for pair in "${FILES[@]}"; do
|
|
FILE="$PWD/$(echo $pair | yq 'to_entries | .[0].key')"
|
|
DEST=$(echo $pair | yq 'to_entries | .[0].value')
|
|
if [ -d "$FILE" ]; then
|
|
if [ ! -d "$DEST" ]; then
|
|
mkdir -p "$DEST"
|
|
fi
|
|
echo "Copying $FILE to $DEST"
|
|
cp -r "$FILE"/* $DEST
|
|
elif [ -f "$FILE" ]; then
|
|
DEST_DIR=$(dirname "$DEST")
|
|
if [ ! -d "$DEST_DIR" ]; then
|
|
mkdir -p "$DEST_DIR"
|
|
fi
|
|
echo "Copying $FILE to $DEST"
|
|
cp $FILE $DEST
|
|
else
|
|
echo "File or Directory $FILE Does Not Exist in $CONFIG_DIRECTORY/files"
|
|
exit 1
|
|
fi
|
|
done
|
|
fi
|