#!/usr/bin/env bash
#===============================================================================
#
# DIRECTORY:
# ---
#
# FILE:
# ./accounts_plugin.sh
#
# USAGE:
# . accounts_plugin.sh
# OR
# source accounts_plugin.sh
#
# DESCRIPTION:
# Accounts plugin (library) to generate content with simple template engine.
#
# BUGS:
# ---
#
# TESTS:
# - shellcheck -s bash -e SC2034 ./accounts_plugin.sh
# - shellcheck -s ksh -e SC2034 ./accounts_plugin.sh
# - shellcheck -s dash -e SC2034 ./accounts_plugin.sh
#
# AUTHOR:
# Patrick Neumann, patrick@neumannsland.de
#
# COAUTHOR(S):
# Odin Heitmann, odin.heitmann@gmail.com
#
# COMPANY:
# (privately)
#
# VERSION:
# 1.0
#
# LINK TO THE MOST CURRENT VERSION:
# (Sorry, we bet, I'm not allowed to publish it over GitHub!)
#
# CREATED:
# 2018-06-01
#
# COPYRIGHT (C):
# 2018 - Patrick Neumann & Odin Heitmann
#
# LICENSE:
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# WARRANTY:
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see Accounts3.sqlite not found
"
error "Accounts3.sqlite not found"
readonly ACCOUNTS_LIST="
${ACCOUNTS_SQLITE/${IOS_BACKUP}/\/private\/var}
"
# * -> don't forget to copy write ahead log!
${BIN_CP} "${ACCOUNTS_SQLITE}"* "${FOLDER}/"
readonly ACCOUNTS_LIST="$( ${BIN_SQLITE3} -html "${FOLDER}/Accounts3.sqlite" \
"SELECT a.Z_PK, \
DATETIME(a.ZDATE+978307200, 'unixepoch'), \
t.ZACCOUNTTYPEDESCRIPTION, \
a.ZUSERNAME \
FROM ZACCOUNT AS a, \
ZACCOUNTTYPE AS t \
WHERE a.ZACCOUNTTYPE=t.Z_PK;" )"
fi
if [ "${DEBUG}" = "on" ] ; then
${BIN_PRINTF} "INFO: accounts_plugin processed.\\n" 1>&2
fi
}
#-------------------------------------------------------------------------------
# Partial template for hardware information for the simple template engine.
#-------------------------------------------------------------------------------
# SC2034: all "unused" vars are verified!
ACCOUNTS_INFORMATION=$( ${BIN_CAT} <<'EOF'
ID | Date | Description | Username |
---|