SCRIPT_TIME_START=$(date +%Y%m%dT%H%M%S.%N);
PATH="$HOME/.local/bin:$PATH"; # Add "$(systemd-path user-binaries)" path in case apps saved there
SCRIPT_HOSTNAME=$(hostname); # Save hostname of system running this script.
-SCRIPT_VERSION="0.2.3"; # Define version of script.
+SCRIPT_VERSION="0.3.1"; # Define version of script.
SCRIPT_NAME="bkgpslog"; # Define basename of script file.
SCRIPT_URL="https://gitlab.com/baltakatei/ninfacyzga-01"; # Define wesite hosting this script.
AGE_VERSION="1.0.0-beta2"; # Define version of age (encryption program)
appendArgTar(){
# Desc: Writes first argument to temporary file with arguments as options, then appends file to tar
# Usage: writeArg "$(echo "Data to be written.")" [name of file to be inserted] [tar path] [temp dir] ([cmd1] [cmd2] [cmd3] [cmd4]...)
+ # Version: 1.0.0
# Input: arg1: data to be written
# arg2: file name of file to be inserted into tar
# arg3: tar archive path (must exist first)
# Depends: bash 5
# Save function name
- local FN="${FUNCNAME[0]}"
- yell "DEBUG:STATUS:$FN:Finished appendArgTar()."
+ local FN="${FUNCNAME[0]}";
+ #yell "DEBUG:STATUS:$FN:Finished appendArgTar()."
# Set file name
if ! [ -z "$2" ]; then FILENAME="$2"; else yell "ERROR:$FN:Not enough arguments."; exit 1; fi
if ! [ -z "$7" ]; then CMD3="$7"; else CMD3="tee /dev/null "; fi # command string 3
if ! [ -z "$8" ]; then CMD4="$8"; else CMD4="tee /dev/null "; fi # command string 4
- # Debug
- yell "STATUS:$FN:CMD1:$CMD1"
- yell "STATUS:$FN:CMD2:$CMD2"
- yell "STATUS:$FN:CMD3:$CMD3"
- yell "STATUS:$FN:CMD4:$CMD4"
- yell "STATUS:$FN:FILENAME:$FILENAME"
- yell "STATUS:$FN:TAR_PATH:$TAR_PATH"
- yell "STATUS:$FN:TMP_DIR:$TMP_DIR"
+ # # Debug
+ # yell "DEBUG:STATUS:$FN:CMD1:$CMD1"
+ # yell "DEBUG:STATUS:$FN:CMD2:$CMD2"
+ # yell "DEBUG:STATUS:$FN:CMD3:$CMD3"
+ # yell "DEBUG:STATUS:$FN:CMD4:$CMD4"
+ # yell "DEBUG:STATUS:$FN:FILENAME:$FILENAME"
+ # yell "DEBUG:STATUS:$FN:TAR_PATH:$TAR_PATH"
+ # yell "DEBUG:STATUS:$FN:TMP_DIR:$TMP_DIR"
+
# Write to temporary working dir
echo "$1" | $CMD1 | $CMD2 | $CMD3 | $CMD4 > "$TMP_DIR"/"$FILENAME";
# Append to tar
try tar --append --directory="$TMP_DIR" --file="$TAR_PATH" "$FILENAME";
- yell "DEBUG:STATUS:$FN:Finished appendArgTar()."
+ #yell "DEBUG:STATUS:$FN:Finished appendArgTar()."
} # Append Bash var to file appended to Tar archive
magicWriteVersion() {
# Desc: Appends time-stamped VERSION to PATHOUT_TAR
appendArgTar "$bufferBash" "$FILEOUT_KML" "$PATHOUT_TAR" "$DIR_TMP" "$CMD_CONV_KML" "$CMD_COMPRESS" "$CMD_ENCRYPT"; # Write KML file
# Remove secured chunks from DIR_TMP
try rm "$PATHOUT_NMEA" "$PATHOUT_GPX" "$PATHOUT_KML";
- yell "DEBUG:STATUS:$FN:Finished magicWriteBuffer().";
+ # yell "DEBUG:STATUS:$FN:Finished magicWriteBuffer().";
} # bkgpslog write function
main() {