Made sqlite3 a dependency, updated code and docs to reflect this

This commit is contained in:
Jesse Gardner 2021-03-29 09:39:22 -07:00
parent 3825d6594b
commit fb02296f24
4 changed files with 11 additions and 18 deletions

1
man.md
View File

@ -30,6 +30,7 @@ In addition to virsh, basic linux utilities and QEMU/KVM, qq2clone
requires: requires:
Bash 4.0+ Bash 4.0+
sqlite3
qemu-img qemu-img
libvirt tools: libvirt tools:
virt-clone virt-clone

View File

@ -27,6 +27,7 @@ In addition to virsh, basic linux utilities and QEMU/KVM, qq2clone
requires: requires:
Bash 4.0+ Bash 4.0+
sqlite3
qemu-img qemu-img
libvirt tools: libvirt tools:
virt-clone virt-clone

View File

@ -245,7 +245,7 @@ local elem missing=0
# These we need to check for # These we need to check for
local -a depends=( virsh virt-clone virt-xml virt-xml-validate qemu-img \ local -a depends=( virsh virt-clone virt-xml virt-xml-validate qemu-img \
xmllint ) xmllint sqlite3)
# These are from gnu-coreutils, util-linux, or are simply extremely common # These are from gnu-coreutils, util-linux, or are simply extremely common
# and almost certainly present. However, checking for any external # and almost certainly present. However, checking for any external
@ -364,14 +364,6 @@ make_dir "$TEMPLATE_DIR"
make_dir "$POOL_DIR" make_dir "$POOL_DIR"
check_rw -r "$TEMPLATE_DIR" "$POOL_DIR" check_rw -r "$TEMPLATE_DIR" "$POOL_DIR"
chmod +rx "${QQ2_DIR}/sqlite3" &>/dev/null
{ [[ -e "${QQ2_DIR}/sqlite3" ]] && [[ -x "${QQ2_DIR}/sqlite3" ]] &&
[[ -r "${QQ2_DIR}/sqlite3" ]] ; } ||
{ echo "sqlite3 binary must be present at"
echo "${QQ2_DIR}/sqlite3"
echo "and must be readable/executable"
exit "$E_file"; } >&2
local use_spice spicy local use_spice spicy
if command -v virt-viewer &>/dev/null; then if command -v virt-viewer &>/dev/null; then
use_spice=1 use_spice=1
@ -412,12 +404,9 @@ get_config ()
# PARAMETERS: None # PARAMETERS: None
#=========================================================================# #=========================================================================#
{ {
declare -g QQ2_DIR declare -g QQ2_DIR
QQ2_DIR="$(<"${HOME}/.config/qq2clone")" QQ2_DIR="$(<"${HOME}/.config/qq2clone")"
QQ2_DIR="$(strip_ws "$QQ2_DIR")" QQ2_DIR="$(strip_ws "$QQ2_DIR")"
[[ -e "$QQ2_DIR/sqlite3" ]] ||
{ echo "The sqlite3 binary is missing from $QQ2_DIR";
exit "$E_depends"; }
local check local check
read -r check \ read -r check \
@ -776,16 +765,17 @@ return 0
} }
#=========================================================================# #=========================================================================#
sqlite3 () sqlite3 ()
# DESCRIPTION: Pass arguments to sqlite3 binary, prepending basic # DESCRIPTION: Pass arguments to sqlite3 binary, prepending basic
# parameters that are always used # parameters that are always used
# INPUT: Arguments to sqlite3 # INPUT: Arguments to sqlite3
# OUTPUT: Dependent on sqlite3 # OUTPUT: Dependent on sqlite3
# PARAMETERS: Arbitrary # PARAMETERS: Arbitrary
#=========================================================================# #=========================================================================#
{ {
"${QQ2_DIR}/sqlite3" --batch --separator $'\n' "${QQ2_DIR}/qq2clone.db"\ $(unset sqlite3; command -v sqlite3) --batch --separator $'\n' \
"${QQ2_DIR}/qq2clone.db"\
"$@" || unexpected_error sqlite3 "$@" || unexpected_error sqlite3
} }
#-----------------------------# #-----------------------------#
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@# #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@#

View File

@ -34,6 +34,7 @@ requires:
.nf .nf
\f[C] \f[C]
Bash 4.0+ Bash 4.0+
sqlite3
qemu\-img qemu\-img
libvirt tools: libvirt tools:
virt\-clone virt\-clone