22 lines
447 B
Bash
Executable file
22 lines
447 B
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [[ $# -lt 1 ]]; then
|
|
echo "Usage: agenix-load-file.sh <destination-file>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
dest="${!#}"
|
|
source_path="${SECRET_SOURCE_FILE:-}"
|
|
|
|
if [[ -z "$source_path" ]]; then
|
|
echo "SECRET_SOURCE_FILE is not set; point it at the source file to encrypt." >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ ! -f "$source_path" ]]; then
|
|
echo "Source file '$source_path' does not exist." >&2
|
|
exit 1
|
|
fi
|
|
|
|
cp "$source_path" "$dest"
|